linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] selftests: fix compiling issues
@ 2018-03-27  3:11 changbin.du
  2018-03-27  3:11 ` changbin.du
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

v2: resolve compiling error if run make in individual folder.

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   | 17 +++++++++--------
 5 files changed, 28 insertions(+), 23 deletions(-)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 0/4] selftests: fix compiling issues
  2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
@ 2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11 ` [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT changbin.du
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

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

v2: resolve compiling error if run make in individual folder.

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   | 17 +++++++++--------
 5 files changed, 28 insertions(+), 23 deletions(-)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
  2018-03-27  3:11 ` changbin.du
@ 2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11   ` changbin.du
  2018-03-27 21:19   ` shuah
  2018-03-27  3:11 ` [PATCH v2 2/4] selftests/gpio: fix paths in Makefile changbin.du
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

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

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7442dfb..7916aa2 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -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
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-27  3:11 ` [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT changbin.du
@ 2018-03-27  3:11   ` changbin.du
  2018-03-27 21:19   ` shuah
  1 sibling, 0 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

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

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7442dfb..7916aa2 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -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
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] selftests/gpio: fix paths in Makefile
  2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
  2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11 ` [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT changbin.du
@ 2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11   ` changbin.du
  2018-03-27  3:11 ` [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling changbin.du
  2018-03-27  3:11 ` [PATCH v2 4/4] selftests/bpf: fix compiling errors changbin.du
  4 siblings, 1 reply; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

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>

---
v2: fix compiling error when runing make in sub-folder.
---
 tools/testing/selftests/.gitignore      |  4 ----
 tools/testing/selftests/gpio/.gitignore |  4 ++++
 tools/testing/selftests/gpio/Makefile   | 17 +++++++++--------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/.gitignore b/tools/testing/selftests/.gitignore
index 9175035..f0600d2 100644
--- a/tools/testing/selftests/.gitignore
+++ b/tools/testing/selftests/.gitignore
@@ -1,5 +1 @@
 kselftest
-gpiogpio-event-mon
-gpiogpio-hammer
-gpioinclude/
-gpiolsgpio
diff --git a/tools/testing/selftests/gpio/.gitignore b/tools/testing/selftests/gpio/.gitignore
index 7d14f74..21e83e1 100644
--- a/tools/testing/selftests/gpio/.gitignore
+++ b/tools/testing/selftests/gpio/.gitignore
@@ -1 +1,5 @@
 gpio-mockup-chardev
+gpio-event-mon
+gpio-hammer
+include/
+lsgpio
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 1bbb475..cb8c134 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,13 +1,14 @@
 # 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
-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,10 +22,10 @@ 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:
-	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+gpio-utils.o:
+	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(OUTPUT)/ -C ../../../gpio
 
 ../../../../usr/include/linux/gpio.h:
 	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] selftests/gpio: fix paths in Makefile
  2018-03-27  3:11 ` [PATCH v2 2/4] selftests/gpio: fix paths in Makefile changbin.du
@ 2018-03-27  3:11   ` changbin.du
  0 siblings, 0 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

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>

---
v2: fix compiling error when runing make in sub-folder.
---
 tools/testing/selftests/.gitignore      |  4 ----
 tools/testing/selftests/gpio/.gitignore |  4 ++++
 tools/testing/selftests/gpio/Makefile   | 17 +++++++++--------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/.gitignore b/tools/testing/selftests/.gitignore
index 9175035..f0600d2 100644
--- a/tools/testing/selftests/.gitignore
+++ b/tools/testing/selftests/.gitignore
@@ -1,5 +1 @@
 kselftest
-gpiogpio-event-mon
-gpiogpio-hammer
-gpioinclude/
-gpiolsgpio
diff --git a/tools/testing/selftests/gpio/.gitignore b/tools/testing/selftests/gpio/.gitignore
index 7d14f74..21e83e1 100644
--- a/tools/testing/selftests/gpio/.gitignore
+++ b/tools/testing/selftests/gpio/.gitignore
@@ -1 +1,5 @@
 gpio-mockup-chardev
+gpio-event-mon
+gpio-hammer
+include/
+lsgpio
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 1bbb475..cb8c134 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,13 +1,14 @@
 # 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
-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,10 +22,10 @@ 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:
-	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+gpio-utils.o:
+	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) OUTPUT=$(OUTPUT)/ -C ../../../gpio
 
 ../../../../usr/include/linux/gpio.h:
 	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling
  2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
                   ` (2 preceding siblings ...)
  2018-03-27  3:11 ` [PATCH v2 2/4] selftests/gpio: fix paths in Makefile changbin.du
@ 2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11   ` changbin.du
  2018-03-27 21:25   ` shuah
  2018-03-27  3:11 ` [PATCH v2 4/4] selftests/bpf: fix compiling errors changbin.du
  4 siblings, 2 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4806 bytes --]

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

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7916aa2..656b674 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -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;	\
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling
  2018-03-27  3:11 ` [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling changbin.du
@ 2018-03-27  3:11   ` changbin.du
  2018-03-27 21:25   ` shuah
  1 sibling, 0 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


From: Changbin Du <changbin.du@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(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 7916aa2..656b674 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -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;	\
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] selftests/bpf: fix compiling errors
  2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
                   ` (3 preceding siblings ...)
  2018-03-27  3:11 ` [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling changbin.du
@ 2018-03-27  3:11 ` changbin.du
  2018-03-27  3:11   ` changbin.du
  4 siblings, 1 reply; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


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

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 5c43c18..dc0fdc8 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -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
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] selftests/bpf: fix compiling errors
  2018-03-27  3:11 ` [PATCH v2 4/4] selftests/bpf: fix compiling errors changbin.du
@ 2018-03-27  3:11   ` changbin.du
  0 siblings, 0 replies; 16+ messages in thread
From: changbin.du @ 2018-03-27  3:11 UTC (permalink / raw)


From: Changbin Du <changbin.du@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(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 5c43c18..dc0fdc8 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -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
-- 
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-27  3:11 ` [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT changbin.du
  2018-03-27  3:11   ` changbin.du
@ 2018-03-27 21:19   ` shuah
  2018-03-27 21:19     ` Shuah Khan
  2018-03-28  1:45     ` changbin.du
  1 sibling, 2 replies; 16+ messages in thread
From: shuah @ 2018-03-27 21:19 UTC (permalink / raw)


On 03/26/2018 09:11 PM, changbin.du at intel.com wrote:
> From: Changbin Du <changbin.du at intel.com>
> 
> 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>

Are you seeing this when you run "make kselftest" - if gpio is the
only test compile that fails, it should be fixed in gpio/Makefile,
not is the common Makefile.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-27 21:19   ` shuah
@ 2018-03-27 21:19     ` Shuah Khan
  2018-03-28  1:45     ` changbin.du
  1 sibling, 0 replies; 16+ messages in thread
From: Shuah Khan @ 2018-03-27 21:19 UTC (permalink / raw)


On 03/26/2018 09:11 PM, changbin.du@intel.com wrote:
> From: Changbin Du <changbin.du at intel.com>
> 
> 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>

Are you seeing this when you run "make kselftest" - if gpio is the
only test compile that fails, it should be fixed in gpio/Makefile,
not is the common Makefile.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling
  2018-03-27  3:11 ` [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling changbin.du
  2018-03-27  3:11   ` changbin.du
@ 2018-03-27 21:25   ` shuah
  2018-03-27 21:25     ` Shuah Khan
  1 sibling, 1 reply; 16+ messages in thread
From: shuah @ 2018-03-27 21:25 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5302 bytes --]

On 03/26/2018 09:11 PM, changbin.du at intel.com wrote:
> 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(-)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 7916aa2..656b674 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -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;	\
> 

Sorry. headers_install should not be dependency to run "make kselftest".
Also this will compromise "make O=" use-case where objects are
built in a separate directory to keep the repo clean.

Individual test dependencies should be handled by test Makefiles.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling
  2018-03-27 21:25   ` shuah
@ 2018-03-27 21:25     ` Shuah Khan
  0 siblings, 0 replies; 16+ messages in thread
From: Shuah Khan @ 2018-03-27 21:25 UTC (permalink / raw)


On 03/26/2018 09:11 PM, changbin.du@intel.com wrote:
> 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(-)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 7916aa2..656b674 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -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;	\
> 

Sorry. headers_install should not be dependency to run "make kselftest".
Also this will compromise "make O=" use-case where objects are
built in a separate directory to keep the repo clean.

Individual test dependencies should be handled by test Makefiles.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-27 21:19   ` shuah
  2018-03-27 21:19     ` Shuah Khan
@ 2018-03-28  1:45     ` changbin.du
  2018-03-28  1:45       ` Du, Changbin
  1 sibling, 1 reply; 16+ messages in thread
From: changbin.du @ 2018-03-28  1:45 UTC (permalink / raw)


On Tue, Mar 27, 2018 at 03:19:26PM -0600, Shuah Khan wrote:
> On 03/26/2018 09:11 PM, changbin.du at intel.com wrote:
> > From: Changbin Du <changbin.du at intel.com>
> > 
> > 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>
> 
> Are you seeing this when you run "make kselftest" - if gpio is the
> only test compile that fails, it should be fixed in gpio/Makefile,
> not is the common Makefile.
>
I only saw error in gpio, but I also saw some kselftest Makefiles having string concatenation
as '$(OUTPUT)$(dir)'. So the rule is not aligned all over. They just didn't produce any errors
so far.

By the way, is there a basic test for kselftest infrastructure? It seems it was always
reporting error when building it :(

> thanks,
> -- Shuah

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT
  2018-03-28  1:45     ` changbin.du
@ 2018-03-28  1:45       ` Du, Changbin
  0 siblings, 0 replies; 16+ messages in thread
From: Du, Changbin @ 2018-03-28  1:45 UTC (permalink / raw)


On Tue, Mar 27, 2018@03:19:26PM -0600, Shuah Khan wrote:
> On 03/26/2018 09:11 PM, changbin.du@intel.com wrote:
> > From: Changbin Du <changbin.du at intel.com>
> > 
> > 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>
> 
> Are you seeing this when you run "make kselftest" - if gpio is the
> only test compile that fails, it should be fixed in gpio/Makefile,
> not is the common Makefile.
>
I only saw error in gpio, but I also saw some kselftest Makefiles having string concatenation
as '$(OUTPUT)$(dir)'. So the rule is not aligned all over. They just didn't produce any errors
so far.

By the way, is there a basic test for kselftest infrastructure? It seems it was always
reporting error when building it :(

> thanks,
> -- Shuah

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-03-28  1:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27  3:11 [PATCH v2 0/4] selftests: fix compiling issues changbin.du
2018-03-27  3:11 ` changbin.du
2018-03-27  3:11 ` [PATCH v2 1/4] selftests/Makefile: append a slash to env variable OUTPUT changbin.du
2018-03-27  3:11   ` changbin.du
2018-03-27 21:19   ` shuah
2018-03-27 21:19     ` Shuah Khan
2018-03-28  1:45     ` changbin.du
2018-03-28  1:45       ` Du, Changbin
2018-03-27  3:11 ` [PATCH v2 2/4] selftests/gpio: fix paths in Makefile changbin.du
2018-03-27  3:11   ` changbin.du
2018-03-27  3:11 ` [PATCH v2 3/4] kselftest: install sanitized kernel headers before compiling changbin.du
2018-03-27  3:11   ` changbin.du
2018-03-27 21:25   ` shuah
2018-03-27 21:25     ` Shuah Khan
2018-03-27  3:11 ` [PATCH v2 4/4] selftests/bpf: fix compiling errors changbin.du
2018-03-27  3:11   ` changbin.du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).