Skip to contentSkip to conversation

meson: add tests option

PATCH In review Romain Naour 3 participants 5 messages Feb 26, 2021 – Mar 3, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: add tests option

tests/fp/fp-bench.c use fenv.h that is not always provided by the libc (uClibc).

To workaround this issue, add an new meson option to disable tests while building Qemu.

Fixes:
http://autobuild.buildroot.net/results/53f5d8baa994d599b9da013ee643b82353366ec3/build-end.log

---
 configure         | 7 +++++++
 meson.build       | 6 +++++-
 meson_options.txt | 3 +++
 3 files changed, 15 insertions(+), 1 deletion(-)
configure +7 -0
index a79b3746d4..cd114f4b9e 100755
@@ -464,6 +464,7 @@ gettext="auto"
 fuse="auto"
 fuse_lseek="auto"
 multiprocess="no"
+tests="auto"
 
 malloc_trim="auto"
 
@@ -1562,6 +1563,10 @@ for opt do
   ;;
   --disable-multiprocess) multiprocess="no"
   ;;
+  --disable-tests) tests="disabled"
+  ;;
+  --enable-tests) tests="enabled"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -1915,6 +1920,7 @@ disabled with --disable-FEATURE, default is enabled if available
   fuse            FUSE block device export
   fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE exports
   multiprocess    Multiprocess QEMU support
+  tests           build tests
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -6428,6 +6434,7 @@ NINJA=$ninja $meson setup \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi \
         $(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
 	-Dtcg_interpreter=$tcg_interpreter \
+        -Dtests=$tests \
         $cross_arg \
         "$PWD" "$source_path"
 
meson.build +5 -1
index 05a67c20d9..2d7cbc0fbd 100644
@@ -2341,7 +2341,11 @@ subdir('scripts')
 subdir('tools')
 subdir('pc-bios')
 subdir('docs')
-subdir('tests')
+
+if get_option('tests').enabled()
+  subdir('tests')
+endif
+
 if gtk.found()
   subdir('po')
 endif
meson_options.txt +3 -0
index 675a9c500a..be30ad5450 100644
@@ -114,6 +114,9 @@ option('virtfs', type: 'feature', value: 'auto',
 option('virtiofsd', type: 'feature', value: 'auto',
        description: 'build virtiofs daemon (virtiofsd)')
 
+option('tests', type : 'feature', value : 'auto',
+       description: 'Tests build support')
+
 option('capstone', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the capstone library')
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Romain Naour

tests/fp/fp-bench.c use fenv.h that is not always provided by the libc (uClibc).

For such problem it might be better to check for the availability of the header and then to only disable the single test that depends on it if the header is not available.

Anyway, a switch to disable the tests completely could still be handy in some cases, so FWIW:

Quoted 84 lines

To workaround this issue, add an new meson option to disable tests while building Qemu.

Fixes:
http://autobuild.buildroot.net/results/53f5d8baa994d599b9da013ee643b82353366ec3/build-end.log

---
  configure         | 7 +++++++
  meson.build       | 6 +++++-
  meson_options.txt | 3 +++
  3 files changed, 15 insertions(+), 1 deletion(-)
configure +7 -0
index a79b3746d4..cd114f4b9e 100755
@@ -464,6 +464,7 @@ gettext="auto"
  fuse="auto"
  fuse_lseek="auto"
  multiprocess="no"
+tests="auto"
 
  malloc_trim="auto"
 
@@ -1562,6 +1563,10 @@ for opt do
    ;;
    --disable-multiprocess) multiprocess="no"
    ;;
+  --disable-tests) tests="disabled"
+  ;;
+  --enable-tests) tests="enabled"
+  ;;
    *)
        echo "ERROR: unknown option $opt"
        echo "Try '$0 --help' for more information"
@@ -1915,6 +1920,7 @@ disabled with --disable-FEATURE, default is enabled if available
    fuse            FUSE block device export
    fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE exports
    multiprocess    Multiprocess QEMU support
+  tests           build tests
 
  NOTE: The object files are built at the place where configure is launched
  EOF
@@ -6428,6 +6434,7 @@ NINJA=$ninja $meson setup \
          -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi \
          $(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
  	-Dtcg_interpreter=$tcg_interpreter \
+        -Dtests=$tests \
          $cross_arg \
          "$PWD" "$source_path"
 
meson.build +5 -1
index 05a67c20d9..2d7cbc0fbd 100644
@@ -2341,7 +2341,11 @@ subdir('scripts')
  subdir('tools')
  subdir('pc-bios')
  subdir('docs')
-subdir('tests')
+
+if get_option('tests').enabled()
+  subdir('tests')
+endif
+
  if gtk.found()
    subdir('po')
  endif
meson_options.txt +3 -0
index 675a9c500a..be30ad5450 100644
@@ -114,6 +114,9 @@ option('virtfs', type: 'feature', value: 'auto',
  option('virtiofsd', type: 'feature', value: 'auto',
         description: 'build virtiofs daemon (virtiofsd)')
 
+option('tests', type : 'feature', value : 'auto',
+       description: 'Tests build support')
+
  option('capstone', type: 'combo', value: 'auto',
         choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
         description: 'Whether and how to find the capstone library')
#2 lore raw
Quoted 9 lines · Thomas Huth
Quoted 2 lines · Romain Naour

tests/fp/fp-bench.c use fenv.h that is not always provided by the libc (uClibc).

For such  problem it might be better to check for the availability of the header and then to only disable the single test that depends on it if the header is not available.

Anyway, a switch to disable the tests completely could still be handy in some cases, so FWIW:

I disagree, without a use case the right thing to do is to check for fenv.h. It's as easy as this:

tests/meson.build +1 -1
index 0c939f89f7..3b9b2f0483 100644
@@ -281,7 +281,7 @@ test('decodetree', sh,
      workdir: meson.current_source_dir() / 'decode',
      suite: 'decodetree')
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all and cc.has_header('fenv.h')
   subdir('fp')
 endif
 

Thanks,

Paolo

#3 lore raw

Hello,

Le 02/03/2021 à 12:08, Paolo Bonzini a écrit :

Quoted 8 lines · Thomas Huth
Quoted 7 lines · Romain Naour
Quoted 2 lines

tests/fp/fp-bench.c use fenv.h that is not always provided by the libc (uClibc).

For such  problem it might be better to check for the availability of the header and then to only disable the single test that depends on it if the header is not available.

You're right, I thought about adding a header check but I noticed that was no option to disable all tests. Buildroot try to avoid as much as possible building tests program.

Quoted 3 lines
Quoted 3 lines

Anyway, a switch to disable the tests completely could still be handy in some cases, so FWIW:

It can save some build time:

qemu build with tests disabled
real 3m27,310s
user 19m56,887s
sys 2m1,738s

qemu build with tests enabled
real 4m0,638s
user 23m34,963s
sys 2m32,944s

Quoted 5 lines
Quoted 2 lines

I disagree, without a use case the right thing to do is to check for fenv.h. It's as easy as this:

Is it ok if I take your patch to disable fp tests when fenv.h is missing and resend my patch with an updated commit log to disable all tests to save some build time?

Best regards,
Romain

Quoted 18 lines
tests/meson.build +1 -1
index 0c939f89f7..3b9b2f0483 100644
@@ -281,7 +281,7 @@ test('decodetree', sh,
       workdir: meson.current_source_dir() / 'decode',
       suite: 'decodetree')
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all and cc.has_header('fenv.h')
    subdir('fp')

 endif

Thanks,

Paolo

#4 lore raw
Quoted 5 lines · Romain Naour
Quoted 2 lines

I disagree, without a use case the right thing to do is to check for fenv.h. It's as easy as this:

Is it ok if I take your patch to disable fp tests when fenv.h is missing and resend my patch with an updated commit log to disable all tests to save some build time?

To save build time you could also mark the tests as "build_by_default: false". They should be built lazily when you run "make check".

Paolo