Skip to contentSkip to conversation

selftests: fix compiling issues

PATCH Superseded [email protected] 3 participants 14 messages Mar 26, 2018 – Mar 27, 2018

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover selftests: fix compiling issues

From: Changbin Du <changbin.du at intel.com>

These 4 patches fixed all the existing compiling errors. With this serias, no compiling error reported after running 'make kselftest'.

Changbin Du (4):
selftests/Makefile: append a slash to env variable OUTPUT selftests/gpio: fix paths in Makefile
kselftest: install sanitized kernel headers before compiling selftests/bpf: fix compiling errors

 tools/testing/selftests/.gitignore      |  4 ----
 tools/testing/selftests/Makefile        | 21 ++++++++++++---------
 tools/testing/selftests/bpf/Makefile    |  5 +++--
 tools/testing/selftests/gpio/.gitignore |  4 ++++
 tools/testing/selftests/gpio/Makefile   | 14 +++++++-------
 5 files changed, 26 insertions(+), 22 deletions(-)
Signature · 6 lines
2.7.4

--
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
#1 lore raw

PATCH 1/4 selftests/Makefile: append a slash to env variable OUTPUT

From: Changbin Du <[email protected]>

The tools/build/Makefile.build use 'OUTPUT' variable as below example:
objprefix := $(subst ./,,$(OUTPUT)$(dir)/)

So it requires the 'OUTPUT' already has a slash at the end.

This patch can kill below odd paths:
make[3]: Entering directory '/home/changbin/work/linux/tools/gpio'

  CC       /home/changbin/work/linux/tools/testing/selftests/gpiolsgpio.o
  CC       /home/changbin/work/linux/tools/testing/selftests/gpiogpio-utils.o
  LD       /home/changbin/work/linux/tools/testing/selftests/gpiolsgpio-in.o

A correct path should be:
/home/changbin/work/linux/tools/testing/selftests/gpio/lsgpio.o

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/Makefile +8 -8
index 7442dfb..7916aa2 100644
@@ -71,31 +71,31 @@ all:
 	@for TARGET in $(TARGETS); do		\
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		mkdir $$BUILD_TARGET  -p;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET;\
 	done;
 
 run_tests: all
 	@for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET run_tests;\
 	done;
 
 hotplug:
 	@for TARGET in $(TARGETS_HOTPLUG); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET;\
 	done;
 
 run_hotplug: hotplug
 	@for TARGET in $(TARGETS_HOTPLUG); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET run_full_test;\
 	done;
 
 clean_hotplug:
 	@for TARGET in $(TARGETS_HOTPLUG); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET clean;\
 	done;
 
 run_pstore_crash:
@@ -111,7 +111,7 @@ ifdef INSTALL_PATH
 	mkdir -p $(INSTALL_PATH)
 	@for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
 	done;
 
 	@# Ask all targets to emit their test scripts
@@ -131,7 +131,7 @@ ifdef INSTALL_PATH
 		echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
 		echo "echo ========================================" >> $(ALL_SCRIPT); \
 		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
-		make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
+		make -s --no-print-directory OUTPUT=$$BUILD_TARGET/ -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
 		echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
 	done;
 
@@ -143,7 +143,7 @@ endif
 clean:
 	@for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
+		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET clean;\
 	done;
 
 .PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean
Signature · 6 lines
2.7.4

--
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
#2 lore raw

PATCH 2/4 selftests/gpio: fix paths in Makefile

In reply to [email protected]

From: Changbin Du <[email protected]>

With previous improvement, the generated files from tools/gpio/ will put into tools/testing/selftests/gpio/. Let's fix the paths in Makefile and .gitignore.

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/.gitignore      |  4 ----
 tools/testing/selftests/gpio/.gitignore |  4 ++++
 tools/testing/selftests/gpio/Makefile   | 14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)
tools/testing/selftests/.gitignore +0 -4
index 9175035..f0600d2 100644
@@ -1,5 +1 @@
 kselftest
-gpiogpio-event-mon
-gpiogpio-hammer
-gpioinclude/
-gpiolsgpio
tools/testing/selftests/gpio/.gitignore +4 -0
index 7d14f74..21e83e1 100644
@@ -1 +1,5 @@
 gpio-mockup-chardev
+gpio-event-mon
+gpio-hammer
+include/
+lsgpio
tools/testing/selftests/gpio/Makefile +7 -7
index 1bbb475..73f0778 100644
@@ -3,11 +3,11 @@
 TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
 BINARIES := gpio-mockup-chardev
-EXTRA_PROGS := ../gpiogpio-event-mon ../gpiogpio-hammer ../gpiolsgpio
-EXTRA_DIRS := ../gpioinclude/
-EXTRA_OBJS := ../gpiogpio-event-mon-in.o ../gpiogpio-event-mon.o
-EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o
-EXTRA_OBJS += ../gpiolsgpio.o
+EXTRA_PROGS := gpio-event-mon gpio-hammer lsgpio
+EXTRA_DIRS := ./include/
+EXTRA_OBJS := gpio-event-mon-in.o gpio-event-mon.o
+EXTRA_OBJS += gpio-hammer-in.o gpio-utils.o lsgpio-in.o
+EXTRA_OBJS += lsgpio.o
 
 include ../lib.mk
 
@@ -21,9 +21,9 @@ endef
 CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
 LDLIBS += -lmount -I/usr/include/libmount
 
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
+$(BINARIES): gpio-utils.o ../../../../usr/include/linux/gpio.h
 
-../../../gpio/gpio-utils.o:
+gpio-utils.o:
 	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
 
 ../../../../usr/include/linux/gpio.h:
Signature · 6 lines
2.7.4

--
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
#3 lore raw

PATCH 3/4 kselftest: install sanitized kernel headers before compiling

In reply to [email protected]

From: Changbin Du <changbin.du at intel.com>

There are test cases that require kernel headers. Some of this cases has put the dependency check into individual Makefiles, but some not. Let's sync the kernel headers at top level Makefile to avoid compiling errors like below.

make[1]: Entering directory '/home/changbin/work/linux/tools/testing/selftests/membarrier'
gcc -g -I../../../../usr/include/ membarrier_test.c -o /home/changbin/work/linux/tools/testing/selftests/membarrier//membarrier_test
membarrier_test.c: In function ‘test_membarrier_global_success’:
membarrier_test.c:64:12: error: ‘MEMBARRIER_CMD_GLOBAL’ undeclared (first use in this function)

  int cmd = MEMBARRIER_CMD_GLOBAL, flags = 0;
            ^
membarrier_test.c:64:12: note: each undeclared identifier is reported only once for each function it appears in
membarrier_test.c: In function ‘test_membarrier_private_expedited_fail’:
membarrier_test.c:80:12: error: ‘MEMBARRIER_CMD_PRIVATE_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_register_private_expedited_success’:
membarrier_test.c:103:12: error: ‘MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_private_expedited_success’:
membarrier_test.c:120:12: error: ‘MEMBARRIER_CMD_PRIVATE_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_private_expedited_sync_core_fail’:
membarrier_test.c:137:12: error: ‘MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_register_private_expedited_sync_core_success’:
membarrier_test.c:160:12: error: ‘MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_private_expedited_sync_core_success’:
membarrier_test.c:177:12: error: ‘MEMBARRIER_CMD_PRIVATE_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_PRIVATE_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_register_global_expedited_success’:
membarrier_test.c:194:12: error: ‘MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier_global_expedited_success’:
membarrier_test.c:211:12: error: ‘MEMBARRIER_CMD_GLOBAL_EXPEDITED’ undeclared (first use in this function)
  int cmd = MEMBARRIER_CMD_GLOBAL_EXPEDITED, flags = 0;
            ^
membarrier_test.c: In function ‘test_membarrier’:
membarrier_test.c:253:15: error: ‘MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE’ undeclared (first use in this function)
  if (status & MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) {
               ^
membarrier_test.c: In function ‘test_membarrier_query’:
membarrier_test.c:296:14: error: ‘MEMBARRIER_CMD_GLOBAL’ undeclared (first use in this function)
  if (!(ret & MEMBARRIER_CMD_GLOBAL)) {
              ^

../lib.mk:109: recipe for target '/home/changbin/work/linux/tools/testing/selftests/membarrier//membarrier_test' failed make[1]: *** [/home/changbin/work/linux/tools/testing/selftests/membarrier//membarrier_test] Error 1 make[1]: Leaving directory '/home/changbin/work/linux/tools/testing/selftests/membarrier'

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/Makefile +4 -1
index 7916aa2..656b674 100644
@@ -67,13 +67,16 @@ ifndef BUILD
 endif
 
 export BUILD
-all:
+all: headers_install
 	@for TARGET in $(TARGETS); do		\
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		mkdir $$BUILD_TARGET  -p;	\
 		make OUTPUT=$$BUILD_TARGET/ -C $$TARGET;\
 	done;
 
+headers_install:
+	make -C ../../../ headers_install
+
 run_tests: all
 	@for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
Signature · 6 lines
2.7.4

--
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
#4 lore raw

PATCH 4/4 selftests/bpf: fix compiling errors

In reply to [email protected]

From: Changbin Du <[email protected]>

This patch fixed below errors of missing head files.

tools/testing/selftests$ make
...

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_xdp.o In file included from test_xdp.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_l4lb.o In file included from test_l4lb.c:10:
In file included from /usr/include/linux/pkt_cls.h:4:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_tcp_estats.o In file included from test_tcp_estats.c:35:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
#include <asm/bitsperlong.h>
...

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +3 -2
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types
 
 $(OUTPUT)/test_l4lb_noinline.o: CLANG_FLAGS += -fno-inline
Signature · 6 lines
2.7.4

--
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
#5 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 66 lines · On Mon, Mar 26, 2018@05:23:28PM +0800, [email protected] wrote:

From: Changbin Du <changbin.du at intel.com>

This patch fixed below errors of missing head files.

tools/testing/selftests$ make
...

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_xdp.o In file included from test_xdp.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_l4lb.o In file included from test_l4lb.c:10:
In file included from /usr/include/linux/pkt_cls.h:4:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_tcp_estats.o In file included from test_tcp_estats.c:35:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
#include <asm/bitsperlong.h>
...

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

--
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

#6 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 24 lines · Alexei Starovoitov
Quoted 23 lines · changbin.du at intel.com
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
Quoted 8 lines

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 3 lines
tools/testing/selftests/bpf/Makefile +1 -1
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

This one? But I didn't see any problem.

changbin at gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make make -C ../../../lib/bpf OUTPUT=/home/changbin/work/linux/tools/testing/selftests/bpf/ make[1]: Entering directory '/home/changbin/work/linux/tools/lib/bpf'

  HOSTCC   /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep.o
  HOSTLD   /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep-in.o
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/fixdep
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.o
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/bpf.o
  CC       /home/changbin/work/linux/tools/testing/selftests/bpf/nlattr.o
  LD       /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf-in.o
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a
  LINK     /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.so

make[1]: Leaving directory '/home/changbin/work/linux/tools/lib/bpf' make -C ../../../lib/bpf OUTPUT=/home/changbin/work/linux/tools/testing/selftests/bpf/ make[1]: Entering directory '/home/changbin/work/linux/tools/lib/bpf' make[1]: Leaving directory '/home/changbin/work/linux/tools/lib/bpf'

gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_verifier.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_verifier
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_tag.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tag
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_maps.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_maps
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_lru_map.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_lru_map
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_lpm_map.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_lpm_map
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_progs.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_progs
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_align.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_align
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_verifier_log.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_verifier_log
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_dev_cgroup.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_dev_cgroup
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_tcpbpf_user.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a cgroup_helpers.c -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcpbpf_user
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../../include/generated -DHAVE_GENHDR -I../../../include -I../../../../usr/include    test_libbpf_open.c /home/changbin/work/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf -lrt -lpthread -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_libbpf_open
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_l4lb.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcp_estats.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_obj_id.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_obj_id.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_md_access.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_md_access.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp_redirect.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_redirect.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_xdp_meta.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_meta.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sockmap_parse_prog.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sockmap_parse_prog.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sockmap_verdict_prog.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sockmap_verdict_prog.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c dev_cgroup.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/dev_cgroup.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sample_ret0.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sample_ret0.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tracepoint.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tracepoint.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types -fno-inline \
         -O2 -target bpf -emit-llvm -c test_l4lb_noinline.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_l4lb_noinline.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types -fno-inline \
         -O2 -target bpf -emit-llvm -c test_xdp_noinline.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_xdp_noinline.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_stacktrace_map.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_stacktrace_map.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c sample_map_ret0.c -o - |      \
llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/sample_map_ret0.o
clang -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_tcpbpf_kern.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_tcpbpf_kern.o changbin at gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$

Signature · 6 lines
Thanks,
Changbin Du
--
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
#7 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 34 lines · Changbin
Quoted 24 lines · Alexei Starovoitov
Quoted 23 lines · On Mon, Mar 26, 2018@05:23:28PM +0800, [email protected] wrote:
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
Quoted 8 lines

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 3 lines
tools/testing/selftests/bpf/Makefile +1 -1
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?
Please test with in-source and out-of-source builds.

--
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

#8 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 35 lines · Alexei Starovoitov
Quoted 34 lines · Changbin
Quoted 32 lines · Alexei Starovoitov
Quoted 20 lines · On Mon, Mar 26, 2018@05:23:28PM +0800, [email protected] wrote:
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 4 lines
Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?

I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

Quoted 2 lines

Please test with in-source and out-of-source builds.

agree.

Signature · 6 lines
Thanks,
Changbin Du
--
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
maintainer
#9 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 35 lines · Changbin
Quoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Changbin
Quoted 31 lines · Alexei Starovoitov
Quoted 20 lines · On Mon, Mar 26, 2018@05:23:28PM +0800, [email protected] wrote:
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?

Agree.

Quoted 1 line

I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

The problem is that this suddenly requires users to do a 'make headers_install' in order to populate usr/include/ directory in the first place. While it's annoying enough for BPF samples where this is needed, I absolutely don't want to introduce this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need to use that instead. Please adapt your patch accordingly and respin. Please also Cc us and netdev at vger.kernel.org for BPF kselftests changes.

Thanks,
Daniel
--
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

#10 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 53 lines · Daniel Borkmann
Quoted 35 lines · Changbin
Quoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Changbin
Quoted 31 lines · Alexei Starovoitov
Quoted 20 lines · changbin.du at intel.com
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?

Agree.

Quoted 1 line

I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

The problem is that this suddenly requires users to do a 'make headers_install' in order to populate usr/include/ directory in the first place. While it's annoying enough for BPF samples where this is needed, I absolutely don't want to introduce this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need to use that instead. Please adapt your patch accordingly and respin. Please also Cc us and netdev at vger.kernel.org for BPF kselftests changes.

Quoted 2 lines

Thanks,
Daniel

Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right? The corrent makefile seems not. How do you get this built?

changbin at gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p [...]

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found #include <asm/bitsperlong.h>

Signature · 6 lines
Thanks,
Changbin Du
--
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
maintainer
#11 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 54 lines · Changbin
Quoted 45 lines · Daniel Borkmann
Quoted 35 lines · Changbin
Quoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Changbin
Quoted 31 lines · Alexei Starovoitov
Quoted 20 lines · changbin.du at intel.com
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?

Agree.

Quoted 1 line

I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

Quoted 8 lines

The problem is that this suddenly requires users to do a 'make headers_install' in order to populate usr/include/ directory in the first place. While it's annoying enough for BPF samples where this is needed, I absolutely don't want to introduce this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need to use that instead. Please adapt your patch accordingly and respin. Please also Cc us and netdev at vger.kernel.org for BPF kselftests changes.

Quoted 2 lines

Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right? The corrent makefile seems not. How do you get this built?

E.g. take a look at tools/include/asm/barrier.h or tools/include/uapi/asm/bpf_perf_event.h just to name two examples. We'd need something similar to this which then points to the arch specific includes.

Thanks,
Daniel

Quoted 12 lines

changbin at gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p [...]

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found #include <asm/bitsperlong.h>

--
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

#12 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

Quoted 58 lines · Daniel Borkmann
Quoted 54 lines · Changbin
Quoted 45 lines · Daniel Borkmann
Quoted 35 lines · Changbin
Quoted 34 lines · Alexei Starovoitov
Quoted 33 lines · Changbin
Quoted 31 lines · Alexei Starovoitov
Quoted 20 lines · changbin.du at intel.com
Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

This one? But I didn't see any problem.

because the build was lucky and additional path ../../../../usr/include didn't point to a valid dir?

Agree.

Quoted 1 line

I am sorry but I don't understand why you mean *lucky*. Of cause, the path is valid.

Quoted 8 lines

The problem is that this suddenly requires users to do a 'make headers_install' in order to populate usr/include/ directory in the first place. While it's annoying enough for BPF samples where this is needed, I absolutely don't want to introduce this for BPF kselftests. It's the wrong approach. Besides, in tools infra, there is a tools/arch/*/include/uapi/asm/bitsperlong.h header copy already, so we really need to use that instead. Please adapt your patch accordingly and respin. Please also Cc us and netdev at vger.kernel.org for BPF kselftests changes.

Quoted 2 lines

Thanks for the explanation. So we expect that tools/arch/*/include is in the searching list, right? The corrent makefile seems not. How do you get this built?

Quoted 7 lines

E.g. take a look at tools/include/asm/barrier.h or tools/include/uapi/asm/bpf_perf_event.h just to name two examples. We'd need something similar to this which then points to the arch specific includes.

Thanks,
Daniel

ok, I see. But I am going to skip this fix this time. Because one get fixed, another appears. IMHO, It doesn't sound like a good idea to sync all these files manually. We should have better solution I think.

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o In file included from test_pkt_access.c:12:
/usr/include/linux/ip.h:20:10: fatal error: 'asm/byteorder.h' file not found
#include <asm/byteorder.h>

Quoted 13 lines
Quoted 12 lines

changbin at gvt-dell-host:~/work/linux/tools/testing/selftests/bpf$ make -p [...]

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
         -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf/test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found #include <asm/bitsperlong.h>

Signature · 6 lines
Thanks,
Changbin Du
--
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
#13 lore raw

Re: [PATCH 4/4] selftests/bpf: fix compiling errors

In reply to Alexei Starovoitov

Hi Starovoitov,

This one does have the issue you mentioned.
[PATCH 2/4] selftests/gpio: fix paths in Makefile

And can be fixed by:

tools/testing/selftests/gpio/Makefile +2 -1
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
+OUTPUT ?= $(shell pwd)
 TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
 BINARIES := gpio-mockup-chardev
@@ -24,7 +25,7 @@ LDLIBS += -lmount -I/usr/include/libmount
 $(BINARIES): gpio-utils.o ../../../../usr/include/linux/gpio.h
 
 gpio-utils.o:
-       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(OUTPUT)/ -C ../../../gpio
 
 ../../../../usr/include/linux/gpio.h:
 

I will update it later.

Quoted 78 lines · Alexei Starovoitov
Quoted 66 lines · changbin.du at intel.com

From: Changbin Du <changbin.du at intel.com>

This patch fixed below errors of missing head files.

tools/testing/selftests$ make
...

clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_pkt_access.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_pkt_access.o In file included from test_pkt_access.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_xdp.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_xdp.o In file included from test_xdp.c:9:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_l4lb.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_l4lb.o In file included from test_l4lb.c:10:
In file included from /usr/include/linux/pkt_cls.h:4:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

 #include <asm/bitsperlong.h>
         ^
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -Wno-compare-distinct-pointer-types \
	 -O2 -target bpf -emit-llvm -c test_tcp_estats.c -o - |      \

llc -march=bpf -mcpu=generic -filetype=obj -o /home/changbin/work/linux/tools/testing/selftests/bpf//test_tcp_estats.o In file included from test_tcp_estats.c:35:
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found
#include <asm/bitsperlong.h>
...

Signed-off-by Changbin Du <changbin.du at intel.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +2 -1
index 5c43c18..dc0fdc8 100644
@@ -10,7 +10,8 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
-CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
+CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) \
+	  -I../../../include -I../../../../usr/include
 LDLIBS += -lcap -lelf -lrt -lpthread
 
 # Order correspond to 'make run_tests' order

tools/testing/selftests/bpf/Makefile else · line 67

Quoted 6 lines
tools/testing/selftests/bpf/Makefile +1 -1
@@ -62,7 +63,7 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
+CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi -I../../../../usr/include \
 	      -Wno-compare-distinct-pointer-types

Nack.
I suspect that will break the build for everyone else who's doing it in the directory itself instead of the outer one.

Signature · 6 lines
Thanks,
Changbin Du
--
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