From 2d0ee36913a5e0f6c74beb5cdb9f25ea36ea9290 Mon Sep 17 00:00:00 2001 From: Jan Dabros Date: Mon, 20 Apr 2020 15:19:45 +0200 Subject: tests: Add lib/string-test test case Show a basic example of how unit testing can be applied for the coreboot project. Add a test harness for lib/string.c module. TEST=Install cmocka via appropriate command: sudo apt-get install -y libcmocka-dev sudo emerge dev-util/cmocka yum install libcmocka-devel * Build and run unit tests via `make unit-tests` * Check the output to see that tests passed. Signed-off-by: Jan Dabros Change-Id: Ibf5554d1e99a393721a66bdd35af0122c2e412c4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40538 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Paul Fagerburg --- tests/lib/Makefile.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/lib/Makefile.inc (limited to 'tests/lib/Makefile.inc') diff --git a/tests/lib/Makefile.inc b/tests/lib/Makefile.inc new file mode 100644 index 0000000000..86ac323ab8 --- /dev/null +++ b/tests/lib/Makefile.inc @@ -0,0 +1,20 @@ +## +## This file is part of the coreboot project. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; version 2 of the License. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## + +# object filest should be under build/tests/ build/test/src/ build/test/run/ +# two examples - first should be simply string.c, second should use -wrap + +tests-y += string-test + +string-test-srcs += tests/lib/string-test.c +string-test-srcs += src/lib/string.c -- cgit v1.2.3