From 4b315cd9a63e78737d3d856b3bb7ca340b8dec41 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 16 Apr 2018 17:41:52 +0200 Subject: Fix unit-test header and file paths for out of tree builds If we build mtd-utils outside the source path, we cannot use relative paths to refere to headers in the source tree. We have to specify absoulte paths using the top_srcdir variable. This was done right for the utility binaries, but overlooked for the unit test porgrams. This patch fixes the header paths and SYSROOT variable for the unit tests, so they build and run propperly outside the source tree. Signed-off-by: David Oberhollenzer --- tests/unittests/Makemodule.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unittests/Makemodule.am b/tests/unittests/Makemodule.am index e2fa989..b7ae575 100644 --- a/tests/unittests/Makemodule.am +++ b/tests/unittests/Makemodule.am @@ -1,12 +1,12 @@ ubilib_test_SOURCES = tests/unittests/libubi_test.c lib/libubi.c ubilib_test_LDADD = $(CMOCKA_LIBS) ubilib_test_LDFLAGS = -Wl,--wrap=open -Wl,--wrap=close -Wl,--wrap=ioctl -Wl,--wrap=read -Wl,--wrap=lseek -ubilib_test_CPPFLAGS = -O0 --std=gnu99 $(CMOCKA_CFLAGS) -I include -DSYSFS_ROOT='"tests/unittests/sysfs_mock"' +ubilib_test_CPPFLAGS = -O0 --std=gnu99 $(CMOCKA_CFLAGS) -I$(top_srcdir)/include -DSYSFS_ROOT='"$(top_srcdir)/tests/unittests/sysfs_mock"' mtdlib_test_SOURCES = tests/unittests/libmtd_test.c lib/libmtd.c lib/libmtd_legacy.c mtdlib_test_LDADD = $(CMOCKA_LIBS) mtdlib_test_LDFLAGS = -Wl,--wrap=open -Wl,--wrap=close -Wl,--wrap=ioctl -Wl,--wrap=read -Wl,--wrap=lseek -Wl,--wrap=write -mtdlib_test_CPPFLAGS = -O0 --std=gnu99 $(CMOCKA_CFLAGS) -I lib/ -I include -DSYSFS_ROOT='"tests/unittests/sysfs_mock"' +mtdlib_test_CPPFLAGS = -O0 --std=gnu99 $(CMOCKA_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/include -DSYSFS_ROOT='"$(top_srcdir)/tests/unittests/sysfs_mock"' TEST_BINS = \ ubilib_test \ -- cgit v1.2.3