diff options
author | Dima Krasner <dima@dimakrasner.com> | 2019-08-22 10:19:25 +0300 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-08-22 11:41:49 +0200 |
commit | 33d48bfaa7579072b25bb520ca4dd592e3765c24 (patch) | |
tree | 05a5003b4470deedb001c325e95639116153fd1f | |
parent | aed0d9dd55b1d9fb68c0e37addc2898ed838a58b (diff) | |
download | cmocka-33d48bfaa7579072b25bb520ca4dd592e3765c24.tar.gz cmocka-33d48bfaa7579072b25bb520ca4dd592e3765c24.tar.xz cmocka-33d48bfaa7579072b25bb520ca4dd592e3765c24.zip |
meson: Build and run unit tests
-rw-r--r-- | meson.build | 4 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rw-r--r-- | tests/meson.build | 30 |
3 files changed, 35 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 04c5685..28fdc08 100644 --- a/meson.build +++ b/meson.build @@ -41,3 +41,7 @@ pkgconfig.generate(libraries : [libcmocka], name : 'cmocka', filebase : 'cmocka', description : 'The cmocka unit testing library') + +if get_option('unit_testing') + subdir('tests') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..0477fb5 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('unit_testing', type: 'boolean', value: false) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..b49066b --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,30 @@ +tests = { + 'alloc': false, + 'group_setup_assert': true, + 'group_setup_fail': true, + 'fixtures': false, + 'group_fixtures': false, + 'groups': false, + 'float_macros': false, + 'assert_macros': false, + 'assert_macros_fail': true, + 'basics': false, + 'skip': false, + 'strmatch': false, + 'setup_fail': true, + 'ordering': false, + 'ordering_fail': true, + 'returns': false, + 'returns_fail': true, + 'wildcard': false, + 'skip_filter': false, + 'cmockery': false +} + +foreach name, should_fail: tests + exe = executable(name, + 'test_@0@.c'.format(name), + include_directories: [cmocka_includes], + link_with: [libcmocka]) + test(name, exe, should_fail: should_fail) +endforeach |