From 26134b4565a85e133f6f77b16b4fe9cd0c530a07 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Apr 2022 20:58:33 -0400 Subject: [PATCH 1/5] meson: don't require valgrind tests It's entirely possible some people don't have valgrind installed, but still want to run the tests. If they don't have it installed, then they probably don't intend to run those precise test targets anyway. Also, this solves an error when running the tests in an automated environment. The valgrind tests have a hard dependency on behavior such as `./zstd` erroring out with the message "stdin is a console, aborting" which does not work if the automated environment doesn't have a console. As a rough heuristic, automated environments lacking a console will *probably* also not have valgrind, so avoiding that test definition neatly sidesteps the issue. Also, valgrind is not easily installable on macOS, at least homebrew says it isn't available there. This makes it needlessly hard to enable the testsuite on macOS. --- build/meson/tests/meson.build | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index 22f43209ad..09168de78f 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -134,13 +134,15 @@ checkTag = executable('checkTag', # ============================================================================= if tests_supported_oses.contains(host_machine_os) - valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true) + valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: false) valgrindTest_py = files('valgrindTest.py') - test('valgrindTest', - valgrindTest_py, - args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench], - depends: [zstd, datagen, fuzzer, fullbench], - timeout: 600) # Timeout should work on HDD drive + if valgrind_prog.found() + test('valgrindTest', + valgrindTest_py, + args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench], + depends: [zstd, datagen, fuzzer, fullbench], + timeout: 600) # Timeout should work on HDD drive + endif endif if host_machine_os != os_windows From 9c3e18f7feff00b6d816a6c4cbea906e0ef1fd93 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 14 Dec 2022 21:10:41 -0500 Subject: [PATCH 2/5] meson: add support for running both fast and slow version of tests playTests.sh has an option to run really slow tests. This is enabled by default in Meson, but what we really want is to do like the Makefile, and run the fast ones by default, but with an option to run the slow ones instead. --- build/meson/tests/meson.build | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index 09168de78f..f7ba531018 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -21,7 +21,6 @@ FUZZER_FLAGS = ['--no-big-tests'] FUZZERTEST = '-T200s' ZSTREAM_TESTTIME = '-T90s' DECODECORPUS_TESTTIME = '-T30' -ZSTDRTTEST = ['--test-large-data'] # ============================================================================= # Executables @@ -147,13 +146,25 @@ endif if host_machine_os != os_windows playTests_sh = find_program(join_paths(zstd_rootdir, 'tests/playTests.sh'), required: true) - test('test-zstd', - playTests_sh, - args: ZSTDRTTEST, - env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'], - depends: [datagen], - workdir: meson.current_build_dir(), - timeout: 2800) # Timeout should work on HDD drive + + # add slow tests only if the meson version is new enough to support + # test setups with default-excluded suites + if meson.version().version_compare('>=0.57.0') + matrix = {'fast': [], 'slow': ['--test-large-data']} + else + matrix = {'fast': []} + endif + + foreach suite, opt: matrix + test('test-zstd-'+suite, + playTests_sh, + args: opt, + env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'], + depends: [datagen], + suite: suite, + workdir: meson.current_build_dir(), + timeout: 2800) # Timeout should work on HDD drive + endforeach endif test('test-fullbench-1', @@ -192,3 +203,11 @@ test('test-decodecorpus', args: ['-t', DECODECORPUS_TESTTIME], timeout: 60) test('test-poolTests', poolTests) # should be fast + +if meson.version().version_compare('>=0.57.0') + add_test_setup('fast', + is_default: true, + exclude_suites: ['slow']) + add_test_setup('slow', + exclude_suites: ['fast']) +endif From 7f29c1847d5b36908f13592c31fa178072b4db0f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 14 Dec 2022 21:46:09 -0500 Subject: [PATCH 3/5] meson: add Linux CI Travis is no longer run, but this wasn't ported to something else. --- .github/workflows/dev-short-tests.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index 08df1c07cd..423134fc2f 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -178,6 +178,30 @@ jobs: make clean CC=clang MOREFLAGS="-Werror -Wimplicit-fallthrough -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0 + meson-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install packages + run: | + sudo apt-get update + sudo apt-get -y install build-essential python3-pip ninja-build liblz4-dev + pip install --pre meson + - name: Build with Meson + run: | + meson setup \ + --buildtype=debugoptimized \ + -Db_lundef=false \ + -Dauto_features=enabled \ + -Dbin_programs=true \ + -Dbin_tests=true \ + -Dbin_contrib=true \ + -Ddefault_library=both \ + build/meson builddir + ninja -C builddir/ + meson test -C builddir/ --print-errorlogs + meson install -C builddir --destdir staging/ + cmake-visual-2019: runs-on: windows-2019 strategy: From 937e9d3b6257304e1533e9e6104ecff8e8dd5a30 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 14 Dec 2022 21:57:59 -0500 Subject: [PATCH 4/5] meson: add Windows CI There are a couple of oddities here. We don't attempt to build e.g. contrib, because that doesn't seem to work at the moment. Also notice that each command is its own step. This happens because github actions runs in powershell, which doesn't seem to let you abort on the first failure. --- .github/workflows/dev-short-tests.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index 423134fc2f..d4d8f13fdc 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -202,6 +202,27 @@ jobs: meson test -C builddir/ --print-errorlogs meson install -C builddir --destdir staging/ + meson-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Install packages + run: pip install --pre meson + - name: Initialize the MSVC dev command prompt + uses: ilammy/msvc-dev-cmd@674ff850cbd739c402260838fa45b7114f750570 + - name: Configure with Meson + run: | + meson setup build/meson/ builddir/ -Dbin_tests=true + - name: Build with Meson + run: | + ninja -C builddir/ + - name: Test with Meson + run: | + meson test -C builddir/ --print-errorlogs + - name: Install with Meson + run: | + meson install -C builddir --destdir staging/ + cmake-visual-2019: runs-on: windows-2019 strategy: From 6747ba4ef5c5ff10e567fe6becf41436a745d0a1 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 19 Apr 2022 21:08:02 -0400 Subject: [PATCH 5/5] meson: mark a known test failure on Windows --- build/meson/tests/meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index f7ba531018..30df7d9312 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -192,6 +192,8 @@ test('test-zstream-1', test('test-zstream-3', zstreamtest, args: ['--newapi', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, + # --newapi dies on Windows with "exit status 3221225477 or signal 3221225349 SIGinvalid" + should_fail: host_machine_os == os_windows, timeout: 120) test('test-longmatch', longmatch, timeout: 36) test('test-invalidDictionaries', invalidDictionaries) # should be fast