meson: Enable testing in CI (#1609)

* tests: Fix shellcheck warnings in playTests.sh

* tests: Do not use ../programs which is relative to tests dirs

This commit fixes error when running playTests.sh in Meson.
Mesonbuild runs out of tree, so ./datagen not in `zstd/tests` dir,
it lies in <mesonbuilddir>/tests. This leads to ../programs invalid.

* tests: Replace relative paths for zstd/tests dir

* playTests: Set shell options explicitly, not in shebang

* playTests: Replace echo -e with printf

* meson: Fix test-zstd

Use std=gnu99 to build and test just like `make test`.

* meson: Fix legacy test

* meson: Enable testing in CI

Run build under release mode for faster test time.

* meson: Increase timeout time for test-zstream
This commit is contained in:
lzutao 2019-05-03 02:35:37 +07:00 committed by Nick Terrell
parent f8178ec74e
commit 1d70bc3ba9
4 changed files with 299 additions and 284 deletions

View File

@ -190,14 +190,19 @@ matrix:
&& python3 ~/get-pip.py --user && python3 ~/get-pip.py --user
&& pip3 install --user meson && pip3 install --user meson
script: script:
- meson setup --buildtype=debug - meson setup
-Db_lundef=false --buildtype=debugoptimized
-Dauto_features=enabled -Db_lundef=false
-Dbuild_{programs,tests,contrib}=true -Dauto_features=enabled
-Ddefault_library=both -Dbuild_{programs,tests,contrib}=true
build/meson builddir -Ddefault_library=both
build/meson builddir
- pushd builddir - pushd builddir
- ninja
- meson test --verbose --no-rebuild
- DESTDIR=./staging ninja install - DESTDIR=./staging ninja install
- tree ./staging - tree ./staging
after_failure:
- cat "$TRAVIS_BUILD_DIR"/builddir/meson-logs/testlog.txt
allow_failures: allow_failures:
- env: ALLOW_FAILURES=true - env: ALLOW_FAILURES=true

View File

@ -12,7 +12,7 @@ project('zstd',
['c', 'cpp'], ['c', 'cpp'],
license: ['BSD', 'GPLv2'], license: ['BSD', 'GPLv2'],
default_options : [ default_options : [
'c_std=c99', 'c_std=gnu99',
'cpp_std=c++11', 'cpp_std=c++11',
'buildtype=release' 'buildtype=release'
], ],

View File

@ -112,13 +112,15 @@ invalidDictionaries = executable('invalidDictionaries',
dependencies: [ libzstd_dep ], dependencies: [ libzstd_dep ],
install: false) install: false)
legacy_sources = [join_paths(zstd_rootdir, 'tests/legacy.c')] if 0 < legacy_level and legacy_level <= 4
legacy = executable('legacy', legacy_sources = [join_paths(zstd_rootdir, 'tests/legacy.c')]
legacy_sources, legacy = executable('legacy',
# Use -Dlegacy_level build option to control it legacy_sources,
#c_args: '-DZSTD_LEGACY_SUPPORT=4', # Use -Dlegacy_level build option to control it
dependencies: [ libzstd_dep ], #c_args: '-DZSTD_LEGACY_SUPPORT=4',
install: false) dependencies: [ libzstd_dep ],
install: false)
endif
decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'), decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'), join_paths(zstd_rootdir, 'programs/timefn.c'),
@ -177,7 +179,8 @@ if host_machine_os != os_windows
args: ZSTDRTTEST, args: ZSTDRTTEST,
env: ['ZSTD=' + zstd.full_path()], env: ['ZSTD=' + zstd.full_path()],
depends: [datagen], depends: [datagen],
timeout: 600) # Timeout should work on HDD drive workdir: meson.current_build_dir(),
timeout: 2800) # Timeout should work on HDD drive
endif endif
test('test-fullbench-1', test('test-fullbench-1',
@ -195,7 +198,7 @@ if use_zlib
test('test-fuzzer', test('test-fuzzer',
fuzzer, fuzzer,
args: ['-v', FUZZERTEST] + FUZZER_FLAGS, args: ['-v', FUZZERTEST] + FUZZER_FLAGS,
timeout: 240) timeout: 480)
endif endif
test('test-zbuff', test('test-zbuff',
@ -205,7 +208,7 @@ test('test-zbuff',
test('test-zstream-1', test('test-zstream-1',
zstreamtest, zstreamtest,
args: ['-v', ZSTREAM_TESTTIME] + FUZZER_FLAGS, args: ['-v', ZSTREAM_TESTTIME] + FUZZER_FLAGS,
timeout: 120) timeout: 240)
test('test-zstream-2', test('test-zstream-2',
zstreamtest, zstreamtest,
args: ['-mt', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, args: ['-mt', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS,
@ -217,7 +220,9 @@ test('test-zstream-3',
test('test-longmatch', longmatch, timeout: 36) test('test-longmatch', longmatch, timeout: 36)
test('test-invalidDictionaries', invalidDictionaries) # should be fast test('test-invalidDictionaries', invalidDictionaries) # should be fast
test('test-symbols', symbols) # should be fast test('test-symbols', symbols) # should be fast
test('test-legacy', legacy) # should be fast if 0 < legacy_level and legacy_level <= 4
test('test-legacy', legacy) # should be fast
endif
test('test-decodecorpus', test('test-decodecorpus',
decodecorpus, decodecorpus,
args: ['-t', DECODECORPUS_TESTTIME], args: ['-t', DECODECORPUS_TESTTIME],

File diff suppressed because it is too large Load Diff