Skip to contentSkip to conversation

selftests: fix compile error for sync

PATCH In review Lei Yang 2 participants 4 messages Nov 5, 2017 – Nov 7, 2017 Kselftest

lore
Share & tools
lore

Lei Yang

author
#0 lore raw

PATCH 1/1 selftests: fix compile error for sync

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync' gcc -c sync.c -o tools/testing/selftests/sync/sync.o sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
#include <linux/sync_file.h>

obviously, CFLAGS and LDFLAGS are not used when comipling.

---
 tools/testing/selftests/sync/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/sync/Makefile +2 -2
index 8e04d0a..46cbcc3 100644
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
 	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
 
 $(OBJS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 $(TESTS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 21 lines · Lei Yang

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync' gcc -c sync.c -o tools/testing/selftests/sync/sync.o sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
#include <linux/sync_file.h>

obviously, CFLAGS and LDFLAGS are not used when comipling.

---
 tools/testing/selftests/sync/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/sync/Makefile +0 -0
index 8e04d0a..46cbcc3 100644
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
 	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)

tools/testing/selftests/sync/Makefile $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS) · line 37

Quoted 10 lines
tools/testing/selftests/sync/Makefile +2 -2
 
 $(OBJS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 $(TESTS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)

How are you building the test? I am not seeing the error on linux-4.14.0-rc8

thanks,
-- Shuah

author
#2 lore raw
Quoted 26 lines · Shuah Khan
Quoted 25 lines · Lei Yang

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync' gcc -c sync.c -o tools/testing/selftests/sync/sync.o sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
#include <linux/sync_file.h>

obviously, CFLAGS and LDFLAGS are not used when comipling.

---
  tools/testing/selftests/sync/Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/sync/Makefile +1 -1
index 8e04d0a..46cbcc3 100644
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
  	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
 
  $(OBJS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
Quoted 7 lines

tools/testing/selftests/sync/Makefile $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS) · line 37

Quoted 6 lines
tools/testing/selftests/sync/Makefile +1 -1
  $(TESTS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
  EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)

How are you building the test? I am not seeing the error on linux-4.14.0-rc8

make -C tools/testing/selftests

Lei

Quoted 6 lines

thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 34 lines · lei yang
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Lei Yang

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync' gcc -c sync.c -o tools/testing/selftests/sync/sync.o sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory #include <linux/sync_file.h>

obviously, CFLAGS and LDFLAGS are not used when comipling.

Signed-off-by Lei Yang <Lei.Yang at windriver.com>

---
  tools/testing/selftests/sync/Makefile | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 6 lines
tools/testing/selftests/sync/Makefile +0 -0
index 8e04d0a..46cbcc3 100644
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
       $(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
Quoted 8 lines

    $(OBJS): $(OUTPUT)/%.o: %.c
-    $(CC) -c $^ -o $@
+    $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS) $(TESTS): $(OUTPUT)/%.o: %.c
-    $(CC) -c $^ -o $@
+    $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS) EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)

How are you building the test? I am not seeing the error on linux-4.14.0-rc8

Quoted 5 lines

make -C tools/testing/selftests

Lei

Based on the information in your other emails, looks like you are testing these patches on

$ cat /proc/version
Linux version 3.16.0-30-generic (buildd at kissel) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015

That explains why you aren't finding sync_file.h header. This test isn't applicable to Linux 3.16. In any case, I can't take patches that aren't tested on the latest kernel release. 3.16 is very old.

thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html