2018-11-27 10:04:41 -08:00
|
|
|
# #############################################################################
|
|
|
|
# Copyright (c) 2018-present Dima Krasner <dima@dimakrasner.com>
|
|
|
|
# lzutao <taolzu(at)gmail.com>
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under both the BSD-style license (found in the
|
|
|
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
# in the COPYING file in the root directory of this source tree).
|
|
|
|
# #############################################################################
|
|
|
|
|
2018-11-30 02:23:23 -08:00
|
|
|
zstd_rootdir = '../../..'
|
2018-11-27 10:04:41 -08:00
|
|
|
|
2018-11-30 02:23:23 -08:00
|
|
|
tests_supported_oses = [os_linux, 'gnu/kfreebsd', os_darwin, 'gnu', 'openbsd',
|
|
|
|
os_freebsd, 'netbsd', 'dragonfly', os_sun]
|
2018-11-27 10:04:41 -08:00
|
|
|
|
2018-11-30 02:23:23 -08:00
|
|
|
# =============================================================================
|
|
|
|
# Test flags
|
|
|
|
# =============================================================================
|
2018-11-27 10:04:41 -08:00
|
|
|
|
2018-11-30 02:23:23 -08:00
|
|
|
FUZZER_FLAGS = ['--no-big-tests']
|
|
|
|
FUZZERTEST = '-T200s'
|
|
|
|
ZSTREAM_TESTTIME = '-T90s'
|
|
|
|
DECODECORPUS_TESTTIME = '-T30'
|
|
|
|
ZSTDRTTEST = ['--test-large-data']
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# Executables
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ]
|
|
|
|
|
|
|
|
datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/datagencli.c')]
|
2018-11-27 10:04:41 -08:00
|
|
|
datagen = executable('datagen',
|
2018-11-30 02:23:23 -08:00
|
|
|
datagen_sources,
|
|
|
|
c_args: [ '-DNDEBUG' ],
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: libzstd_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
fullbench_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/benchfn.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/benchzstd.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/fullbench.c')]
|
2018-11-27 10:04:41 -08:00
|
|
|
fullbench = executable('fullbench',
|
2018-11-30 02:23:23 -08:00
|
|
|
fullbench_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: libzstd_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
fuzzer_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/fuzzer.c')]
|
2018-11-27 10:04:41 -08:00
|
|
|
fuzzer = executable('fuzzer',
|
2018-11-30 02:23:23 -08:00
|
|
|
fuzzer_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: libzstd_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
zbufftest_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/zbufftest.c')]
|
|
|
|
zbufftest = executable('zbufftest',
|
|
|
|
zbufftest_sources,
|
|
|
|
c_args: ['-Wno-deprecated-declarations'],
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: libzstd_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
zstreamtest_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/seqgen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/zstreamtest.c')]
|
|
|
|
zstreamtest = executable('zstreamtest',
|
|
|
|
zstreamtest_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: libzstd_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
paramgrill_sources = [join_paths(zstd_rootdir, 'programs/benchfn.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/benchzstd.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/datagen.c'),
|
|
|
|
join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/paramgrill.c')]
|
|
|
|
paramgrill = executable('paramgrill',
|
|
|
|
paramgrill_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: [ libzstd_dep, libm_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')]
|
|
|
|
roundTripCrash = executable('roundTripCrash',
|
|
|
|
roundTripCrash_sources,
|
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')]
|
|
|
|
longmatch = executable('longmatch',
|
|
|
|
longmatch_sources,
|
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
invalidDictionaries_sources = [join_paths(zstd_rootdir, 'tests/invalidDictionaries.c')]
|
|
|
|
invalidDictionaries = executable('invalidDictionaries',
|
|
|
|
invalidDictionaries_sources,
|
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
legacy_sources = [join_paths(zstd_rootdir, 'tests/legacy.c')]
|
|
|
|
legacy = executable('legacy',
|
|
|
|
legacy_sources,
|
2018-12-02 09:36:40 -08:00
|
|
|
# Use -Dlegacy_level build option to control it
|
|
|
|
#c_args: '-DZSTD_LEGACY_SUPPORT=4',
|
2018-11-30 02:23:23 -08:00
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/decodecorpus.c')]
|
|
|
|
decodecorpus = executable('decodecorpus',
|
|
|
|
decodecorpus_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
dependencies: [ libzstd_dep, libm_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
symbols_sources = [join_paths(zstd_rootdir, 'tests/symbols.c')]
|
|
|
|
symbols = executable('symbols',
|
|
|
|
symbols_sources,
|
|
|
|
include_directories: test_includes,
|
|
|
|
c_args: host_machine_os == os_windows ? '-DZSTD_DLL_IMPORT=1' : [],
|
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'),
|
|
|
|
join_paths(zstd_rootdir, 'tests/poolTests.c'),
|
|
|
|
join_paths(zstd_rootdir, 'lib/common/pool.c'),
|
|
|
|
join_paths(zstd_rootdir, 'lib/common/threading.c'),
|
|
|
|
join_paths(zstd_rootdir, 'lib/common/zstd_common.c'),
|
|
|
|
join_paths(zstd_rootdir, 'lib/common/error_private.c')]
|
|
|
|
poolTests = executable('poolTests',
|
|
|
|
poolTests_sources,
|
|
|
|
include_directories: test_includes,
|
2018-11-30 06:05:03 -08:00
|
|
|
dependencies: [ libzstd_dep, thread_dep ],
|
2018-11-30 02:23:23 -08:00
|
|
|
install: false)
|
|
|
|
|
|
|
|
checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')]
|
|
|
|
checkTag = executable('checkTag',
|
|
|
|
checkTag_sources,
|
|
|
|
dependencies: [ libzstd_dep ],
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
# =============================================================================
|
|
|
|
# Tests (Use "meson test --list" to list all tests)
|
|
|
|
# =============================================================================
|
|
|
|
|
|
|
|
if tests_supported_oses.contains(host_machine_os)
|
|
|
|
valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true)
|
|
|
|
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
|
2018-11-27 10:04:41 -08:00
|
|
|
endif
|
2018-11-30 02:23:23 -08:00
|
|
|
|
|
|
|
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=' + zstd.full_path()],
|
|
|
|
depends: [datagen],
|
|
|
|
timeout: 600) # Timeout should work on HDD drive
|
|
|
|
endif
|
|
|
|
|
|
|
|
test('test-fullbench-1', fullbench, args: ['-i1'],
|
|
|
|
depends: [fullbench, datagen])
|
|
|
|
test('test-fullbench-2', fullbench, args: ['-i1', '-P0'],
|
|
|
|
depends: [fullbench, datagen])
|
|
|
|
|
2018-11-30 06:05:03 -08:00
|
|
|
if use_zlib
|
2018-11-30 02:23:23 -08:00
|
|
|
test('test-fuzzer', fuzzer, args: ['-v', FUZZERTEST] + FUZZER_FLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
test('test-zbuff', zbufftest, args: [ZSTREAM_TESTTIME])
|
|
|
|
test('test-zstream-1', zstreamtest, args: ['-v', ZSTREAM_TESTTIME] + FUZZER_FLAGS)
|
|
|
|
test('test-zstream-2', zstreamtest, args: ['-mt', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS)
|
|
|
|
test('test-zstream-3', zstreamtest, args: ['--newapi', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS)
|
|
|
|
test('test-longmatch', longmatch)
|
|
|
|
test('test-invalidDictionaries', invalidDictionaries)
|
|
|
|
test('test-symbols', symbols)
|
|
|
|
test('test-legacy', legacy)
|
|
|
|
test('test-decodecorpus', decodecorpus, args: ['-t', DECODECORPUS_TESTTIME])
|
|
|
|
test('test-poolTests', poolTests)
|