that we don't break builds.
---
testcases/kernel/syscalls/inotify/Makefile | 7 +++++++
testcases/kernel/syscalls/inotify/inotify01.c | 9 +++++++--
testcases/kernel/syscalls/inotify/inotify02.c | 9 +++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/inotify/Makefile
b/testcases/kernel/syscalls/inotify/Makefile
index 73eb227..3ed0fa9 100644
--- a/testcases/kernel/syscalls/inotify/Makefile
+++ b/testcases/kernel/syscalls/inotify/Makefile
@@ -21,6 +21,13 @@ LDLIBS += -L../../../../lib -lltp
SRCS = $(wildcard *.c)
TARGETS = $(patsubst %.c,%,$(SRCS))
+check_header = $(shell \
+ if echo "\#include <$(1)>" | $(CC) -E - > /dev/null; \
+ then echo -DHAS_SYS_INOTIFY ; \
+ fi)
+
+HAS_SYS_INOTIFY := $(call check_header,sys/inotify.h)
+CFLAGS += $(HAS_SYS_INOTIFY)
all: $(TARGETS)
diff --git a/testcases/kernel/syscalls/inotify/inotify01.c
b/testcases/kernel/syscalls/inotify/inotify01.c
index a1502f1..055e993 100644
--- a/testcases/kernel/syscalls/inotify/inotify01.c
+++ b/testcases/kernel/syscalls/inotify/inotify01.c
@@ -49,7 +49,7 @@
#include "test.h"
#include "usctest.h"
-#ifdef __NR_inotify_init
+#if defined(HAS_SYS_INOTIFY) && defined(__NR_inotify_init)
#include <sys/inotify.h>
#define EVENT_MAX 1024
@@ -327,9 +327,14 @@ int TST_TOTAL = 0; /* Total number of test
cases. */
int
main()
{
+#ifndef __NR_inotify_init
tst_resm(TWARN, "This test needs a kernel that has inotify syscall.");
tst_resm(TWARN, "Inotify syscall can be found at kernel 2.6.13 or
higher.");
- exit(0);
+#endif
+#ifndef HAS_SYS_INOTIFY:
+ tst_resm(TBROK, "can't find header sys/inotify.h");
+ return 1;
+#endif
return 0;
}
diff --git a/testcases/kernel/syscalls/inotify/inotify02.c
b/testcases/kernel/syscalls/inotify/inotify02.c
index d7dc83f..b879b62 100644
--- a/testcases/kernel/syscalls/inotify/inotify02.c
+++ b/testcases/kernel/syscalls/inotify/inotify02.c
@@ -52,7 +52,7 @@
#include "test.h"
#include "usctest.h"
-#ifdef __NR_inotify_init
+#if defined(__NR_inotify_init) && defined(HAS_SYS_INOTIFY)
#include <sys/inotify.h>
#ifndef IN_MOVE_SELF
@@ -368,9 +368,14 @@ int TST_TOTAL = 0; /* Total number of test
cases. */
int
main()
{
+#ifndef __NR_inotify_init
tst_resm(TWARN, "This test needs a kernel that has inotify syscall.");
tst_resm(TWARN, "Inotify syscall can be found at kernel 2.6.13 or
higher.");
- exit(0);
+#endif
+#ifndef HAS_SYS_INOTIFY:
+ tst_resm(TBROK, "can't find header sys/inotify.h");
+ return 1;
+#endif
return 0;
}
--
1.5.6.4
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list