From 46f2d4e488db66b37e892b8fa621eeed0fe2f284 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Wed, 20 May 2020 20:10:20 +1000 Subject: tests/: Add CMocka unit-test infrastructure This adds the CMocka unit-testing infrastructure into the meson build system which we will latter follow up with unit-tests for flashrom's core logic. BUG=b:157280555 BRANCH=none TEST=builds Change-Id: I66665f56627b3d99049176bfbebbd771b080370a Signed-off-by: Edward O'Callaghan Reviewed-on: https://review.coreboot.org/c/flashrom/+/41622 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- tests/meson.build | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/meson.build (limited to 'tests/meson.build') diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..0c21cb9c --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,28 @@ +root_includes = include_directories('../subprojects') + +srcs = [ + 'tests.c', +] + +mocks = [ + '-Wl,--wrap=physunmap', + '-Wl,--wrap=physmap', + '-Wl,--gc-sections', +] + +flashrom_tests = executable('flashrom_unit_tests', + srcs, + include_directories : root_includes, + c_args : [ + cargs, + '-ffunction-sections', + '-fdata-sections', + # '-DSTANDALONE', + '-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_DUMMY', + '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""', + ], + export_dynamic : true, + link_args : mocks, + dependencies : [cmocka_dep, flashrom_test_dep], +) +test('cmocka test flashrom', flashrom_tests) -- cgit v1.2.3