Skip to content
Permalink
Browse files

meson: change file hierarchy.

Most notably, we moved "test samples" under test/ since they were more tests
than samples. At the same time, we now provide individual meson.build
files to subdirs under test/, which has the property of eliminating the
warnings meson was outputing about executable names with path components.
  • Loading branch information
Snaipe committed Dec 30, 2019
1 parent dcae7cd commit 928bf7ab34ded32cab7b949d319e39a4790a573c
@@ -13,14 +13,6 @@ samples = [
'suites.c',
'theories.c',
'timeout.c',

'tests/exit.c',
'tests/failmessages.c',
'tests/flood.c',
'tests/long-messages.c',
'tests/other-crashes.c',
'tests/theories_regression.c',
'tests/with-time.c',
]

if has_cxx
@@ -38,13 +30,6 @@ if has_cxx
'skip.cc',
'suites.cc',
'theories.cc',

'tests/exception.cc',
'tests/exit.cc',
'tests/failmessages.cc',
'tests/long-messages.cc',
'tests/other-crashes.cc',
'tests/theories_regression.cc',
]
endif

@@ -53,5 +38,5 @@ foreach sample : samples
include_directories: [criterion_api],
dependencies: [libm],
link_with: libcriterion.get_shared_lib())
test(sample, e, args: '--always-succeed')
test('sample / ' + sample, e, args: '--always-succeed')
endforeach
@@ -0,0 +1,24 @@
sh = find_program('sh', required: false)
cram = find_program('cram', required: false)
if sh.found() and cram.found()
env = environment()
env.prepend('PATH',
join_paths(meson.current_build_dir(), '..', '..', 'samples'),
join_paths(meson.current_build_dir(), '..', 'full'))
env.set('CRITERION_ALWAYS_SUCCEED', '1')
env.set('CRITERION_DISABLE_TIME_MEASUREMENTS', '1')
env.set('CRITERION_JOBS', '1')
env.set('CRITERION_SHORT_FILENAME', '1')
env.set('LC_ALL', 'en_US.utf8')
env.set('MSYS2_ARG_CONV_EXCL', '--filter=')
env.set('TERM', 'dumb')
if has_cxx
env.set('CXX_SUPPORT', '1')
endif

test('cram tests', cram,
timeout: 120,
args: [meson.current_source_dir()],
env: env)
endif

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,28 @@
full_tests = [
'exit.c',
'failmessages.c',
'flood.c',
'long-messages.c',
'other-crashes.c',
'theories_regression.c',
'with-time.c',
]

if has_cxx
full_tests += [
'exception.cc',
'exit.cc',
'failmessages.cc',
'long-messages.cc',
'other-crashes.cc',
'theories_regression.cc',
]
endif

foreach tst : full_tests
e = executable(tst + '.bin', tst,
include_directories: [criterion_api],
dependencies: [libm],
link_with: libcriterion.get_shared_lib())
test('full / ' + tst, e, args: '--always-succeed')
endforeach
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,34 +1,3 @@
unit_test_sources = files(
'asprintf.c',
'ordered-set.c',
'path.c',
)

unit_tests = executable('unit_tests', unit_test_sources,
include_directories: [criterion_includedir],
link_with: libcriterion.get_static_lib())
test('unit tests', unit_tests)

sh = find_program('sh', required: false)
cram = find_program('cram', required: false)
if sh.found() and cram.found()
env = environment()
env.prepend('PATH',
join_paths(meson.build_root(), 'samples'),
join_paths(meson.build_root(), 'samples', 'tests'))
env.set('CRITERION_ALWAYS_SUCCEED', '1')
env.set('CRITERION_DISABLE_TIME_MEASUREMENTS', '1')
env.set('CRITERION_JOBS', '1')
env.set('CRITERION_SHORT_FILENAME', '1')
env.set('LC_ALL', 'en_US.utf8')
env.set('MSYS2_ARG_CONV_EXCL', '--filter=')
env.set('TERM', 'dumb')
if has_cxx
env.set('CXX_SUPPORT', '1')
endif

test('cram tests', cram,
timeout: 120,
args: [join_paths(meson.current_source_dir(), 'cram')],
env: env)
endif
subdir('unit')
subdir('full')
subdir('cram')
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,17 @@
unit_test_sources = files(
'asprintf.c',
'ordered-set.c',
'path.c',
)

#if has_cxx
# unit_test_sources += files(
# 'alloc.cc',
# 'redirect.cc',
# )
#endif

unit_tests = executable('unit_tests', unit_test_sources,
include_directories: [criterion_includedir],
link_with: libcriterion.get_static_lib())
test('unit tests', unit_tests)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 928bf7a

Please sign in to comment.
You can’t perform that action at this time.