summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-04-16 17:41:52 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-04-16 17:50:37 +0200
commit4b315cd9a63e78737d3d856b3bb7ca340b8dec41 (patch)
treee4ad5dac68672b143a00b9634ba7affbe3efcc21
parent9ea54375c3ed1ba1c4ec8f6ddf80615fcb7fb073 (diff)
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 <david.oberhollenzer@sigma-star.at>
-rw-r--r--tests/unittests/Makemodule.am4
1 files 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 \