Skip to contentSkip to conversation

Allow tests to work on more platforms

PATCH New Olliver Schinagl 2 participants 5 messages Apr 15, 2019 – Apr 25, 2019 Memory technology devices (MTD)

lore
Share & tools
lore
#1 lore raw

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
index 7a6a003..cd94d9f 100644
@@ -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/
#2 lore raw

PATCH 2/3 unittests/libmtd_test: Include fcntl header

In reply to Olliver Schinagl

The 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
index 633d94a..176d2ef 100644
@@ -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/
#3 lore raw

PATCH 3/3 unittests: Define the use of _GNU_SOURCE

In reply to Olliver Schinagl

The 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
index b7ae575..df1041d 100644
@@ -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/