aboutsummaryrefslogtreecommitdiff
path: root/contrib/meson/meson/tests/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/meson/meson/tests/meson.build')
-rw-r--r--contrib/meson/meson/tests/meson.build129
1 files changed, 44 insertions, 85 deletions
diff --git a/contrib/meson/meson/tests/meson.build b/contrib/meson/meson/tests/meson.build
index 78004758..18479e4b 100644
--- a/contrib/meson/meson/tests/meson.build
+++ b/contrib/meson/meson/tests/meson.build
@@ -1,5 +1,6 @@
# #############################################################################
-# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
+# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
+# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io>
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
@@ -7,87 +8,45 @@
# in the COPYING file in the root directory of this source tree).
# #############################################################################
-lz4_root_dir = '../../../..'
-programs_dir_inc = include_directories(join_paths(lz4_root_dir, 'programs'))
-lib_dir_inc = include_directories(join_paths(lz4_root_dir, 'lib'))
-
-# =============================================================================
-# Test flags
-# =============================================================================
-
-TEST_FILES = join_paths(meson.current_source_dir(), lz4_root_dir, 'tests/COPYING')
-FUZZER_TIME = '-T90s'
-NB_LOOPS = '-i1'
-
-# =============================================================================
-# Executables
-# =============================================================================
-
-fullbench_sources = [join_paths(lz4_root_dir, 'tests/fullbench.c')]
-fullbench = executable('fullbench',
- fullbench_sources,
- include_directories: programs_dir_inc,
- dependencies: liblz4_dep,
- install: false)
-
-fuzzer_sources = [join_paths(lz4_root_dir, 'tests/fuzzer.c')]
-fuzzer = executable('fuzzer',
- fuzzer_sources,
- c_args: ['-D_DEFAULT_SOURCE', '-D_BSD_SOURCE'], # since glibc 2.19
- include_directories: programs_dir_inc,
- dependencies: liblz4_dep,
- install: false)
-
-frametest_sources = [join_paths(lz4_root_dir, 'tests/frametest.c')]
-frametest = executable('frametest',
- frametest_sources,
- include_directories: programs_dir_inc,
- dependencies: liblz4_dep,
- install: false)
-
-roundTripTest_sources = [join_paths(lz4_root_dir, 'tests/roundTripTest.c')]
-roundTripTest = executable('roundTripTest',
- roundTripTest_sources,
- dependencies: [ liblz4_dep ],
- install: false)
-
-datagen_sources = [join_paths(lz4_root_dir, 'tests/datagencli.c')]
-datagen = executable('datagen',
- datagen_sources,
- objects: lz4.extract_objects(join_paths(lz4_root_dir, 'programs/datagen.c')),
- include_directories: lz4_includes,
- dependencies: [ liblz4_dep ],
- install: false)
-
-checkFrame_sources = [join_paths(lz4_root_dir, 'tests/checkFrame.c')]
-checkFrame = executable('checkFrame',
- checkFrame_sources,
- include_directories: programs_dir_inc,
- dependencies: [ liblz4_dep ],
- install: false)
-
-checkTag_sources = [join_paths(lz4_root_dir, 'tests/checkTag.c')]
-checkTag = executable('checkTag',
- checkTag_sources,
- include_directories: lib_dir_inc,
- install: false)
-
-# =============================================================================
-# Tests (Use "meson test --list" to list all tests)
-# =============================================================================
-
-# XXX: (Need TEST) These timeouts (in seconds) when running on a HDD should be
-# at least six times bigger than on a SSD
-
-test('test-fullbench',
- fullbench,
- args: ['--no-prompt', NB_LOOPS, TEST_FILES],
- timeout: 420) # Should enough when running on HDD
-test('test-fuzzer',
- fuzzer,
- args: [FUZZER_TIME],
- timeout: 100)
-test('test-frametest',
- frametest,
- args: [FUZZER_TIME],
- timeout: 100)
+lz4_source_root = '../../../..'
+
+exes = {
+ 'fullbench': {
+ 'sources': files(lz4_source_root / 'tests/fullbench.c'),
+ 'include_directories': include_directories(lz4_source_root / 'programs'),
+ },
+ 'fuzzer': {
+ 'sources': files(lz4_source_root / 'tests/fuzzer.c'),
+ 'include_directories': include_directories(lz4_source_root / 'programs'),
+ },
+ 'frametest': {
+ 'sources': files(lz4_source_root / 'tests/frametest.c'),
+ 'include_directories': include_directories(lz4_source_root / 'programs'),
+ },
+ 'roundTripTest': {
+ 'sources': files(lz4_source_root / 'tests/roundTripTest.c'),
+ },
+ 'datagen': {
+ 'sources': files(lz4_source_root / 'tests/datagencli.c'),
+ 'objects': lz4.extract_objects(lz4_source_root / 'programs/datagen.c'),
+ 'include_directories': include_directories(lz4_source_root / 'programs'),
+ },
+ 'checkFrame': {
+ 'sources': files(lz4_source_root / 'tests/checkFrame.c'),
+ 'include_directories': include_directories(lz4_source_root / 'programs'),
+ },
+ 'checkTag': {
+ 'sources': files(lz4_source_root / 'tests/checkTag.c'),
+ },
+}
+
+foreach e, attrs : exes
+ executable(
+ e,
+ attrs.get('sources'),
+ objects: attrs.get('objects', []),
+ dependencies: [liblz4_internal_dep],
+ include_directories: attrs.get('include_directories', []),
+ install: false
+ )
+endforeach