Allow tests to work on more platforms
Trying to make tests work on Alpine Linux (busybox + musl based) I ran into a very small omissions. This series contains a few micropatches which fixes these omissions.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 1/3 unittests/test_lib: Include proper header for _IOC_SIZE
The macro _IOC_SIZE is not part of sys/ioctl.h but lives in asm/ioctl.h so we should include the proper header. If we do not, some systems complain during linking that they cannot find the symbol _IOC_SIZE() which was not expanded by the pre-compiler.
--- tests/unittests/test_lib.h | 1 + 1 file changed, 1 insertion(+)
tests/unittests/test_lib.h +1 -0
@@ -1,3 +1,4 @@ +#include <asm/ioctl.h> #include <stdarg.h> #include <setjmp.h> #include <stddef.h>
Signature · 6 lines
2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 2/3 unittests/libmtd_test: Include fcntl header
In reply to Olliver SchinaglThe test library for the mtd unit tests include various type's and macro's that officially live in fcntl. Each file and header should always properly include what they use, so lets add the fcntl headers.
--- tests/unittests/libmtd_test.c | 1 + 1 file changed, 1 insertion(+)
tests/unittests/libmtd_test.c +1 -0
@@ -1,3 +1,4 @@ +#include <fcntl.h> #include <stdarg.h> #include <setjmp.h> #include <stddef.h>
Signature · 6 lines
2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 3/3 unittests: Define the use of _GNU_SOURCE
In reply to Olliver SchinaglThe unittest suite actually makes use of some _GNU extensions during the build (loff_t for example). So lets enable this in the makefile.
--- tests/unittests/Makemodule.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/unittests/Makemodule.am +1 -1
@@ -6,7 +6,7 @@ ubilib_test_CPPFLAGS = -O0 --std=gnu99 $(CMOCKA_CFLAGS) -I$(top_srcdir)/include 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$(top_srcdir)/lib/ -I$(top_srcdir)/include -DSYSFS_ROOT='"$(top_srcdir)/tests/unittests/sysfs_mock"' +mtdlib_test_CPPFLAGS = -O0 -D_GNU_SOURCE --std=gnu99 $(CMOCKA_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/include -DSYSFS_ROOT='"$(top_srcdir)/tests/unittests/sysfs_mock"' TEST_BINS = \ ubilib_test \
Signature · 6 lines
2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
David Oberhollenzer
AppliedApplied to mtd-utils.git master.
Thanks,
David
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/