Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532220 > unrolled thread

[PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest

Started by<bamvor.zhangjian@huawei.com>
First post2016-11-29 13:00 +0100
Last post2016-12-01 20:40 +0100
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest <bamvor.zhangjian@huawei.com> - 2016-11-29 13:00 +0100
    [PATCH v2 2/6] selftests: remove useless TEST_DIRS <bamvor.zhangjian@huawei.com> - 2016-11-29 13:00 +0100
    [PATCH v2 5/6] selftests: add EXTRA_CLEAN for clean target <bamvor.zhangjian@huawei.com> - 2016-11-29 13:00 +0100
    [PATCH v2 6/6] selftests: enable O and KBUILD_OUTPUT <bamvor.zhangjian@huawei.com> - 2016-11-29 13:00 +0100
    Re: [PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-30 15:20 +0100
      Re: [PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest Bamvor Zhang Jian <bamvor.zhangjian@linaro.org> - 2016-11-30 16:40 +0100
        Re: [PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest Shuah Khan <shuahkh@osg.samsung.com> - 2016-12-01 20:40 +0100

#1532220 — [PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest

From<bamvor.zhangjian@huawei.com>
Date2016-11-29 13:00 +0100
Subject[PATCH v2 0/6] enable O and KBUILD_OUTPUT for kselftest
Message-ID<sIPeN-7XO-5@gated-at.bofh.it>
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

Here is my second version for enabling the KBUILD_OUTPUT for kselftest.
The first version could be found here[1]. I fix and test all the TARGET
in tools/testing/selftest/Makefile. For ppc, I test through fake target.

There are six patches in these series. And five of them clean up the
existing code. I split the clean up patches into five, hope it is easy
to review.

  selftests: remove duplicated all and clean target
  selftests: remove useless TEST_DIRS
a selftests: add pattern rules
A selftests: remove CROSS_COMPILE in dedicated Makefile
A selftests: add EXTRA_CLEAN for clean target
  selftests: enable O and KBUILD_OUTPUT

Notes:
  A: Ack by Michael.
  a: ack by Michael. Minor update after rebase.

In the first patch, I split the test files into two types:
TEST_GEN_XXX means such file is generated during compiling. TEST_XXX
means there is no need to compile before use. The main reason of this
is the enablement of KBUILD_OUTPUT only need to care about TEST_GEN_XXX.
I wanted to copy all the TEST_XXX with TEST_GEN_XXX, but I give up this
idea in the end. Because people may puzzle why copy the file before
installation.

Because of the introducing of TEST_GEN_XXX, I update the top-level
Makefile and lib.mk selftests directory. After introduce TEST_GEN_XXX, I
could remove all the unnecessary all and clean targets.

The second patch remove TEST_DIRS variable. And third patch add the
pattern for compiling the c sourc code. The fourth patch remove the
useless CROSS_COMPILE variable as it aleady exists in
"tools/testing/selftests/lib.mk".

Further more, The fifth patch add the EXTRA_CLEAN variable to clean up
the duplicated clean target

The last patch introduce the KBUILD_OUTPUT and O for kselftest instead
using the existing kbuild system because user may compile kselftest
directly (make -C tools/testing/selftests).

Changes:
1.  remove the useless *.o target in the following file suggested by
    Michael:
    tools/testing/selftests/powerpc/benchmarks/Makefile
    tools/testing/selftests/powerpc/copyloops/Makefile
    tools/testing/selftests/powerpc/dscr/Makefile
    tools/testing/selftests/powerpc/math/Makefile
    tools/testing/selftests/powerpc/primitives/Makefile
    tools/testing/selftests/powerpc/stringloops/Makefile
    tools/testing/selftests/powerpc/syscalls/Makefile
    tools/testing/selftests/powerpc/tm/Makefile

2.  remove the useless "all" and "clean" target in bpf and nsfs which
    are added after my previous patch.

3.  Improve the commit message.

[1] http://www.spinics.net/lists/linux-api/msg20789.html

Bamvor Jian Zhang (6):
  selftests: remove duplicated all and clean target
  selftests: remove useless TEST_DIRS
  selftests: add default rules for c source file
  selftests: remove CROSS_COMPILE in dedicated Makefile
  selftests: add EXTRA_CLEAN for clean target
  selftests: enable O and KBUILD_OUTPUT

 Documentation/kselftest.txt                        | 12 +++++++
 tools/testing/selftests/Makefile                   | 36 ++++++++++++++-----
 tools/testing/selftests/bpf/Makefile               | 10 ++----
 tools/testing/selftests/breakpoints/Makefile       | 10 ++----
 tools/testing/selftests/capabilities/Makefile      | 11 ++----
 tools/testing/selftests/efivarfs/Makefile          |  8 +----
 tools/testing/selftests/exec/Makefile              | 32 ++++++++---------
 tools/testing/selftests/ftrace/Makefile            |  6 ++--
 tools/testing/selftests/futex/Makefile             | 21 ++++++++---
 tools/testing/selftests/futex/functional/Makefile  | 12 ++-----
 tools/testing/selftests/ipc/Makefile               |  7 +---
 tools/testing/selftests/kcmp/Makefile              |  6 ++--
 tools/testing/selftests/lib.mk                     | 36 +++++++++++++++----
 tools/testing/selftests/membarrier/Makefile        |  6 +---
 tools/testing/selftests/memfd/Makefile             | 15 ++------
 tools/testing/selftests/mount/Makefile             |  7 +---
 tools/testing/selftests/mqueue/Makefile            |  6 +---
 tools/testing/selftests/net/Makefile               | 15 +++-----
 tools/testing/selftests/nsfs/Makefile              |  9 +----
 tools/testing/selftests/powerpc/Makefile           | 15 ++++----
 tools/testing/selftests/powerpc/alignment/Makefile |  9 ++---
 .../testing/selftests/powerpc/benchmarks/Makefile  | 15 +++-----
 .../selftests/powerpc/context_switch/Makefile      |  9 ++---
 tools/testing/selftests/powerpc/copyloops/Makefile | 19 ++++------
 tools/testing/selftests/powerpc/dscr/Makefile      | 13 +++----
 tools/testing/selftests/powerpc/math/Makefile      | 25 ++++++-------
 tools/testing/selftests/powerpc/mm/Makefile        | 18 ++++------
 tools/testing/selftests/powerpc/pmu/Makefile       | 26 +++++++-------
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   | 15 +++-----
 .../testing/selftests/powerpc/primitives/Makefile  |  9 ++---
 .../testing/selftests/powerpc/stringloops/Makefile |  9 ++---
 .../selftests/powerpc/switch_endian/Makefile       | 17 ++++-----
 tools/testing/selftests/powerpc/syscalls/Makefile  |  9 ++---
 tools/testing/selftests/powerpc/tm/Makefile        | 17 ++++-----
 tools/testing/selftests/powerpc/vphn/Makefile      | 10 ++----
 tools/testing/selftests/pstore/Makefile            |  4 +--
 tools/testing/selftests/ptrace/Makefile            |  8 +----
 tools/testing/selftests/seccomp/Makefile           |  6 +---
 tools/testing/selftests/sigaltstack/Makefile       |  5 +--
 tools/testing/selftests/size/Makefile              | 10 ++----
 tools/testing/selftests/timers/Makefile            | 10 ++----
 tools/testing/selftests/vm/Makefile                | 41 +++++++++-------------
 tools/testing/selftests/x86/Makefile               | 17 +++++----
 tools/testing/selftests/zram/Makefile              |  3 +-
 44 files changed, 247 insertions(+), 357 deletions(-)

-- 
2.10.0

[toc] | [next] | [standalone]


#1532225 — [PATCH v2 2/6] selftests: remove useless TEST_DIRS

From<bamvor.zhangjian@huawei.com>
Date2016-11-29 13:00 +0100
Subject[PATCH v2 2/6] selftests: remove useless TEST_DIRS
Message-ID<sIPeO-7XO-29@gated-at.bofh.it>
In reply to#1532220
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

The TEST_DIRS was introduced in Commit e8c1d7cdf137 ("selftests: copy
TEST_DIRS to INSTALL_PATH") for coping a whole directory in ftrace.

After rsync(with -a) is introduced by Commit 900d65ee11aa ("selftests:
change install command to rsync"). Rsync could handle the directory
without the definition of TEST_DIRS.

This patch simply replace TEST_DIRS with TEST_FILES in ftrace and remove
the TEST_DIRS in tools/testing/selftest/lib.mk

Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
 tools/testing/selftests/ftrace/Makefile | 2 +-
 tools/testing/selftests/lib.mk          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/ftrace/Makefile b/tools/testing/selftests/ftrace/Makefile
index 4e6ed13..a715300 100644
--- a/tools/testing/selftests/ftrace/Makefile
+++ b/tools/testing/selftests/ftrace/Makefile
@@ -1,7 +1,7 @@
 all:
 
 TEST_PROGS := ftracetest
-TEST_DIRS := test.d
+TEST_FILES := test.d
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 9fddffd..5b8634c 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -14,8 +14,8 @@ run_tests: all
 define INSTALL_RULE
 	@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then					\
 		mkdir -p ${INSTALL_PATH};										\
-		echo "rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/";       \
-		rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/;              \
+		echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/";	\
+		rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/;		\
 	fi
 	@if [ "X$(TEST_GEN_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then					\
 		mkdir -p ${INSTALL_PATH};										\
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1532226 — [PATCH v2 5/6] selftests: add EXTRA_CLEAN for clean target

From<bamvor.zhangjian@huawei.com>
Date2016-11-29 13:00 +0100
Subject[PATCH v2 5/6] selftests: add EXTRA_CLEAN for clean target
Message-ID<sIPeO-7XO-31@gated-at.bofh.it>
In reply to#1532220
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

Some testcases need the clean extra data after running. This patch
introduce the "EXTRA_CLEAN" variable to address this requirement.

After KBUILD_OUTPUT is enabled in later patch, it will be easy to
decide to if we need do the cleanup in the KBUILD_OUTPUT path(if the
testcase ran immediately after compiled).

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
 tools/testing/selftests/exec/Makefile                 | 19 +++++++++----------
 tools/testing/selftests/ftrace/Makefile               |  4 +---
 tools/testing/selftests/kcmp/Makefile                 |  4 ++--
 tools/testing/selftests/lib.mk                        |  2 +-
 .../testing/selftests/powerpc/switch_endian/Makefile  |  5 ++---
 tools/testing/selftests/pstore/Makefile               |  4 +---
 tools/testing/selftests/zram/Makefile                 |  3 +--
 7 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index 9eb1c3e..48d1f86 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -1,5 +1,14 @@
 CFLAGS = -Wall
 
+TEST_GEN_PROGS := execveat
+TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
+# Makefile is a run-time dependency, since it's accessed by the execveat test
+TEST_FILES := Makefile
+
+EXTRA_CLEAN := subdir.moved execveat.moved xxxxx*
+
+include ../lib.mk
+
 subdir:
 	mkdir -p $@
 script:
@@ -11,13 +20,3 @@ execveat.symlink: execveat
 execveat.denatured: execveat
 	cp $< $@
 	chmod -x $@
-
-TEST_GEN_PROGS := execveat
-TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
-# Makefile is a run-time dependency, since it's accessed by the execveat test
-TEST_FILES := Makefile
-
-include ../lib.mk
-
-clean:
-	rm -rf $(TEST_GEN_PROGS) $(TEST_GEN_FILES) subdir.moved execveat.moved xxxxx*
diff --git a/tools/testing/selftests/ftrace/Makefile b/tools/testing/selftests/ftrace/Makefile
index a715300..6c64b42 100644
--- a/tools/testing/selftests/ftrace/Makefile
+++ b/tools/testing/selftests/ftrace/Makefile
@@ -2,8 +2,6 @@ all:
 
 TEST_PROGS := ftracetest
 TEST_FILES := test.d
+EXTRA_CLEAN := logs/*
 
 include ../lib.mk
-
-clean:
-	rm -rf logs/*
diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 9e8b673..74a8add 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -2,7 +2,7 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := kcmp_test
 
+EXTRA_CLEAN := kcmp-test-file
+
 include ../lib.mk
 
-clean:
-	$(RM) $(TEST_GEN_PROGS) kcmp-test-file
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 68d7c01..0f7a371 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -43,7 +43,7 @@ emit_tests:
 all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 
 clean:
-	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
+	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
 
 %: %.c
 	$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^
diff --git a/tools/testing/selftests/powerpc/switch_endian/Makefile b/tools/testing/selftests/powerpc/switch_endian/Makefile
index bd01223..dbd05ac 100644
--- a/tools/testing/selftests/powerpc/switch_endian/Makefile
+++ b/tools/testing/selftests/powerpc/switch_endian/Makefile
@@ -2,6 +2,8 @@ TEST_GEN_PROGS := switch_endian_test
 
 ASFLAGS += -O2 -Wall -g -nostdlib -m64
 
+EXTRA_CLEAN = *.o check-reversed.S
+
 include ../../lib.mk
 
 switch_endian_test: check-reversed.S
@@ -11,6 +13,3 @@ check-reversed.o: check.o
 
 check-reversed.S: check-reversed.o
 	hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
-
-clean:
-	$(RM) $(TEST_GEN_PROGS) *.o check-reversed.S
diff --git a/tools/testing/selftests/pstore/Makefile b/tools/testing/selftests/pstore/Makefile
index bd7abe2..c5f2440 100644
--- a/tools/testing/selftests/pstore/Makefile
+++ b/tools/testing/selftests/pstore/Makefile
@@ -5,11 +5,9 @@ all:
 
 TEST_PROGS := pstore_tests pstore_post_reboot_tests
 TEST_FILES := common_tests pstore_crash_test
+EXTRA_CLEAN := logs/* *uuid
 
 include ../lib.mk
 
 run_crash:
 	@sh pstore_crash_test || { echo "pstore_crash_test: [FAIL]"; exit 1; }
-
-clean:
-	rm -rf logs/* *uuid
diff --git a/tools/testing/selftests/zram/Makefile b/tools/testing/selftests/zram/Makefile
index 29d8034..c3a87e5 100644
--- a/tools/testing/selftests/zram/Makefile
+++ b/tools/testing/selftests/zram/Makefile
@@ -2,8 +2,7 @@ all:
 
 TEST_PROGS := zram.sh
 TEST_FILES := zram01.sh zram02.sh zram_lib.sh
+EXTRA_CLEAN := err.log
 
 include ../lib.mk
 
-clean:
-	$(RM) err.log
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1532227 — [PATCH v2 6/6] selftests: enable O and KBUILD_OUTPUT

From<bamvor.zhangjian@huawei.com>
Date2016-11-29 13:00 +0100
Subject[PATCH v2 6/6] selftests: enable O and KBUILD_OUTPUT
Message-ID<sIPeO-7XO-43@gated-at.bofh.it>
In reply to#1532220
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest
to another directory by passing O or KBUILD_OUTPUT. And O is high
priority than KBUILD_OUTPUT.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
 tools/testing/selftests/Makefile                   | 36 ++++++++++++++++------
 tools/testing/selftests/exec/Makefile              | 13 ++++----
 tools/testing/selftests/ftrace/Makefile            |  2 +-
 tools/testing/selftests/futex/Makefile             | 21 ++++++++++---
 tools/testing/selftests/kcmp/Makefile              |  2 +-
 tools/testing/selftests/lib.mk                     | 19 +++++++++---
 tools/testing/selftests/powerpc/Makefile           | 15 +++++----
 .../testing/selftests/powerpc/benchmarks/Makefile  |  6 ++--
 tools/testing/selftests/powerpc/copyloops/Makefile |  8 ++---
 tools/testing/selftests/powerpc/dscr/Makefile      |  2 +-
 tools/testing/selftests/powerpc/math/Makefile      | 12 ++++----
 tools/testing/selftests/powerpc/mm/Makefile        |  6 ++--
 tools/testing/selftests/powerpc/pmu/Makefile       | 16 +++++-----
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   |  4 +--
 .../selftests/powerpc/switch_endian/Makefile       |  8 ++---
 tools/testing/selftests/powerpc/tm/Makefile        |  6 ++--
 tools/testing/selftests/vm/Makefile                |  4 +--
 tools/testing/selftests/x86/Makefile               | 17 +++++-----
 18 files changed, 122 insertions(+), 75 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index a3144a3..848af7c 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -47,29 +47,44 @@ override LDFLAGS =
 override MAKEFLAGS =
 endif
 
+BUILD := $(O)
+ifndef BUILD
+  BUILD := $(KBUILD_OUTPUT)
+endif
+ifndef BUILD
+  BUILD := $(shell pwd)
+endif
+
+export BUILD
 all:
-	for TARGET in $(TARGETS); do \
-		make -C $$TARGET; \
+	for TARGET in $(TARGETS); do		\
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		mkdir $$BUILD_TARGET  -p;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
 	done;
 
 run_tests: all
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET run_tests; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
 	done;
 
 hotplug:
 	for TARGET in $(TARGETS_HOTPLUG); do \
-		make -C $$TARGET; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
 	done;
 
 run_hotplug: hotplug
 	for TARGET in $(TARGETS_HOTPLUG); do \
-		make -C $$TARGET run_full_test; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
 	done;
 
 clean_hotplug:
 	for TARGET in $(TARGETS_HOTPLUG); do \
-		make -C $$TARGET clean; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
 	done;
 
 run_pstore_crash:
@@ -84,7 +99,8 @@ ifdef INSTALL_PATH
 	@# Ask all targets to install their files
 	mkdir -p $(INSTALL_PATH)
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
 	done;
 
 	@# Ask all targets to emit their test scripts
@@ -93,10 +109,11 @@ ifdef INSTALL_PATH
 	echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
 
 	for TARGET in $(TARGETS); do \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
 		echo "echo ========================================" >> $(ALL_SCRIPT); \
 		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
-		make -s --no-print-directory -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;
 
@@ -107,7 +124,8 @@ endif
 
 clean:
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET clean; \
+		BUILD_TARGET=$$BUILD/$$TARGET;	\
+		make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
 	done;
 
 .PHONY: install
diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index 48d1f86..2e13035 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -5,18 +5,19 @@ TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
 # Makefile is a run-time dependency, since it's accessed by the execveat test
 TEST_FILES := Makefile
 
-EXTRA_CLEAN := subdir.moved execveat.moved xxxxx*
+EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx*
 
 include ../lib.mk
 
-subdir:
+$(OUTPUT)/subdir:
 	mkdir -p $@
-script:
+$(OUTPUT)/script:
 	echo '#!/bin/sh' > $@
 	echo 'exit $$*' >> $@
 	chmod +x $@
-execveat.symlink: execveat
-	ln -s -f $< $@
-execveat.denatured: execveat
+$(OUTPUT)/execveat.symlink: $(OUTPUT)/execveat
+	cd $(OUTPUT) && ln -s -f $(shell basename $<) $(shell basename $@)
+$(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat
 	cp $< $@
 	chmod -x $@
+
diff --git a/tools/testing/selftests/ftrace/Makefile b/tools/testing/selftests/ftrace/Makefile
index 6c64b42..a8a5e21 100644
--- a/tools/testing/selftests/ftrace/Makefile
+++ b/tools/testing/selftests/ftrace/Makefile
@@ -2,6 +2,6 @@ all:
 
 TEST_PROGS := ftracetest
 TEST_FILES := test.d
-EXTRA_CLEAN := logs/*
+EXTRA_CLEAN := $(OUTPUT)/logs/*
 
 include ../lib.mk
diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
index 6a17529..653c5cd 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -3,13 +3,18 @@ SUBDIRS := functional
 TEST_PROGS := run.sh
 
 .PHONY: all clean
-all:
-	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 
 include ../lib.mk
 
+all:
+	for DIR in $(SUBDIRS); do		\
+		BUILD_TARGET=$$OUTPUT/$$DIR;	\
+		mkdir $$BUILD_TARGET  -p;	\
+		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
+	done
+
 override define RUN_TESTS
-	./run.sh
+	@if [ `dirname $(OUTPUT)` = $(PWD) ]; then ./run.sh; fi
 endef
 
 override define INSTALL_RULE
@@ -17,7 +22,9 @@ override define INSTALL_RULE
 	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
 
 	@for SUBDIR in $(SUBDIRS); do \
-		$(MAKE) -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
+		BUILD_TARGET=$$OUTPUT/$$SUBDIR;	\
+		mkdir $$BUILD_TARGET  -p;	\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
 	done;
 endef
 
@@ -26,4 +33,8 @@ override define EMIT_TESTS
 endef
 
 clean:
-	for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+	for DIR in $(SUBDIRS); do		\
+		BUILD_TARGET=$$OUTPUT/$$DIR;	\
+		mkdir $$BUILD_TARGET  -p;	\
+		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
+	done
diff --git a/tools/testing/selftests/kcmp/Makefile b/tools/testing/selftests/kcmp/Makefile
index 74a8add..47aa988 100644
--- a/tools/testing/selftests/kcmp/Makefile
+++ b/tools/testing/selftests/kcmp/Makefile
@@ -2,7 +2,7 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := kcmp_test
 
-EXTRA_CLEAN := kcmp-test-file
+EXTRA_CLEAN := $(OUTPUT)/kcmp-test-file
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 0f7a371..01bb778 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -4,7 +4,8 @@ CC := $(CROSS_COMPILE)gcc
 
 define RUN_TESTS
 	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
-		(./$$TEST && echo "selftests: $$TEST [PASS]") || echo "selftests: $$TEST [FAIL]"; \
+		BASENAME_TEST=`basename $$TEST`;	\
+		cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests:  $$BASENAME_TEST [FAIL]"; cd -;\
 	done;
 endef
 
@@ -33,19 +34,29 @@ endif
 
 define EMIT_TESTS
 	@for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \
-		echo "(./$$TEST && echo \"selftests: $$TEST [PASS]\") || echo \"selftests: $$TEST [FAIL]\""; \
+		BASENAME_TEST=`basename $$TEST`;	\
+		echo "(./$$BASENAME_TEST && echo \"selftests: $$BASENAME_TEST [PASS]\") || echo \"selftests: $$BASENAME_TEST [FAIL]\""; \
 	done;
 endef
 
 emit_tests:
 	$(EMIT_TESTS)
 
+TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
+TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
+
 all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 
 clean:
 	$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
 
-%: %.c
-	$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^
+$(OUTPUT)/%:%.c
+	$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $< -o $@
+
+$(OUTPUT)/%.o:%.S
+	$(CC) $(ASFLAGS) -c $< -o $@
+
+$(OUTPUT)/%:%.S
+	$(CC) $(ASFLAGS) $< -o $@
 
 .PHONY: run_tests all clean install emit_tests
diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index c2c4211..1d48c0c 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -34,32 +34,35 @@ endif
 all: $(SUB_DIRS)
 
 $(SUB_DIRS):
-	$(MAKE) -k -C $@ all
+	BUILD_TARGET=$$OUTPUT/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
 
 include ../lib.mk
 
 override define RUN_TESTS
 	@for TARGET in $(SUB_DIRS); do \
-		$(MAKE) -C $$TARGET run_tests; \
+		BUILD_TARGET=$$OUTPUT/$$TARGET;	\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
 	done;
 endef
 
 override define INSTALL_RULE
 	@for TARGET in $(SUB_DIRS); do \
-		$(MAKE) -C $$TARGET install; \
+		BUILD_TARGET=$$OUTPUT/$$TARGET;	\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\
 	done;
 endef
 
 override define EMIT_TESTS
 	@for TARGET in $(SUB_DIRS); do \
-		$(MAKE) -s -C $$TARGET emit_tests; \
+		BUILD_TARGET=$$OUTPUT/$$TARGET;	\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
 	done;
 endef
 
 clean:
 	@for TARGET in $(SUB_DIRS); do \
-		$(MAKE) -C $$TARGET clean; \
-	done;
+		BUILD_TARGET=$$OUTPUT/$$TARGET;	\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ done;
 	rm -f tags
 
 tags:
diff --git a/tools/testing/selftests/powerpc/benchmarks/Makefile b/tools/testing/selftests/powerpc/benchmarks/Makefile
index 08a55bd..286c6ed 100644
--- a/tools/testing/selftests/powerpc/benchmarks/Makefile
+++ b/tools/testing/selftests/powerpc/benchmarks/Makefile
@@ -6,6 +6,6 @@ $(TEST_GEN_PROGS): ../harness.c
 
 include ../../lib.mk
 
-context_switch: ../utils.c
-context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
-context_switch: LDLIBS += -lpthread
+$(OUTPUT)/context_switch: ../utils.c
+$(OUTPUT)/context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
+$(OUTPUT)/context_switch: LDLIBS += -lpthread
diff --git a/tools/testing/selftests/powerpc/copyloops/Makefile b/tools/testing/selftests/powerpc/copyloops/Makefile
index 9ad1558..681ab19 100644
--- a/tools/testing/selftests/powerpc/copyloops/Makefile
+++ b/tools/testing/selftests/powerpc/copyloops/Makefile
@@ -12,9 +12,9 @@ EXTRA_SOURCES := validate.c ../harness.c
 
 include ../../lib.mk
 
-copyuser_64:     CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
-copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
-memcpy_64:       CPPFLAGS += -D COPY_LOOP=test_memcpy
-memcpy_power7:   CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
+$(OUTPUT)/copyuser_64:     CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
+$(OUTPUT)/copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
+$(OUTPUT)/memcpy_64:       CPPFLAGS += -D COPY_LOOP=test_memcpy
+$(OUTPUT)/memcpy_power7:   CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
 
 $(TEST_GEN_PROGS): $(EXTRA_SOURCES)
diff --git a/tools/testing/selftests/powerpc/dscr/Makefile b/tools/testing/selftests/powerpc/dscr/Makefile
index 4262de4..c5639de 100644
--- a/tools/testing/selftests/powerpc/dscr/Makefile
+++ b/tools/testing/selftests/powerpc/dscr/Makefile
@@ -4,6 +4,6 @@ TEST_GEN_PROGS := dscr_default_test dscr_explicit_test dscr_user_test	\
 
 include ../../lib.mk
 
-dscr_default_test: LDLIBS += -lpthread
+$(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
 
 $(TEST_GEN_PROGS): ../harness.c
diff --git a/tools/testing/selftests/powerpc/math/Makefile b/tools/testing/selftests/powerpc/math/Makefile
index 814c385..da9f42f 100644
--- a/tools/testing/selftests/powerpc/math/Makefile
+++ b/tools/testing/selftests/powerpc/math/Makefile
@@ -5,13 +5,13 @@ include ../../lib.mk
 $(TEST_GEN_PROGS): ../harness.c
 $(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
 
-fpu_syscall: fpu_asm.S
-fpu_preempt: fpu_asm.S
-fpu_signal:  fpu_asm.S
+$(OUTPUT)/pu_syscall: fpu_asm.S
+$(OUTPUT)/pu_preempt: fpu_asm.S
+$(OUTPUT)/pu_signal:  fpu_asm.S
 
-vmx_syscall: vmx_asm.S
-vmx_preempt: vmx_asm.S
-vmx_signal: vmx_asm.S
+$(OUTPUT)/mx_syscall: vmx_asm.S
+$(OUTPUT)/mx_preempt: vmx_asm.S
+$(OUTPUT)/mx_signal: vmx_asm.S
 
 vsx_preempt: CFLAGS += -mvsx
 vsx_preempt: vsx_asm.S
diff --git a/tools/testing/selftests/powerpc/mm/Makefile b/tools/testing/selftests/powerpc/mm/Makefile
index d563378..1cffe54 100644
--- a/tools/testing/selftests/powerpc/mm/Makefile
+++ b/tools/testing/selftests/powerpc/mm/Makefile
@@ -8,8 +8,8 @@ include ../../lib.mk
 
 $(TEST_GEN_PROGS): ../harness.c
 
-prot_sao: ../utils.c
+$(OUTPUT)/prot_sao: ../utils.c
 
-tempfile:
-	dd if=/dev/zero of=tempfile bs=64k count=1
+$(OUTPUT)/tempfile:
+	dd if=/dev/zero of=$@ bs=64k count=1
 
diff --git a/tools/testing/selftests/powerpc/pmu/Makefile b/tools/testing/selftests/powerpc/pmu/Makefile
index ab0f902..097b08a 100644
--- a/tools/testing/selftests/powerpc/pmu/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/Makefile
@@ -11,34 +11,34 @@ all: $(TEST_GEN_PROGS) ebb
 $(TEST_GEN_PROGS): $(EXTRA_SOURCES)
 
 # loop.S can only be built 64-bit
-count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
+$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
 	$(CC) $(CFLAGS) -m64 -o $@ $^
 
-per_event_excludes: ../utils.c
+$(OUTPUT)/per_event_excludes: ../utils.c
 
 DEFAULT_RUN_TESTS := $(RUN_TESTS)
 override define RUN_TESTS
 	$(DEFAULT_RUN_TESTS)
-	$(MAKE) -C ebb run_tests
+	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
 endef
 
 DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
 override define EMIT_TESTS
 	$(DEFAULT_EMIT_TESTS)
-	$(MAKE) -s -C ebb emit_tests
+	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
 endef
 
 DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
 override define INSTALL_RULE
 	$(DEFAULT_INSTALL_RULE)
-	$(MAKE) -C ebb install
+	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET: -C $$TARGET install
 endef
 
 clean:
-	$(RM) $(TEST_PROGS) loop.o
-	$(MAKE) -C ebb clean
+	$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
+	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET: -C $$TARGET clean
 
 ebb:
-	$(MAKE) -k -C $@ all
+	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
 
 .PHONY: all run_tests clean ebb
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/Makefile b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
index 0bc2bd6..6001fb0 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/Makefile
+++ b/tools/testing/selftests/powerpc/pmu/ebb/Makefile
@@ -21,6 +21,6 @@ include ../../../lib.mk
 $(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
 	       ebb.c ebb_handler.S trace.c busy_loop.S
 
-instruction_count_test: ../loop.S
+$(OUTPUT)/instruction_count_test: ../loop.S
 
-lost_exception_test: ../lib.c
+$(OUTPUT)/lost_exception_test: ../lib.c
diff --git a/tools/testing/selftests/powerpc/switch_endian/Makefile b/tools/testing/selftests/powerpc/switch_endian/Makefile
index dbd05ac..b92c2a1 100644
--- a/tools/testing/selftests/powerpc/switch_endian/Makefile
+++ b/tools/testing/selftests/powerpc/switch_endian/Makefile
@@ -2,14 +2,14 @@ TEST_GEN_PROGS := switch_endian_test
 
 ASFLAGS += -O2 -Wall -g -nostdlib -m64
 
-EXTRA_CLEAN = *.o check-reversed.S
+EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
 
 include ../../lib.mk
 
-switch_endian_test: check-reversed.S
+$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
 
-check-reversed.o: check.o
+$(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o
 	$(CROSS_COMPILE)objcopy -j .text --reverse-bytes=4 -O binary $< $@
 
-check-reversed.S: check-reversed.o
+$(OUTPUT)/check-reversed.S: $(OUTPUT)/check-reversed.o
 	hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile
index 117c624..07da217 100644
--- a/tools/testing/selftests/powerpc/tm/Makefile
+++ b/tools/testing/selftests/powerpc/tm/Makefile
@@ -10,9 +10,9 @@ $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
 CFLAGS += -mhtm
 
-tm-syscall: tm-syscall-asm.S
-tm-syscall: CFLAGS += -I../../../../../usr/include
-tm-tmspr: CFLAGS += -pthread
+$(OUTPUT)/tm-syscall: tm-syscall-asm.S
+$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
+$(OUTPUT)/tm-tmspr: CFLAGS += -pthread
 
 $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
 $(SIGNAL_CONTEXT_CHK_TESTS): CFLAGS += -mhtm -m64 -mvsx
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 8141d51..983140e 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -17,8 +17,8 @@ TEST_PROGS := run_vmtests
 
 include ../lib.mk
 
-userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h
-mlock-random-test: LDLIBS += -lcap
+$(OUTPUT)/userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h
+$(OUTPUT)/mlock-random-test: LDLIBS += -lcap
 
 ../../../../usr/include/linux/kernel.h:
 	make -C ../../../.. headers_install
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 8c1cb42..f251cf9 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -17,6 +17,9 @@ TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
 BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
 BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
 
+BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
+BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
+
 CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
 
 UNAME_M := $(shell uname -m)
@@ -40,10 +43,10 @@ all_64: $(BINARIES_64)
 clean:
 	$(RM) $(BINARIES_32) $(BINARIES_64)
 
-$(TARGETS_C_32BIT_ALL:%=%_32): %_32: %.c
+$(BINARIES_32): $(OUTPUT)/%_32: %.c
 	$(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm
 
-$(TARGETS_C_64BIT_ALL:%=%_64): %_64: %.c
+$(BINARIES_64): $(OUTPUT)/%_64: %.c
 	$(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
 
 # x86_64 users should be encouraged to install 32-bit libraries
@@ -65,12 +68,12 @@ warn_32bit_failure:
 endif
 
 # Some tests have additional dependencies.
-sysret_ss_attrs_64: thunks.S
-ptrace_syscall_32: raw_syscall_helper_32.S
-test_syscall_vdso_32: thunks_32.S
+$(OUTPUT)/sysret_ss_attrs_64: thunks.S
+$(OUTPUT)/ptrace_syscall_32: raw_syscall_helper_32.S
+$(OUTPUT)/test_syscall_vdso_32: thunks_32.S
 
 # check_initial_reg_state is special: it needs a custom entry, and it
 # needs to be static so that its interpreter doesn't destroy its initial
 # state.
-check_initial_reg_state_32: CFLAGS += -Wl,-ereal_start -static
-check_initial_reg_state_64: CFLAGS += -Wl,-ereal_start -static
+$(OUTPUT)/check_initial_reg_state_32: CFLAGS += -Wl,-ereal_start -static
+$(OUTPUT)/check_initial_reg_state_64: CFLAGS += -Wl,-ereal_start -static
-- 
2.10.0

[toc] | [prev] | [next] | [standalone]


#1533324

FromShuah Khan <shuahkh@osg.samsung.com>
Date2016-11-30 15:20 +0100
Message-ID<sJdTQ-7ci-1@gated-at.bofh.it>
In reply to#1532220
On 11/29/2016 04:55 AM, bamvor.zhangjian@huawei.com wrote:
> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
> 
> Here is my second version for enabling the KBUILD_OUTPUT for kselftest.
> The first version could be found here[1]. I fix and test all the TARGET
> in tools/testing/selftest/Makefile. For ppc, I test through fake target.
> 
> There are six patches in these series. And five of them clean up the
> existing code. I split the clean up patches into five, hope it is easy
> to review.
> 
>   selftests: remove duplicated all and clean target
>   selftests: remove useless TEST_DIRS
> a selftests: add pattern rules
> A selftests: remove CROSS_COMPILE in dedicated Makefile
> A selftests: add EXTRA_CLEAN for clean target
>   selftests: enable O and KBUILD_OUTPUT
> 
> Notes:
>   A: Ack by Michael.
>   a: ack by Michael. Minor update after rebase.

Bamovar/Michael,

Are these rebased to linux-next? Michael was concerned about
conflicts with powerpc tree. Would rebasing to linux-next help
avoiding conflicts?

Still looking to get them into 4.10 if possible.

thanks,
-- Shuah

> 
> In the first patch, I split the test files into two types:
> TEST_GEN_XXX means such file is generated during compiling. TEST_XXX
> means there is no need to compile before use. The main reason of this
> is the enablement of KBUILD_OUTPUT only need to care about TEST_GEN_XXX.
> I wanted to copy all the TEST_XXX with TEST_GEN_XXX, but I give up this
> idea in the end. Because people may puzzle why copy the file before
> installation.
> 
> Because of the introducing of TEST_GEN_XXX, I update the top-level
> Makefile and lib.mk selftests directory. After introduce TEST_GEN_XXX, I
> could remove all the unnecessary all and clean targets.
> 
> The second patch remove TEST_DIRS variable. And third patch add the
> pattern for compiling the c sourc code. The fourth patch remove the
> useless CROSS_COMPILE variable as it aleady exists in
> "tools/testing/selftests/lib.mk".
> 
> Further more, The fifth patch add the EXTRA_CLEAN variable to clean up
> the duplicated clean target
> 
> The last patch introduce the KBUILD_OUTPUT and O for kselftest instead
> using the existing kbuild system because user may compile kselftest
> directly (make -C tools/testing/selftests).
> 
> Changes:
> 1.  remove the useless *.o target in the following file suggested by
>     Michael:
>     tools/testing/selftests/powerpc/benchmarks/Makefile
>     tools/testing/selftests/powerpc/copyloops/Makefile
>     tools/testing/selftests/powerpc/dscr/Makefile
>     tools/testing/selftests/powerpc/math/Makefile
>     tools/testing/selftests/powerpc/primitives/Makefile
>     tools/testing/selftests/powerpc/stringloops/Makefile
>     tools/testing/selftests/powerpc/syscalls/Makefile
>     tools/testing/selftests/powerpc/tm/Makefile
> 
> 2.  remove the useless "all" and "clean" target in bpf and nsfs which
>     are added after my previous patch.
> 
> 3.  Improve the commit message.
> 
> [1] http://www.spinics.net/lists/linux-api/msg20789.html
> 
> Bamvor Jian Zhang (6):
>   selftests: remove duplicated all and clean target
>   selftests: remove useless TEST_DIRS
>   selftests: add default rules for c source file
>   selftests: remove CROSS_COMPILE in dedicated Makefile
>   selftests: add EXTRA_CLEAN for clean target
>   selftests: enable O and KBUILD_OUTPUT
> 
>  Documentation/kselftest.txt                        | 12 +++++++
>  tools/testing/selftests/Makefile                   | 36 ++++++++++++++-----
>  tools/testing/selftests/bpf/Makefile               | 10 ++----
>  tools/testing/selftests/breakpoints/Makefile       | 10 ++----
>  tools/testing/selftests/capabilities/Makefile      | 11 ++----
>  tools/testing/selftests/efivarfs/Makefile          |  8 +----
>  tools/testing/selftests/exec/Makefile              | 32 ++++++++---------
>  tools/testing/selftests/ftrace/Makefile            |  6 ++--
>  tools/testing/selftests/futex/Makefile             | 21 ++++++++---
>  tools/testing/selftests/futex/functional/Makefile  | 12 ++-----
>  tools/testing/selftests/ipc/Makefile               |  7 +---
>  tools/testing/selftests/kcmp/Makefile              |  6 ++--
>  tools/testing/selftests/lib.mk                     | 36 +++++++++++++++----
>  tools/testing/selftests/membarrier/Makefile        |  6 +---
>  tools/testing/selftests/memfd/Makefile             | 15 ++------
>  tools/testing/selftests/mount/Makefile             |  7 +---
>  tools/testing/selftests/mqueue/Makefile            |  6 +---
>  tools/testing/selftests/net/Makefile               | 15 +++-----
>  tools/testing/selftests/nsfs/Makefile              |  9 +----
>  tools/testing/selftests/powerpc/Makefile           | 15 ++++----
>  tools/testing/selftests/powerpc/alignment/Makefile |  9 ++---
>  .../testing/selftests/powerpc/benchmarks/Makefile  | 15 +++-----
>  .../selftests/powerpc/context_switch/Makefile      |  9 ++---
>  tools/testing/selftests/powerpc/copyloops/Makefile | 19 ++++------
>  tools/testing/selftests/powerpc/dscr/Makefile      | 13 +++----
>  tools/testing/selftests/powerpc/math/Makefile      | 25 ++++++-------
>  tools/testing/selftests/powerpc/mm/Makefile        | 18 ++++------
>  tools/testing/selftests/powerpc/pmu/Makefile       | 26 +++++++-------
>  tools/testing/selftests/powerpc/pmu/ebb/Makefile   | 15 +++-----
>  .../testing/selftests/powerpc/primitives/Makefile  |  9 ++---
>  .../testing/selftests/powerpc/stringloops/Makefile |  9 ++---
>  .../selftests/powerpc/switch_endian/Makefile       | 17 ++++-----
>  tools/testing/selftests/powerpc/syscalls/Makefile  |  9 ++---
>  tools/testing/selftests/powerpc/tm/Makefile        | 17 ++++-----
>  tools/testing/selftests/powerpc/vphn/Makefile      | 10 ++----
>  tools/testing/selftests/pstore/Makefile            |  4 +--
>  tools/testing/selftests/ptrace/Makefile            |  8 +----
>  tools/testing/selftests/seccomp/Makefile           |  6 +---
>  tools/testing/selftests/sigaltstack/Makefile       |  5 +--
>  tools/testing/selftests/size/Makefile              | 10 ++----
>  tools/testing/selftests/timers/Makefile            | 10 ++----
>  tools/testing/selftests/vm/Makefile                | 41 +++++++++-------------
>  tools/testing/selftests/x86/Makefile               | 17 +++++----
>  tools/testing/selftests/zram/Makefile              |  3 +-
>  44 files changed, 247 insertions(+), 357 deletions(-)
> 

[toc] | [prev] | [next] | [standalone]


#1533390

FromBamvor Zhang Jian <bamvor.zhangjian@linaro.org>
Date2016-11-30 16:40 +0100
Message-ID<sJf9f-7RM-13@gated-at.bofh.it>
In reply to#1533324
Hi, Shuah, Michael

On 30 November 2016 at 22:17, Shuah Khan <shuahkh@osg.samsung.com> wrote:
> On 11/29/2016 04:55 AM, bamvor.zhangjian@huawei.com wrote:
>> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>>
>> Here is my second version for enabling the KBUILD_OUTPUT for kselftest.
>> The first version could be found here[1]. I fix and test all the TARGET
>> in tools/testing/selftest/Makefile. For ppc, I test through fake target.
>>
>> There are six patches in these series. And five of them clean up the
>> existing code. I split the clean up patches into five, hope it is easy
>> to review.
>>
>>   selftests: remove duplicated all and clean target
>>   selftests: remove useless TEST_DIRS
>> a selftests: add pattern rules
>> A selftests: remove CROSS_COMPILE in dedicated Makefile
>> A selftests: add EXTRA_CLEAN for clean target
>>   selftests: enable O and KBUILD_OUTPUT
>>
>> Notes:
>>   A: Ack by Michael.
>>   a: ack by Michael. Minor update after rebase.
>
> Bamovar/Michael,
>
> Are these rebased to linux-next? Michael was concerned about
> conflicts with powerpc tree. Would rebasing to linux-next help
> avoiding conflicts?
Yes. I rebase to latest linux-next. It is taged as 1128 when I rebase
them yesterday. I fix some conflict when rebase.

Regards

Bamvor
>
> Still looking to get them into 4.10 if possible.

>
> thanks,
> -- Shuah
>
>>
>> In the first patch, I split the test files into two types:
>> TEST_GEN_XXX means such file is generated during compiling. TEST_XXX
>> means there is no need to compile before use. The main reason of this
>> is the enablement of KBUILD_OUTPUT only need to care about TEST_GEN_XXX.
>> I wanted to copy all the TEST_XXX with TEST_GEN_XXX, but I give up this
>> idea in the end. Because people may puzzle why copy the file before
>> installation.
>>
>> Because of the introducing of TEST_GEN_XXX, I update the top-level
>> Makefile and lib.mk selftests directory. After introduce TEST_GEN_XXX, I
>> could remove all the unnecessary all and clean targets.
>>
>> The second patch remove TEST_DIRS variable. And third patch add the
>> pattern for compiling the c sourc code. The fourth patch remove the
>> useless CROSS_COMPILE variable as it aleady exists in
>> "tools/testing/selftests/lib.mk".
>>
>> Further more, The fifth patch add the EXTRA_CLEAN variable to clean up
>> the duplicated clean target
>>
>> The last patch introduce the KBUILD_OUTPUT and O for kselftest instead
>> using the existing kbuild system because user may compile kselftest
>> directly (make -C tools/testing/selftests).
>>
>> Changes:
>> 1.  remove the useless *.o target in the following file suggested by
>>     Michael:
>>     tools/testing/selftests/powerpc/benchmarks/Makefile
>>     tools/testing/selftests/powerpc/copyloops/Makefile
>>     tools/testing/selftests/powerpc/dscr/Makefile
>>     tools/testing/selftests/powerpc/math/Makefile
>>     tools/testing/selftests/powerpc/primitives/Makefile
>>     tools/testing/selftests/powerpc/stringloops/Makefile
>>     tools/testing/selftests/powerpc/syscalls/Makefile
>>     tools/testing/selftests/powerpc/tm/Makefile
>>
>> 2.  remove the useless "all" and "clean" target in bpf and nsfs which
>>     are added after my previous patch.
>>
>> 3.  Improve the commit message.
>>
>> [1] http://www.spinics.net/lists/linux-api/msg20789.html
>>
>> Bamvor Jian Zhang (6):
>>   selftests: remove duplicated all and clean target
>>   selftests: remove useless TEST_DIRS
>>   selftests: add default rules for c source file
>>   selftests: remove CROSS_COMPILE in dedicated Makefile
>>   selftests: add EXTRA_CLEAN for clean target
>>   selftests: enable O and KBUILD_OUTPUT
>>
>>  Documentation/kselftest.txt                        | 12 +++++++
>>  tools/testing/selftests/Makefile                   | 36 ++++++++++++++-----
>>  tools/testing/selftests/bpf/Makefile               | 10 ++----
>>  tools/testing/selftests/breakpoints/Makefile       | 10 ++----
>>  tools/testing/selftests/capabilities/Makefile      | 11 ++----
>>  tools/testing/selftests/efivarfs/Makefile          |  8 +----
>>  tools/testing/selftests/exec/Makefile              | 32 ++++++++---------
>>  tools/testing/selftests/ftrace/Makefile            |  6 ++--
>>  tools/testing/selftests/futex/Makefile             | 21 ++++++++---
>>  tools/testing/selftests/futex/functional/Makefile  | 12 ++-----
>>  tools/testing/selftests/ipc/Makefile               |  7 +---
>>  tools/testing/selftests/kcmp/Makefile              |  6 ++--
>>  tools/testing/selftests/lib.mk                     | 36 +++++++++++++++----
>>  tools/testing/selftests/membarrier/Makefile        |  6 +---
>>  tools/testing/selftests/memfd/Makefile             | 15 ++------
>>  tools/testing/selftests/mount/Makefile             |  7 +---
>>  tools/testing/selftests/mqueue/Makefile            |  6 +---
>>  tools/testing/selftests/net/Makefile               | 15 +++-----
>>  tools/testing/selftests/nsfs/Makefile              |  9 +----
>>  tools/testing/selftests/powerpc/Makefile           | 15 ++++----
>>  tools/testing/selftests/powerpc/alignment/Makefile |  9 ++---
>>  .../testing/selftests/powerpc/benchmarks/Makefile  | 15 +++-----
>>  .../selftests/powerpc/context_switch/Makefile      |  9 ++---
>>  tools/testing/selftests/powerpc/copyloops/Makefile | 19 ++++------
>>  tools/testing/selftests/powerpc/dscr/Makefile      | 13 +++----
>>  tools/testing/selftests/powerpc/math/Makefile      | 25 ++++++-------
>>  tools/testing/selftests/powerpc/mm/Makefile        | 18 ++++------
>>  tools/testing/selftests/powerpc/pmu/Makefile       | 26 +++++++-------
>>  tools/testing/selftests/powerpc/pmu/ebb/Makefile   | 15 +++-----
>>  .../testing/selftests/powerpc/primitives/Makefile  |  9 ++---
>>  .../testing/selftests/powerpc/stringloops/Makefile |  9 ++---
>>  .../selftests/powerpc/switch_endian/Makefile       | 17 ++++-----
>>  tools/testing/selftests/powerpc/syscalls/Makefile  |  9 ++---
>>  tools/testing/selftests/powerpc/tm/Makefile        | 17 ++++-----
>>  tools/testing/selftests/powerpc/vphn/Makefile      | 10 ++----
>>  tools/testing/selftests/pstore/Makefile            |  4 +--
>>  tools/testing/selftests/ptrace/Makefile            |  8 +----
>>  tools/testing/selftests/seccomp/Makefile           |  6 +---
>>  tools/testing/selftests/sigaltstack/Makefile       |  5 +--
>>  tools/testing/selftests/size/Makefile              | 10 ++----
>>  tools/testing/selftests/timers/Makefile            | 10 ++----
>>  tools/testing/selftests/vm/Makefile                | 41 +++++++++-------------
>>  tools/testing/selftests/x86/Makefile               | 17 +++++----
>>  tools/testing/selftests/zram/Makefile              |  3 +-
>>  44 files changed, 247 insertions(+), 357 deletions(-)
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1534408

FromShuah Khan <shuahkh@osg.samsung.com>
Date2016-12-01 20:40 +0100
Message-ID<sJFn3-D4-1@gated-at.bofh.it>
In reply to#1533390
On 11/30/2016 08:32 AM, Bamvor Zhang Jian wrote:
> Hi, Shuah, Michael
> 
> On 30 November 2016 at 22:17, Shuah Khan <shuahkh@osg.samsung.com> wrote:
>> On 11/29/2016 04:55 AM, bamvor.zhangjian@huawei.com wrote:
>>> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>>>
>>> Here is my second version for enabling the KBUILD_OUTPUT for kselftest.
>>> The first version could be found here[1]. I fix and test all the TARGET
>>> in tools/testing/selftest/Makefile. For ppc, I test through fake target.
>>>
>>> There are six patches in these series. And five of them clean up the
>>> existing code. I split the clean up patches into five, hope it is easy
>>> to review.
>>>
>>>   selftests: remove duplicated all and clean target
>>>   selftests: remove useless TEST_DIRS
>>> a selftests: add pattern rules
>>> A selftests: remove CROSS_COMPILE in dedicated Makefile
>>> A selftests: add EXTRA_CLEAN for clean target
>>>   selftests: enable O and KBUILD_OUTPUT
>>>
>>> Notes:
>>>   A: Ack by Michael.
>>>   a: ack by Michael. Minor update after rebase.
>>
>> Bamovar/Michael,
>>
>> Are these rebased to linux-next? Michael was concerned about
>> conflicts with powerpc tree. Would rebasing to linux-next help
>> avoiding conflicts?
> Yes. I rebase to latest linux-next. It is taged as 1128 when I rebase
> them yesterday. I fix some conflict when rebase.
> 

Hi Bemovar,

These patches don't apply to linux-kselftest next and I can't apply
them now. Looks like there are new tests that came through a netdev
tree already in linux-next. It does happen when a new feature goes
into a tree with the test.

So for now we will have to wait on these and when 4.10-rc1 comes out,
please rebase it on linux-kselftest latest. I will try to get these
into 4.10-rc1 fixes

thanks,
-- Shuah

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web