All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-14 13:51 ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

	Hi all,
 
This patch series contains several build fixes and cleanups for issues I
encountered when trying to cross-build an rtctest binary in a separate
output directory (like I use for all my kernel builds).

Most patches are independent. Exceptions are:
  - Patch 3 depends on patch 2,
  - Patch 7 depends on patch 6,
  - Patch 11 depends on patches 2 and 3,

This has been tested with native (amd64):
  - make kselftest-build
  - make -C tools/testing/selftests
  - make O=/tmp/kselftest kselftest-build
  - make O=/tmp/kselftest -C tools/testing/selftests
and cross-builds (arm):
  - make kselftest-build (from a separate output directory).

Known remaining issues (not introduced by this patch series):
  - tools/lib/bpf fails to build in some cases (cfr.
    https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ@mail.gmail.com/),
  - tools/gpio is not always built correctly,
  - When building in a separate output directory, there are still files
    created in the source directory under:
        - arch/x86/include/generated/,
	- arch/x86/tools/,
	- include/generated/uapi/linux,
	- scripts (fixdep and unifdef),
  - Some tests may fail to find the installed header files,
  - There may be^H^H^H^H^H^Hare more.

Thanks for your comments!

Geert Uytterhoeven (12):
  selftests: gpio-mockup-chardev: Check asprintf() for error
  selftests: Fix output directory with O=
  selftests: Fix header install directory with O=
  selftests: android: ion: Fix ionmap_test dependencies
  selftests: seccomp: Fix test dependencies and rules
  selftests: lib.mk: Add rule to build object file from C source file
  selftests: memfd: Fix build with O=
  selftests: timestamping: Remove superfluous rules
  selftests: sparc64: Remove superfluous rules
  selftests: intel_pstate: Remove unused header dependency rule
  selftests: Add kselftest-build target
  [RFC] selftests: gpio: Fix building tools/gpio from kselftests

 Documentation/dev-tools/kselftest.rst             |  4 ++++
 Makefile                                          |  9 +++++++--
 tools/testing/selftests/android/ion/Makefile      |  6 +-----
 tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
 .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
 tools/testing/selftests/intel_pstate/Makefile     |  2 --
 tools/testing/selftests/lib.mk                    |  4 ++++
 tools/testing/selftests/memfd/Makefile            |  8 +++-----
 .../selftests/networking/timestamping/Makefile    |  5 -----
 tools/testing/selftests/seccomp/Makefile          | 15 +++------------
 tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
 11 files changed, 35 insertions(+), 43 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-14 13:51 ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


	Hi all,
 
This patch series contains several build fixes and cleanups for issues I
encountered when trying to cross-build an rtctest binary in a separate
output directory (like I use for all my kernel builds).

Most patches are independent. Exceptions are:
  - Patch 3 depends on patch 2,
  - Patch 7 depends on patch 6,
  - Patch 11 depends on patches 2 and 3,

This has been tested with native (amd64):
  - make kselftest-build
  - make -C tools/testing/selftests
  - make O=/tmp/kselftest kselftest-build
  - make O=/tmp/kselftest -C tools/testing/selftests
and cross-builds (arm):
  - make kselftest-build (from a separate output directory).

Known remaining issues (not introduced by this patch series):
  - tools/lib/bpf fails to build in some cases (cfr.
    https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ at mail.gmail.com/),
  - tools/gpio is not always built correctly,
  - When building in a separate output directory, there are still files
    created in the source directory under:
        - arch/x86/include/generated/,
	- arch/x86/tools/,
	- include/generated/uapi/linux,
	- scripts (fixdep and unifdef),
  - Some tests may fail to find the installed header files,
  - There may be^H^H^H^H^H^Hare more.

Thanks for your comments!

Geert Uytterhoeven (12):
  selftests: gpio-mockup-chardev: Check asprintf() for error
  selftests: Fix output directory with O=
  selftests: Fix header install directory with O=
  selftests: android: ion: Fix ionmap_test dependencies
  selftests: seccomp: Fix test dependencies and rules
  selftests: lib.mk: Add rule to build object file from C source file
  selftests: memfd: Fix build with O=
  selftests: timestamping: Remove superfluous rules
  selftests: sparc64: Remove superfluous rules
  selftests: intel_pstate: Remove unused header dependency rule
  selftests: Add kselftest-build target
  [RFC] selftests: gpio: Fix building tools/gpio from kselftests

 Documentation/dev-tools/kselftest.rst             |  4 ++++
 Makefile                                          |  9 +++++++--
 tools/testing/selftests/android/ion/Makefile      |  6 +-----
 tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
 .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
 tools/testing/selftests/intel_pstate/Makefile     |  2 --
 tools/testing/selftests/lib.mk                    |  4 ++++
 tools/testing/selftests/memfd/Makefile            |  8 +++-----
 .../selftests/networking/timestamping/Makefile    |  5 -----
 tools/testing/selftests/seccomp/Makefile          | 15 +++------------
 tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
 11 files changed, 35 insertions(+), 43 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-14 13:51 ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


	Hi all,
 
This patch series contains several build fixes and cleanups for issues I
encountered when trying to cross-build an rtctest binary in a separate
output directory (like I use for all my kernel builds).

Most patches are independent. Exceptions are:
  - Patch 3 depends on patch 2,
  - Patch 7 depends on patch 6,
  - Patch 11 depends on patches 2 and 3,

This has been tested with native (amd64):
  - make kselftest-build
  - make -C tools/testing/selftests
  - make O=/tmp/kselftest kselftest-build
  - make O=/tmp/kselftest -C tools/testing/selftests
and cross-builds (arm):
  - make kselftest-build (from a separate output directory).

Known remaining issues (not introduced by this patch series):
  - tools/lib/bpf fails to build in some cases (cfr.
    https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ at mail.gmail.com/),
  - tools/gpio is not always built correctly,
  - When building in a separate output directory, there are still files
    created in the source directory under:
        - arch/x86/include/generated/,
	- arch/x86/tools/,
	- include/generated/uapi/linux,
	- scripts (fixdep and unifdef),
  - Some tests may fail to find the installed header files,
  - There may be^H^H^H^H^H^Hare more.

Thanks for your comments!

Geert Uytterhoeven (12):
  selftests: gpio-mockup-chardev: Check asprintf() for error
  selftests: Fix output directory with O=
  selftests: Fix header install directory with O=
  selftests: android: ion: Fix ionmap_test dependencies
  selftests: seccomp: Fix test dependencies and rules
  selftests: lib.mk: Add rule to build object file from C source file
  selftests: memfd: Fix build with O=
  selftests: timestamping: Remove superfluous rules
  selftests: sparc64: Remove superfluous rules
  selftests: intel_pstate: Remove unused header dependency rule
  selftests: Add kselftest-build target
  [RFC] selftests: gpio: Fix building tools/gpio from kselftests

 Documentation/dev-tools/kselftest.rst             |  4 ++++
 Makefile                                          |  9 +++++++--
 tools/testing/selftests/android/ion/Makefile      |  6 +-----
 tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
 .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
 tools/testing/selftests/intel_pstate/Makefile     |  2 --
 tools/testing/selftests/lib.mk                    |  4 ++++
 tools/testing/selftests/memfd/Makefile            |  8 +++-----
 .../selftests/networking/timestamping/Makefile    |  5 -----
 tools/testing/selftests/seccomp/Makefile          | 15 +++------------
 tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
 11 files changed, 35 insertions(+), 43 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

With gcc 7.3.0:

    gpio-mockup-chardev.c: In function ‘get_debugfs’:
    gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
       asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Handle asprintf() failures to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
index f8d468f54e986dd0..aaa1e9f083c37215 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
@@ -37,7 +37,7 @@ static int get_debugfs(char **path)
 	struct libmnt_table *tb;
 	struct libmnt_iter *itr = NULL;
 	struct libmnt_fs *fs;
-	int found = 0;
+	int found = 0, ret;
 
 	cxt = mnt_new_context();
 	if (!cxt)
@@ -58,8 +58,11 @@ static int get_debugfs(char **path)
 			break;
 		}
 	}
-	if (found)
-		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+	if (found) {
+		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+		if (ret < 0)
+			err(EXIT_FAILURE, "failed to format string");
+	}
 
 	mnt_free_iter(itr);
 	mnt_free_context(cxt);
-- 
2.17.1


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

* [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


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

With gcc 7.3.0:

    gpio-mockup-chardev.c: In function ‘get_debugfs’:
    gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
       asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Handle asprintf() failures to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
index f8d468f54e986dd0..aaa1e9f083c37215 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
@@ -37,7 +37,7 @@ static int get_debugfs(char **path)
 	struct libmnt_table *tb;
 	struct libmnt_iter *itr = NULL;
 	struct libmnt_fs *fs;
-	int found = 0;
+	int found = 0, ret;
 
 	cxt = mnt_new_context();
 	if (!cxt)
@@ -58,8 +58,11 @@ static int get_debugfs(char **path)
 			break;
 		}
 	}
-	if (found)
-		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+	if (found) {
+		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+		if (ret < 0)
+			err(EXIT_FAILURE, "failed to format string");
+	}
 
 	mnt_free_iter(itr);
 	mnt_free_context(cxt);
-- 
2.17.1

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

* [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


With gcc 7.3.0:

    gpio-mockup-chardev.c: In function ‘get_debugfs’:
    gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
       asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Handle asprintf() failures to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
index f8d468f54e986dd0..aaa1e9f083c37215 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
@@ -37,7 +37,7 @@ static int get_debugfs(char **path)
 	struct libmnt_table *tb;
 	struct libmnt_iter *itr = NULL;
 	struct libmnt_fs *fs;
-	int found = 0;
+	int found = 0, ret;
 
 	cxt = mnt_new_context();
 	if (!cxt)
@@ -58,8 +58,11 @@ static int get_debugfs(char **path)
 			break;
 		}
 	}
-	if (found)
-		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+	if (found) {
+		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
+		if (ret < 0)
+			err(EXIT_FAILURE, "failed to format string");
+	}
 
 	mnt_free_iter(itr);
 	mnt_free_context(cxt);
-- 
2.17.1

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

* [PATCH 02/12] selftests: Fix output directory with O=
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When building kselftest in a separate output directory, the individual
test directories end up in the root of the output directory, instead of
under tools/testing/selftests/.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 088059312237b5d5..ed7c1ea324e97ac2 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,11 +1191,11 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-clean
 kselftest-clean:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-merge
 kselftest-merge:
-- 
2.17.1


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

* [PATCH 02/12] selftests: Fix output directory with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the individual
test directories end up in the root of the output directory, instead of
under tools/testing/selftests/.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 088059312237b5d5..ed7c1ea324e97ac2 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,11 +1191,11 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-clean
 kselftest-clean:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-merge
 kselftest-merge:
-- 
2.17.1

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

* [PATCH 02/12] selftests: Fix output directory with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the individual
test directories end up in the root of the output directory, instead of
under tools/testing/selftests/.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 088059312237b5d5..ed7c1ea324e97ac2 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,11 +1191,11 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-clean
 kselftest-clean:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
 
 PHONY += kselftest-merge
 kselftest-merge:
-- 
2.17.1

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

* [PATCH 03/12] selftests: Fix header install directory with O=
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When building kselftest in a separate output directory, the kernel
headers are still installed in the source directory, instead of in the
specified output directory.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ed7c1ea324e97ac2..5355033dda6ed1ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,7 +1191,7 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
 PHONY += kselftest-clean
 kselftest-clean:
-- 
2.17.1


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

* [PATCH 03/12] selftests: Fix header install directory with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the kernel
headers are still installed in the source directory, instead of in the
specified output directory.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ed7c1ea324e97ac2..5355033dda6ed1ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,7 +1191,7 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
 PHONY += kselftest-clean
 kselftest-clean:
-- 
2.17.1

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

* [PATCH 03/12] selftests: Fix header install directory with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the kernel
headers are still installed in the source directory, instead of in the
specified output directory.

Fix this by passing the expected path to the make subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ed7c1ea324e97ac2..5355033dda6ed1ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1191,7 +1191,7 @@ endif
 
 PHONY += kselftest
 kselftest:
-	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests)
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
 PHONY += kselftest-clean
 kselftest-clean:
-- 
2.17.1

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

* [PATCH 04/12] selftests: android: ion: Fix ionmap_test dependencies
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When building kselftest in a separate output directory:

    /tmp/cc44s4yX.o: In function `socket_send_fd':
    tools/testing/selftests/android/ion/ionutils.c:221: undefined reference to `sendtosocket'
    /tmp/cc44s4yX.o: In function `socket_receive_fd':
    tools/testing/selftests/android/ion/ionutils.c:243: undefined reference to `receivefromsocket'

The dependencies for the various test programs are expressed twice:
  1. Once using $(TEST_GEN_FILES), which supports building in the source
     directory only,
  2. A second time using $(OUTPUT), which supports building in either
     the source or build directory, but lacks a dependency of
     ionmap_test on ipcsocket, causing the link error above.

Fix this by:
  - Adding the missing dependency to 2,
  - Dropping superfluous rule 1.

Remove the "all" target while at it, as that is already handled by the
included lib.mk.

Fixes: ac93f7046a5371ff ("selftests: ion: Add simple test with the vgem driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/android/ion/Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile
index 88cfe88e466fb0e6..ce05c5f3594bcf87 100644
--- a/tools/testing/selftests/android/ion/Makefile
+++ b/tools/testing/selftests/android/ion/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): ipcsocket.c ionutils.c
-
 TEST_PROGS := ion_test.sh
 
 KSFT_KHDR_INSTALL := 1
@@ -16,4 +12,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
-$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ipcsocket.c ionutils.c
-- 
2.17.1


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

* [PATCH 04/12] selftests: android: ion: Fix ionmap_test dependencies
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory:

    /tmp/cc44s4yX.o: In function `socket_send_fd':
    tools/testing/selftests/android/ion/ionutils.c:221: undefined reference to `sendtosocket'
    /tmp/cc44s4yX.o: In function `socket_receive_fd':
    tools/testing/selftests/android/ion/ionutils.c:243: undefined reference to `receivefromsocket'

The dependencies for the various test programs are expressed twice:
  1. Once using $(TEST_GEN_FILES), which supports building in the source
     directory only,
  2. A second time using $(OUTPUT), which supports building in either
     the source or build directory, but lacks a dependency of
     ionmap_test on ipcsocket, causing the link error above.

Fix this by:
  - Adding the missing dependency to 2,
  - Dropping superfluous rule 1.

Remove the "all" target while at it, as that is already handled by the
included lib.mk.

Fixes: ac93f7046a5371ff ("selftests: ion: Add simple test with the vgem driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/android/ion/Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile
index 88cfe88e466fb0e6..ce05c5f3594bcf87 100644
--- a/tools/testing/selftests/android/ion/Makefile
+++ b/tools/testing/selftests/android/ion/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): ipcsocket.c ionutils.c
-
 TEST_PROGS := ion_test.sh
 
 KSFT_KHDR_INSTALL := 1
@@ -16,4 +12,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
-$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ipcsocket.c ionutils.c
-- 
2.17.1

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

* [PATCH 04/12] selftests: android: ion: Fix ionmap_test dependencies
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory:

    /tmp/cc44s4yX.o: In function `socket_send_fd':
    tools/testing/selftests/android/ion/ionutils.c:221: undefined reference to `sendtosocket'
    /tmp/cc44s4yX.o: In function `socket_receive_fd':
    tools/testing/selftests/android/ion/ionutils.c:243: undefined reference to `receivefromsocket'

The dependencies for the various test programs are expressed twice:
  1. Once using $(TEST_GEN_FILES), which supports building in the source
     directory only,
  2. A second time using $(OUTPUT), which supports building in either
     the source or build directory, but lacks a dependency of
     ionmap_test on ipcsocket, causing the link error above.

Fix this by:
  - Adding the missing dependency to 2,
  - Dropping superfluous rule 1.

Remove the "all" target while at it, as that is already handled by the
included lib.mk.

Fixes: ac93f7046a5371ff ("selftests: ion: Add simple test with the vgem driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/android/ion/Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile
index 88cfe88e466fb0e6..ce05c5f3594bcf87 100644
--- a/tools/testing/selftests/android/ion/Makefile
+++ b/tools/testing/selftests/android/ion/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := ionapp_export ionapp_import ionmap_test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): ipcsocket.c ionutils.c
-
 TEST_PROGS := ion_test.sh
 
 KSFT_KHDR_INSTALL := 1
@@ -16,4 +12,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
-$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ipcsocket.c ionutils.c
-- 
2.17.1

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

* [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When building kselftest in a separate output directory, the seccomp_bpf
binary ends up in the source directory instead of in the output
directory, and the build of seccomp_benchmark fails:

    make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.

Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
the build support from lib.mk properly.

Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/seccomp/Makefile | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index fce7f4ce069251a6..c728bd7a366f78b9 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-all:
 
-include ../lib.mk
-
-.PHONY: all clean
-
-BINARIES := seccomp_bpf seccomp_benchmark
 CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
 
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
-	$(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
+TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark
 
-TEST_PROGS += $(BINARIES)
-EXTRA_CLEAN := $(BINARIES)
-
-all: $(BINARIES)
+include ../lib.mk
-- 
2.17.1


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

* [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the seccomp_bpf
binary ends up in the source directory instead of in the output
directory, and the build of seccomp_benchmark fails:

    make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.

Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
the build support from lib.mk properly.

Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/seccomp/Makefile | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index fce7f4ce069251a6..c728bd7a366f78b9 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-all:
 
-include ../lib.mk
-
-.PHONY: all clean
-
-BINARIES := seccomp_bpf seccomp_benchmark
 CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
 
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
-	$(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
+TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark
 
-TEST_PROGS += $(BINARIES)
-EXTRA_CLEAN := $(BINARIES)
-
-all: $(BINARIES)
+include ../lib.mk
-- 
2.17.1

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

* [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory, the seccomp_bpf
binary ends up in the source directory instead of in the output
directory, and the build of seccomp_benchmark fails:

    make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.

Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
the build support from lib.mk properly.

Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/seccomp/Makefile | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index fce7f4ce069251a6..c728bd7a366f78b9 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-all:
 
-include ../lib.mk
-
-.PHONY: all clean
-
-BINARIES := seccomp_bpf seccomp_benchmark
 CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
 
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
-	$(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
+TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark
 
-TEST_PROGS += $(BINARIES)
-EXTRA_CLEAN := $(BINARIES)
-
-all: $(BINARIES)
+include ../lib.mk
-- 
2.17.1

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

* [PATCH 06/12] selftests: lib.mk: Add rule to build object file from C source file
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

Currently there are rules to compile and link one or more C or
assembler source files into a full executable, and to assemble a single
assembler source into an object file.

Add a generic rule to compile a single C source file into an object
file, for reuse of object files in multiple executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/lib.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 8b0f16409ed7eb53..77a71264d8c5a743 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -141,6 +141,7 @@ clean:
 #
 ifneq ($(KBUILD_SRC),)
 LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
+COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 endif
@@ -151,6 +152,9 @@ ifeq ($(OVERRIDE_TARGETS),)
 $(OUTPUT)/%:%.c
 	$(LINK.c) $^ $(LDLIBS) -o $@
 
+$(OUTPUT)/%.o:%.c
+	$(COMPILE.c) $^ -o $@
+
 $(OUTPUT)/%.o:%.S
 	$(COMPILE.S) $^ -o $@
 
-- 
2.17.1


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

* [PATCH 06/12] selftests: lib.mk: Add rule to build object file from C source file
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


Currently there are rules to compile and link one or more C or
assembler source files into a full executable, and to assemble a single
assembler source into an object file.

Add a generic rule to compile a single C source file into an object
file, for reuse of object files in multiple executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/lib.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 8b0f16409ed7eb53..77a71264d8c5a743 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -141,6 +141,7 @@ clean:
 #
 ifneq ($(KBUILD_SRC),)
 LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
+COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 endif
@@ -151,6 +152,9 @@ ifeq ($(OVERRIDE_TARGETS),)
 $(OUTPUT)/%:%.c
 	$(LINK.c) $^ $(LDLIBS) -o $@
 
+$(OUTPUT)/%.o:%.c
+	$(COMPILE.c) $^ -o $@
+
 $(OUTPUT)/%.o:%.S
 	$(COMPILE.S) $^ -o $@
 
-- 
2.17.1

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

* [PATCH 06/12] selftests: lib.mk: Add rule to build object file from C source file
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


Currently there are rules to compile and link one or more C or
assembler source files into a full executable, and to assemble a single
assembler source into an object file.

Add a generic rule to compile a single C source file into an object
file, for reuse of object files in multiple executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/lib.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 8b0f16409ed7eb53..77a71264d8c5a743 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -141,6 +141,7 @@ clean:
 #
 ifneq ($(KBUILD_SRC),)
 LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
+COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 COMPILE.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
 LINK.S = $(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
 endif
@@ -151,6 +152,9 @@ ifeq ($(OVERRIDE_TARGETS),)
 $(OUTPUT)/%:%.c
 	$(LINK.c) $^ $(LDLIBS) -o $@
 
+$(OUTPUT)/%.o:%.c
+	$(COMPILE.c) $^ -o $@
+
 $(OUTPUT)/%.o:%.S
 	$(COMPILE.S) $^ -o $@
 
-- 
2.17.1

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

* [PATCH 07/12] selftests: memfd: Fix build with O=
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When building kselftest in a separate output directory:

    make[3]: *** No rule to make target 'common.o', needed by '/tmp/kselftest/memfd/memfd_test'.  Stop.

Fix this by explicitly listing common.o (in the output tree) in the
build targets (allowing the EXTRA_CLEAN rule to be dropped), and
updating the dependencies of the final executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/memfd/Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 53a848109f7bbbd0..f3e988e54ec81083 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,7 +6,7 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := memfd_test
 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
-TEST_GEN_FILES := fuse_mnt fuse_test
+TEST_GEN_FILES := fuse_mnt fuse_test common.o
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
 
@@ -14,7 +14,5 @@ include ../lib.mk
 
 $(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
-$(OUTPUT)/memfd_test: memfd_test.c common.o
-$(OUTPUT)/fuse_test: fuse_test.c common.o
-
-EXTRA_CLEAN = common.o
+$(OUTPUT)/memfd_test: memfd_test.c $(OUTPUT)/common.o
+$(OUTPUT)/fuse_test: fuse_test.c $(OUTPUT)/common.o
-- 
2.17.1


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

* [PATCH 07/12] selftests: memfd: Fix build with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory:

    make[3]: *** No rule to make target 'common.o', needed by '/tmp/kselftest/memfd/memfd_test'.  Stop.

Fix this by explicitly listing common.o (in the output tree) in the
build targets (allowing the EXTRA_CLEAN rule to be dropped), and
updating the dependencies of the final executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/memfd/Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 53a848109f7bbbd0..f3e988e54ec81083 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,7 +6,7 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := memfd_test
 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
-TEST_GEN_FILES := fuse_mnt fuse_test
+TEST_GEN_FILES := fuse_mnt fuse_test common.o
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
 
@@ -14,7 +14,5 @@ include ../lib.mk
 
 $(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
-$(OUTPUT)/memfd_test: memfd_test.c common.o
-$(OUTPUT)/fuse_test: fuse_test.c common.o
-
-EXTRA_CLEAN = common.o
+$(OUTPUT)/memfd_test: memfd_test.c $(OUTPUT)/common.o
+$(OUTPUT)/fuse_test: fuse_test.c $(OUTPUT)/common.o
-- 
2.17.1

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

* [PATCH 07/12] selftests: memfd: Fix build with O=
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When building kselftest in a separate output directory:

    make[3]: *** No rule to make target 'common.o', needed by '/tmp/kselftest/memfd/memfd_test'.  Stop.

Fix this by explicitly listing common.o (in the output tree) in the
build targets (allowing the EXTRA_CLEAN rule to be dropped), and
updating the dependencies of the final executables.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/memfd/Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 53a848109f7bbbd0..f3e988e54ec81083 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,7 +6,7 @@ CFLAGS += -I../../../../usr/include/
 
 TEST_GEN_PROGS := memfd_test
 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
-TEST_GEN_FILES := fuse_mnt fuse_test
+TEST_GEN_FILES := fuse_mnt fuse_test common.o
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
 
@@ -14,7 +14,5 @@ include ../lib.mk
 
 $(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
-$(OUTPUT)/memfd_test: memfd_test.c common.o
-$(OUTPUT)/fuse_test: fuse_test.c common.o
-
-EXTRA_CLEAN = common.o
+$(OUTPUT)/memfd_test: memfd_test.c $(OUTPUT)/common.o
+$(OUTPUT)/fuse_test: fuse_test.c $(OUTPUT)/common.o
-- 
2.17.1

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

* [PATCH 08/12] selftests: timestamping: Remove superfluous rules
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

    Makefile:14: warning: overriding recipe for target 'clean'
    ../../lib.mk:137: warning: ignoring old recipe for target 'clean'

"all" and "clean" are already handled by the included lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/networking/timestamping/Makefile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile
index 9050eeea5f5f2953..49ede79660c0208d 100644
--- a/tools/testing/selftests/networking/timestamping/Makefile
+++ b/tools/testing/selftests/networking/timestamping/Makefile
@@ -4,11 +4,6 @@ CFLAGS += -I../../../../../usr/include
 TEST_GEN_FILES := hwtstamp_config rxtimestamp timestamping txtimestamp
 TEST_PROGS := txtimestamp.sh
 
-all: $(TEST_PROGS)
-
 top_srcdir = ../../../../..
 KSFT_KHDR_INSTALL := 1
 include ../../lib.mk
-
-clean:
-	rm -fr $(TEST_GEN_FILES)
-- 
2.17.1


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

* [PATCH 08/12] selftests: timestamping: Remove superfluous rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


    Makefile:14: warning: overriding recipe for target 'clean'
    ../../lib.mk:137: warning: ignoring old recipe for target 'clean'

"all" and "clean" are already handled by the included lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/networking/timestamping/Makefile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile
index 9050eeea5f5f2953..49ede79660c0208d 100644
--- a/tools/testing/selftests/networking/timestamping/Makefile
+++ b/tools/testing/selftests/networking/timestamping/Makefile
@@ -4,11 +4,6 @@ CFLAGS += -I../../../../../usr/include
 TEST_GEN_FILES := hwtstamp_config rxtimestamp timestamping txtimestamp
 TEST_PROGS := txtimestamp.sh
 
-all: $(TEST_PROGS)
-
 top_srcdir = ../../../../..
 KSFT_KHDR_INSTALL := 1
 include ../../lib.mk
-
-clean:
-	rm -fr $(TEST_GEN_FILES)
-- 
2.17.1

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

* [PATCH 08/12] selftests: timestamping: Remove superfluous rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


    Makefile:14: warning: overriding recipe for target 'clean'
    ../../lib.mk:137: warning: ignoring old recipe for target 'clean'

"all" and "clean" are already handled by the included lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/networking/timestamping/Makefile | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile
index 9050eeea5f5f2953..49ede79660c0208d 100644
--- a/tools/testing/selftests/networking/timestamping/Makefile
+++ b/tools/testing/selftests/networking/timestamping/Makefile
@@ -4,11 +4,6 @@ CFLAGS += -I../../../../../usr/include
 TEST_GEN_FILES := hwtstamp_config rxtimestamp timestamping txtimestamp
 TEST_PROGS := txtimestamp.sh
 
-all: $(TEST_PROGS)
-
 top_srcdir = ../../../../..
 KSFT_KHDR_INSTALL := 1
 include ../../lib.mk
-
-clean:
-	rm -fr $(TEST_GEN_FILES)
-- 
2.17.1

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

* [PATCH 09/12] selftests: sparc64: Remove superfluous rules
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

"all" and the generic %.c dependency are already handled by the included
lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/sparc64/drivers/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/testing/selftests/sparc64/drivers/Makefile b/tools/testing/selftests/sparc64/drivers/Makefile
index deb0df4155659ec1..174dbd675f1f8264 100644
--- a/tools/testing/selftests/sparc64/drivers/Makefile
+++ b/tools/testing/selftests/sparc64/drivers/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := adi-test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): adi-test.c
-
 TEST_PROGS := drivers_test.sh
 
 include ../../lib.mk
-- 
2.17.1


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

* [PATCH 09/12] selftests: sparc64: Remove superfluous rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


"all" and the generic %.c dependency are already handled by the included
lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/sparc64/drivers/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/testing/selftests/sparc64/drivers/Makefile b/tools/testing/selftests/sparc64/drivers/Makefile
index deb0df4155659ec1..174dbd675f1f8264 100644
--- a/tools/testing/selftests/sparc64/drivers/Makefile
+++ b/tools/testing/selftests/sparc64/drivers/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := adi-test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): adi-test.c
-
 TEST_PROGS := drivers_test.sh
 
 include ../../lib.mk
-- 
2.17.1

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

* [PATCH 09/12] selftests: sparc64: Remove superfluous rules
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


"all" and the generic %.c dependency are already handled by the included
lib.mk.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/sparc64/drivers/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/testing/selftests/sparc64/drivers/Makefile b/tools/testing/selftests/sparc64/drivers/Makefile
index deb0df4155659ec1..174dbd675f1f8264 100644
--- a/tools/testing/selftests/sparc64/drivers/Makefile
+++ b/tools/testing/selftests/sparc64/drivers/Makefile
@@ -4,10 +4,6 @@ CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g
 
 TEST_GEN_FILES := adi-test
 
-all: $(TEST_GEN_FILES)
-
-$(TEST_GEN_FILES): adi-test.c
-
 TEST_PROGS := drivers_test.sh
 
 include ../../lib.mk
-- 
2.17.1

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

* [PATCH 10/12] selftests: intel_pstate: Remove unused header dependency rule
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

The intel_pstate test doesn't contain any header files, so there is no
need to declare a rule for header dependencies.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 tools/testing/selftests/intel_pstate/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 7340fd6a9a9f2cbd..3f51f9226286f661 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -12,5 +12,3 @@ endif
 TEST_PROGS := run.sh
 
 include ../lib.mk
-
-$(TEST_GEN_FILES): $(HEADERS)
-- 
2.17.1


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

* [PATCH 10/12] selftests: intel_pstate: Remove unused header dependency rule
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


The intel_pstate test doesn't contain any header files, so there is no
need to declare a rule for header dependencies.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/intel_pstate/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 7340fd6a9a9f2cbd..3f51f9226286f661 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -12,5 +12,3 @@ endif
 TEST_PROGS := run.sh
 
 include ../lib.mk
-
-$(TEST_GEN_FILES): $(HEADERS)
-- 
2.17.1

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

* [PATCH 10/12] selftests: intel_pstate: Remove unused header dependency rule
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


The intel_pstate test doesn't contain any header files, so there is no
need to declare a rule for header dependencies.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
 tools/testing/selftests/intel_pstate/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 7340fd6a9a9f2cbd..3f51f9226286f661 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -12,5 +12,3 @@ endif
 TEST_PROGS := run.sh
 
 include ../lib.mk
-
-$(TEST_GEN_FILES): $(HEADERS)
-- 
2.17.1

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

* [PATCH 11/12] selftests: Add kselftest-build target
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

The documented way to build kselftest is to run

    make -C tools/testing/selftests

with an optional "O=..." parameter to specify the output directory.

However, all of the above assume you run make from the source directory.
while other make commands can simply be run from the output directory,
too (the autogenerated Makefile in the output directory takes care of
this).

Add a "kselftest-build" target, so "make kselftest-build" can be used
from either the source or output directory.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Perhaps this make target should just be called "kselftest", and the
existing "kselftest" target be renamed to "kselftest-run"?
---
 Documentation/dev-tools/kselftest.rst | 4 ++++
 Makefile                              | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 7756f7a7c23b9408..b90b4ee6334a0941 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -21,6 +21,10 @@ To build the tests::
 
   $ make -C tools/testing/selftests
 
+Or:
+
+  $ make kselftest-build
+
 To run the tests::
 
   $ make -C tools/testing/selftests run_tests
diff --git a/Makefile b/Makefile
index 5355033dda6ed1ea..27a56de7ed45091e 100644
--- a/Makefile
+++ b/Makefile
@@ -1193,6 +1193,10 @@ PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
+PHONY += kselftest-build
+kselftest-build:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
+
 PHONY += kselftest-clean
 kselftest-clean:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
@@ -1445,6 +1449,7 @@ help:
 	@echo  '  kselftest       - Build and run kernel selftest (run as root)'
 	@echo  '                    Build, install, and boot kernel before'
 	@echo  '                    running kselftest on it'
+	@echo  '  kselftest-build - Build kselftest files'
 	@echo  '  kselftest-clean - Remove all generated kselftest files'
 	@echo  '  kselftest-merge - Merge all the config dependencies of kselftest to existing'
 	@echo  '                    .config.'
-- 
2.17.1


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

* [PATCH 11/12] selftests: Add kselftest-build target
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


The documented way to build kselftest is to run

    make -C tools/testing/selftests

with an optional "O=..." parameter to specify the output directory.

However, all of the above assume you run make from the source directory.
while other make commands can simply be run from the output directory,
too (the autogenerated Makefile in the output directory takes care of
this).

Add a "kselftest-build" target, so "make kselftest-build" can be used
from either the source or output directory.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
Perhaps this make target should just be called "kselftest", and the
existing "kselftest" target be renamed to "kselftest-run"?
---
 Documentation/dev-tools/kselftest.rst | 4 ++++
 Makefile                              | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 7756f7a7c23b9408..b90b4ee6334a0941 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -21,6 +21,10 @@ To build the tests::
 
   $ make -C tools/testing/selftests
 
+Or:
+
+  $ make kselftest-build
+
 To run the tests::
 
   $ make -C tools/testing/selftests run_tests
diff --git a/Makefile b/Makefile
index 5355033dda6ed1ea..27a56de7ed45091e 100644
--- a/Makefile
+++ b/Makefile
@@ -1193,6 +1193,10 @@ PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
+PHONY += kselftest-build
+kselftest-build:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
+
 PHONY += kselftest-clean
 kselftest-clean:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
@@ -1445,6 +1449,7 @@ help:
 	@echo  '  kselftest       - Build and run kernel selftest (run as root)'
 	@echo  '                    Build, install, and boot kernel before'
 	@echo  '                    running kselftest on it'
+	@echo  '  kselftest-build - Build kselftest files'
 	@echo  '  kselftest-clean - Remove all generated kselftest files'
 	@echo  '  kselftest-merge - Merge all the config dependencies of kselftest to existing'
 	@echo  '                    .config.'
-- 
2.17.1

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

* [PATCH 11/12] selftests: Add kselftest-build target
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


The documented way to build kselftest is to run

    make -C tools/testing/selftests

with an optional "O=..." parameter to specify the output directory.

However, all of the above assume you run make from the source directory.
while other make commands can simply be run from the output directory,
too (the autogenerated Makefile in the output directory takes care of
this).

Add a "kselftest-build" target, so "make kselftest-build" can be used
from either the source or output directory.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
Perhaps this make target should just be called "kselftest", and the
existing "kselftest" target be renamed to "kselftest-run"?
---
 Documentation/dev-tools/kselftest.rst | 4 ++++
 Makefile                              | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 7756f7a7c23b9408..b90b4ee6334a0941 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -21,6 +21,10 @@ To build the tests::
 
   $ make -C tools/testing/selftests
 
+Or:
+
+  $ make kselftest-build
+
 To run the tests::
 
   $ make -C tools/testing/selftests run_tests
diff --git a/Makefile b/Makefile
index 5355033dda6ed1ea..27a56de7ed45091e 100644
--- a/Makefile
+++ b/Makefile
@@ -1193,6 +1193,10 @@ PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
 
+PHONY += kselftest-build
+kselftest-build:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests O=$(abspath $(objtree)/tools/testing/selftests) INSTALL_HDR_PATH=$(abspath $(INSTALL_HDR_PATH))
+
 PHONY += kselftest-clean
 kselftest-clean:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean O=$(abspath $(objtree)/tools/testing/selftests)
@@ -1445,6 +1449,7 @@ help:
 	@echo  '  kselftest       - Build and run kernel selftest (run as root)'
 	@echo  '                    Build, install, and boot kernel before'
 	@echo  '                    running kselftest on it'
+	@echo  '  kselftest-build - Build kselftest files'
 	@echo  '  kselftest-clean - Remove all generated kselftest files'
 	@echo  '  kselftest-merge - Merge all the config dependencies of kselftest to existing'
 	@echo  '                    .config.'
-- 
2.17.1

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

* [PATCH/RFC 12/12] selftests: gpio: Fix building tools/gpio from kselftests
  2019-01-14 13:51 ` geert+renesas
  (?)
@ 2019-01-14 13:51   ` geert+renesas
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)
  To: Shuah Khan, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, Geert Uytterhoeven

When running "make kselftests":

    make[3]: Entering directory 'tools/gpio'
    Makefile:24: tools/build/Makefile.include: No such file or directory
    make[3]: *** No rule to make target 'tools/build/Makefile.include'.  Stop.

When building kselftest in a separate output directory, the gpio tools
are still built in the source directory.

Fix this by passing the correct source and build paths to the make
subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Marked RFC as there are still issues with this approach:

  - "make kselftest O=" needs:

	all: $(TEST_PROGS_EXTENDED)

    "make kselftest" needs that line to be replaced by:

	TEST_GEN_PROGS_EXTENDED := $(TEST_PROGS_EXTENDED)

    Having both lines doesn't help.

  - gpio-mockup-chardev is no longer built.
---
 tools/testing/selftests/gpio/Makefile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 0bb80619db580af1..1eb4304fcfcbad67 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -13,20 +13,22 @@ TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh
 TEST_PROGS_EXTENDED := gpio-mockup-chardev
 
-GPIODIR := $(realpath ../../../gpio)
+GPIOSRCDIR := $(abspath $(CURDIR)/../../../gpio)
+GPIOOBJDIR := $(abspath $(OUTPUT)/../../../gpio)
 GPIOOBJ := gpio-utils.o
 
 all: $(TEST_PROGS_EXTENDED)
 
 override define CLEAN
 	$(RM) $(TEST_PROGS_EXTENDED)
-	$(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
+	$(MAKE) -C $(GPIOSRCDIR) OUTPUT=$(GPIOOBJDIR)/ clean
 endef
 
 KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
-$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
+$(TEST_PROGS_EXTENDED): $(GPIOOBJDIR)/$(GPIOOBJ)
 
-$(GPIODIR)/$(GPIOOBJ):
-	$(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)
+$(GPIOOBJDIR)/$(GPIOOBJ):
+	mkdir -p $(GPIOOBJDIR)
+	$(MAKE) OUTPUT=$(GPIOOBJDIR)/ -C $(GPIOSRCDIR)
-- 
2.17.1


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

* [PATCH/RFC 12/12] selftests: gpio: Fix building tools/gpio from kselftests
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: geert+renesas @ 2019-01-14 13:51 UTC (permalink / raw)


When running "make kselftests":

    make[3]: Entering directory 'tools/gpio'
    Makefile:24: tools/build/Makefile.include: No such file or directory
    make[3]: *** No rule to make target 'tools/build/Makefile.include'.  Stop.

When building kselftest in a separate output directory, the gpio tools
are still built in the source directory.

Fix this by passing the correct source and build paths to the make
subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
Marked RFC as there are still issues with this approach:

  - "make kselftest O=" needs:

	all: $(TEST_PROGS_EXTENDED)

    "make kselftest" needs that line to be replaced by:

	TEST_GEN_PROGS_EXTENDED := $(TEST_PROGS_EXTENDED)

    Having both lines doesn't help.

  - gpio-mockup-chardev is no longer built.
---
 tools/testing/selftests/gpio/Makefile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 0bb80619db580af1..1eb4304fcfcbad67 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -13,20 +13,22 @@ TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh
 TEST_PROGS_EXTENDED := gpio-mockup-chardev
 
-GPIODIR := $(realpath ../../../gpio)
+GPIOSRCDIR := $(abspath $(CURDIR)/../../../gpio)
+GPIOOBJDIR := $(abspath $(OUTPUT)/../../../gpio)
 GPIOOBJ := gpio-utils.o
 
 all: $(TEST_PROGS_EXTENDED)
 
 override define CLEAN
 	$(RM) $(TEST_PROGS_EXTENDED)
-	$(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
+	$(MAKE) -C $(GPIOSRCDIR) OUTPUT=$(GPIOOBJDIR)/ clean
 endef
 
 KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
-$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
+$(TEST_PROGS_EXTENDED): $(GPIOOBJDIR)/$(GPIOOBJ)
 
-$(GPIODIR)/$(GPIOOBJ):
-	$(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)
+$(GPIOOBJDIR)/$(GPIOOBJ):
+	mkdir -p $(GPIOOBJDIR)
+	$(MAKE) OUTPUT=$(GPIOOBJDIR)/ -C $(GPIOSRCDIR)
-- 
2.17.1

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

* [PATCH/RFC 12/12] selftests: gpio: Fix building tools/gpio from kselftests
@ 2019-01-14 13:51   ` geert+renesas
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-14 13:51 UTC (permalink / raw)


When running "make kselftests":

    make[3]: Entering directory 'tools/gpio'
    Makefile:24: tools/build/Makefile.include: No such file or directory
    make[3]: *** No rule to make target 'tools/build/Makefile.include'.  Stop.

When building kselftest in a separate output directory, the gpio tools
are still built in the source directory.

Fix this by passing the correct source and build paths to the make
subprocess.

Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
Marked RFC as there are still issues with this approach:

  - "make kselftest O=" needs:

	all: $(TEST_PROGS_EXTENDED)

    "make kselftest" needs that line to be replaced by:

	TEST_GEN_PROGS_EXTENDED := $(TEST_PROGS_EXTENDED)

    Having both lines doesn't help.

  - gpio-mockup-chardev is no longer built.
---
 tools/testing/selftests/gpio/Makefile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 0bb80619db580af1..1eb4304fcfcbad67 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -13,20 +13,22 @@ TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh
 TEST_PROGS_EXTENDED := gpio-mockup-chardev
 
-GPIODIR := $(realpath ../../../gpio)
+GPIOSRCDIR := $(abspath $(CURDIR)/../../../gpio)
+GPIOOBJDIR := $(abspath $(OUTPUT)/../../../gpio)
 GPIOOBJ := gpio-utils.o
 
 all: $(TEST_PROGS_EXTENDED)
 
 override define CLEAN
 	$(RM) $(TEST_PROGS_EXTENDED)
-	$(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
+	$(MAKE) -C $(GPIOSRCDIR) OUTPUT=$(GPIOOBJDIR)/ clean
 endef
 
 KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
-$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
+$(TEST_PROGS_EXTENDED): $(GPIOOBJDIR)/$(GPIOOBJ)
 
-$(GPIODIR)/$(GPIOOBJ):
-	$(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)
+$(GPIOOBJDIR)/$(GPIOOBJ):
+	mkdir -p $(GPIOOBJDIR)
+	$(MAKE) OUTPUT=$(GPIOOBJDIR)/ -C $(GPIOSRCDIR)
-- 
2.17.1

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

* Re: [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
  2019-01-14 13:51   ` geert+renesas
  (?)
  (?)
@ 2019-01-14 23:16     ` keescook
  -1 siblings, 0 replies; 54+ messages in thread
From: Kees Cook @ 2019-01-14 23:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Shuah Khan, Masahiro Yamada, Michal Marek, Jonathan Corbet,
	Bamvor Jian Zhang, open list:KERNEL SELFTEST FRAMEWORK,
	linux-kbuild, LKML

On Mon, Jan 14, 2019 at 5:51 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> When building kselftest in a separate output directory, the seccomp_bpf
> binary ends up in the source directory instead of in the output
> directory, and the build of seccomp_benchmark fails:
>
>     make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.
>
> Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
> the build support from lib.mk properly.
>
> Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  tools/testing/selftests/seccomp/Makefile | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index fce7f4ce069251a6..c728bd7a366f78b9 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
> -all:
>
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
>  CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> -       $(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
> +TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark

This breaks the dep on ../kselftest_harness.h. Changes go unnoticed if
this is changed:

$ touch tools/testing/selftests/kselftest_harness.h
$ make O=/tmp/kselftest -C tools/testing/selftests
...
make[1]: Entering directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
...

>
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> -
> -all: $(BINARIES)
> +include ../lib.mk
> --
> 2.17.1
>


-- 
Kees Cook

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

* [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
@ 2019-01-14 23:16     ` keescook
  0 siblings, 0 replies; 54+ messages in thread
From: keescook @ 2019-01-14 23:16 UTC (permalink / raw)


On Mon, Jan 14, 2019 at 5:51 AM Geert Uytterhoeven
<geert+renesas at glider.be> wrote:
>
> When building kselftest in a separate output directory, the seccomp_bpf
> binary ends up in the source directory instead of in the output
> directory, and the build of seccomp_benchmark fails:
>
>     make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.
>
> Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
> the build support from lib.mk properly.
>
> Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
> ---
>  tools/testing/selftests/seccomp/Makefile | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index fce7f4ce069251a6..c728bd7a366f78b9 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
> -all:
>
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
>  CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> -       $(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
> +TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark

This breaks the dep on ../kselftest_harness.h. Changes go unnoticed if
this is changed:

$ touch tools/testing/selftests/kselftest_harness.h
$ make O=/tmp/kselftest -C tools/testing/selftests
...
make[1]: Entering directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
...

>
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> -
> -all: $(BINARIES)
> +include ../lib.mk
> --
> 2.17.1
>


-- 
Kees Cook

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

* [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
@ 2019-01-14 23:16     ` keescook
  0 siblings, 0 replies; 54+ messages in thread
From: Kees Cook @ 2019-01-14 23:16 UTC (permalink / raw)


On Mon, Jan 14, 2019 at 5:51 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> When building kselftest in a separate output directory, the seccomp_bpf
> binary ends up in the source directory instead of in the output
> directory, and the build of seccomp_benchmark fails:
>
>     make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.
>
> Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
> the build support from lib.mk properly.
>
> Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
> ---
>  tools/testing/selftests/seccomp/Makefile | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index fce7f4ce069251a6..c728bd7a366f78b9 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
> -all:
>
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
>  CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> -       $(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
> +TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark

This breaks the dep on ../kselftest_harness.h. Changes go unnoticed if
this is changed:

$ touch tools/testing/selftests/kselftest_harness.h
$ make O=/tmp/kselftest -C tools/testing/selftests
...
make[1]: Entering directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
...

>
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> -
> -all: $(BINARIES)
> +include ../lib.mk
> --
> 2.17.1
>


-- 
Kees Cook

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

* Re: [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules
@ 2019-01-14 23:16     ` keescook
  0 siblings, 0 replies; 54+ messages in thread
From: Kees Cook @ 2019-01-14 23:16 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Shuah Khan, Masahiro Yamada, Michal Marek, Jonathan Corbet,
	Bamvor Jian Zhang, open list:KERNEL SELFTEST FRAMEWORK,
	linux-kbuild, LKML

On Mon, Jan 14, 2019 at 5:51 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> When building kselftest in a separate output directory, the seccomp_bpf
> binary ends up in the source directory instead of in the output
> directory, and the build of seccomp_benchmark fails:
>
>     make[5]: *** No rule to make target 'seccomp_benchmark', needed by 'all'.  Stop.
>
> Fix this by declaring both test binaries using TEST_GEN_PROGS, and using
> the build support from lib.mk properly.
>
> Fixes: 967d7ba841513910 ("selftests/seccomp: Add simple seccomp overhead benchmark")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  tools/testing/selftests/seccomp/Makefile | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index fce7f4ce069251a6..c728bd7a366f78b9 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
> -all:
>
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
>  CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> -       $(CC) $(CFLAGS) $(LDFLAGS) -lpthread $< -o $@
> +TEST_GEN_PROGS = seccomp_bpf seccomp_benchmark

This breaks the dep on ../kselftest_harness.h. Changes go unnoticed if
this is changed:

$ touch tools/testing/selftests/kselftest_harness.h
$ make O=/tmp/kselftest -C tools/testing/selftests
...
make[1]: Entering directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory
'/home/kees/src/linux/tools/testing/selftests/seccomp'
...

>
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> -
> -all: $(BINARIES)
> +include ../lib.mk
> --
> 2.17.1
>


-- 
Kees Cook

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

* Re: [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
  2019-01-14 13:51   ` geert+renesas
  (?)
@ 2019-01-16 22:03     ` shuah
  -1 siblings, 0 replies; 54+ messages in thread
From: shuah @ 2019-01-16 22:03 UTC (permalink / raw)
  To: Geert Uytterhoeven, Masahiro Yamada, Michal Marek
  Cc: Jonathan Corbet, Bamvor Jian Zhang, Kees Cook, linux-kselftest,
	linux-kbuild, linux-kernel, shuah

On 1/14/19 6:51 AM, Geert Uytterhoeven wrote:
> With gcc 7.3.0:
> 
>      gpio-mockup-chardev.c: In function ‘get_debugfs’:
>      gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
>         asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Handle asprintf() failures to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>   tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> index f8d468f54e986dd0..aaa1e9f083c37215 100644
> --- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> +++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> @@ -37,7 +37,7 @@ static int get_debugfs(char **path)
>   	struct libmnt_table *tb;
>   	struct libmnt_iter *itr = NULL;
>   	struct libmnt_fs *fs;
> -	int found = 0;
> +	int found = 0, ret;
>   
>   	cxt = mnt_new_context();
>   	if (!cxt)
> @@ -58,8 +58,11 @@ static int get_debugfs(char **path)
>   			break;
>   		}
>   	}
> -	if (found)
> -		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +	if (found) {
> +		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +		if (ret < 0)
> +			err(EXIT_FAILURE, "failed to format string");
> +	}
>   
>   	mnt_free_iter(itr);
>   	mnt_free_context(cxt);
> 

Thanks for the patch. Applied to linux-kselftest fixes for 5.0-rc4

thanks,
-- Shuah

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

* [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
@ 2019-01-16 22:03     ` shuah
  0 siblings, 0 replies; 54+ messages in thread
From: shuah @ 2019-01-16 22:03 UTC (permalink / raw)


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

On 1/14/19 6:51 AM, Geert Uytterhoeven wrote:
> With gcc 7.3.0:
> 
>      gpio-mockup-chardev.c: In function ‘get_debugfs’:
>      gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
>         asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Handle asprintf() failures to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
> ---
>   tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> index f8d468f54e986dd0..aaa1e9f083c37215 100644
> --- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> +++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> @@ -37,7 +37,7 @@ static int get_debugfs(char **path)
>   	struct libmnt_table *tb;
>   	struct libmnt_iter *itr = NULL;
>   	struct libmnt_fs *fs;
> -	int found = 0;
> +	int found = 0, ret;
>   
>   	cxt = mnt_new_context();
>   	if (!cxt)
> @@ -58,8 +58,11 @@ static int get_debugfs(char **path)
>   			break;
>   		}
>   	}
> -	if (found)
> -		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +	if (found) {
> +		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +		if (ret < 0)
> +			err(EXIT_FAILURE, "failed to format string");
> +	}
>   
>   	mnt_free_iter(itr);
>   	mnt_free_context(cxt);
> 

Thanks for the patch. Applied to linux-kselftest fixes for 5.0-rc4

thanks,
-- Shuah

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

* [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error
@ 2019-01-16 22:03     ` shuah
  0 siblings, 0 replies; 54+ messages in thread
From: shuah @ 2019-01-16 22:03 UTC (permalink / raw)


On 1/14/19 6:51 AM, Geert Uytterhoeven wrote:
> With gcc 7.3.0:
> 
>      gpio-mockup-chardev.c: In function ‘get_debugfs’:
>      gpio-mockup-chardev.c:62:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
>         asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Handle asprintf() failures to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
> ---
>   tools/testing/selftests/gpio/gpio-mockup-chardev.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> index f8d468f54e986dd0..aaa1e9f083c37215 100644
> --- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> +++ b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
> @@ -37,7 +37,7 @@ static int get_debugfs(char **path)
>   	struct libmnt_table *tb;
>   	struct libmnt_iter *itr = NULL;
>   	struct libmnt_fs *fs;
> -	int found = 0;
> +	int found = 0, ret;
>   
>   	cxt = mnt_new_context();
>   	if (!cxt)
> @@ -58,8 +58,11 @@ static int get_debugfs(char **path)
>   			break;
>   		}
>   	}
> -	if (found)
> -		asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +	if (found) {
> +		ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
> +		if (ret < 0)
> +			err(EXIT_FAILURE, "failed to format string");
> +	}
>   
>   	mnt_free_iter(itr);
>   	mnt_free_context(cxt);
> 

Thanks for the patch. Applied to linux-kselftest fixes for 5.0-rc4

thanks,
-- Shuah

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

* Re: [PATCH 00/12] selftests: Miscellaneous fixes
  2019-01-14 13:51 ` geert+renesas
  (?)
  (?)
@ 2019-01-18  4:14   ` yamada.masahiro
  -1 siblings, 0 replies; 54+ messages in thread
From: Masahiro Yamada @ 2019-01-18  4:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Shuah Khan, Michal Marek, Jonathan Corbet, Bamvor Jian Zhang,
	Kees Cook, open list:KERNEL SELFTEST FRAMEWORK,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	Sam Ravnborg

On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
>         Hi all,
>
> This patch series contains several build fixes and cleanups for issues I
> encountered when trying to cross-build an rtctest binary in a separate
> output directory (like I use for all my kernel builds).

Geert,
Thanks for working on this!


My fundamental question is,
why did tools/ opt out Kbuild?

I think lots of mess comes in
in order to support
  cd tools/gpio; make

instead of

  make tools/gpio/


Lots of files are duplicated in tools/build/
in order to invent a different build system for tools/


Similar, but not exactly the same files. For example,

diff -u scripts/basic/fixdep.c tools/build/fixdep.c




> Most patches are independent. Exceptions are:
>   - Patch 3 depends on patch 2,
>   - Patch 7 depends on patch 6,
>   - Patch 11 depends on patches 2 and 3,
>
> This has been tested with native (amd64):
>   - make kselftest-build
>   - make -C tools/testing/selftests
>   - make O=/tmp/kselftest kselftest-build
>   - make O=/tmp/kselftest -C tools/testing/selftests
> and cross-builds (arm):
>   - make kselftest-build (from a separate output directory).
>
> Known remaining issues (not introduced by this patch series):
>   - tools/lib/bpf fails to build in some cases (cfr.
>     https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ@mail.gmail.com/),
>   - tools/gpio is not always built correctly,
>   - When building in a separate output directory, there are still files
>     created in the source directory under:
>         - arch/x86/include/generated/,
>         - arch/x86/tools/,
>         - include/generated/uapi/linux,
>         - scripts (fixdep and unifdef),
>   - Some tests may fail to find the installed header files,
>   - There may be^H^H^H^H^H^Hare more.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (12):
>   selftests: gpio-mockup-chardev: Check asprintf() for error
>   selftests: Fix output directory with O=
>   selftests: Fix header install directory with O=
>   selftests: android: ion: Fix ionmap_test dependencies
>   selftests: seccomp: Fix test dependencies and rules
>   selftests: lib.mk: Add rule to build object file from C source file
>   selftests: memfd: Fix build with O=
>   selftests: timestamping: Remove superfluous rules
>   selftests: sparc64: Remove superfluous rules
>   selftests: intel_pstate: Remove unused header dependency rule
>   selftests: Add kselftest-build target
>   [RFC] selftests: gpio: Fix building tools/gpio from kselftests
>
>  Documentation/dev-tools/kselftest.rst             |  4 ++++
>  Makefile                                          |  9 +++++++--
>  tools/testing/selftests/android/ion/Makefile      |  6 +-----
>  tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
>  .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
>  tools/testing/selftests/intel_pstate/Makefile     |  2 --
>  tools/testing/selftests/lib.mk                    |  4 ++++
>  tools/testing/selftests/memfd/Makefile            |  8 +++-----
>  .../selftests/networking/timestamping/Makefile    |  5 -----
>  tools/testing/selftests/seccomp/Makefile          | 15 +++------------
>  tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
>  11 files changed, 35 insertions(+), 43 deletions(-)
>
> --
> 2.17.1
>
> Gr{oetje,eeting}s,
>
>                                                 Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                                             -- Linus Torvalds



-- 
Best Regards
Masahiro Yamada

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  4:14   ` yamada.masahiro
  0 siblings, 0 replies; 54+ messages in thread
From: yamada.masahiro @ 2019-01-18  4:14 UTC (permalink / raw)


On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
<geert+renesas at glider.be> wrote:
>
>         Hi all,
>
> This patch series contains several build fixes and cleanups for issues I
> encountered when trying to cross-build an rtctest binary in a separate
> output directory (like I use for all my kernel builds).

Geert,
Thanks for working on this!


My fundamental question is,
why did tools/ opt out Kbuild?

I think lots of mess comes in
in order to support
  cd tools/gpio; make

instead of

  make tools/gpio/


Lots of files are duplicated in tools/build/
in order to invent a different build system for tools/


Similar, but not exactly the same files. For example,

diff -u scripts/basic/fixdep.c tools/build/fixdep.c




> Most patches are independent. Exceptions are:
>   - Patch 3 depends on patch 2,
>   - Patch 7 depends on patch 6,
>   - Patch 11 depends on patches 2 and 3,
>
> This has been tested with native (amd64):
>   - make kselftest-build
>   - make -C tools/testing/selftests
>   - make O=/tmp/kselftest kselftest-build
>   - make O=/tmp/kselftest -C tools/testing/selftests
> and cross-builds (arm):
>   - make kselftest-build (from a separate output directory).
>
> Known remaining issues (not introduced by this patch series):
>   - tools/lib/bpf fails to build in some cases (cfr.
>     https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ at mail.gmail.com/),
>   - tools/gpio is not always built correctly,
>   - When building in a separate output directory, there are still files
>     created in the source directory under:
>         - arch/x86/include/generated/,
>         - arch/x86/tools/,
>         - include/generated/uapi/linux,
>         - scripts (fixdep and unifdef),
>   - Some tests may fail to find the installed header files,
>   - There may be^H^H^H^H^H^Hare more.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (12):
>   selftests: gpio-mockup-chardev: Check asprintf() for error
>   selftests: Fix output directory with O=
>   selftests: Fix header install directory with O=
>   selftests: android: ion: Fix ionmap_test dependencies
>   selftests: seccomp: Fix test dependencies and rules
>   selftests: lib.mk: Add rule to build object file from C source file
>   selftests: memfd: Fix build with O=
>   selftests: timestamping: Remove superfluous rules
>   selftests: sparc64: Remove superfluous rules
>   selftests: intel_pstate: Remove unused header dependency rule
>   selftests: Add kselftest-build target
>   [RFC] selftests: gpio: Fix building tools/gpio from kselftests
>
>  Documentation/dev-tools/kselftest.rst             |  4 ++++
>  Makefile                                          |  9 +++++++--
>  tools/testing/selftests/android/ion/Makefile      |  6 +-----
>  tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
>  .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
>  tools/testing/selftests/intel_pstate/Makefile     |  2 --
>  tools/testing/selftests/lib.mk                    |  4 ++++
>  tools/testing/selftests/memfd/Makefile            |  8 +++-----
>  .../selftests/networking/timestamping/Makefile    |  5 -----
>  tools/testing/selftests/seccomp/Makefile          | 15 +++------------
>  tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
>  11 files changed, 35 insertions(+), 43 deletions(-)
>
> --
> 2.17.1
>
> Gr{oetje,eeting}s,
>
>                                                 Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                                             -- Linus Torvalds



-- 
Best Regards
Masahiro Yamada

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  4:14   ` yamada.masahiro
  0 siblings, 0 replies; 54+ messages in thread
From: Masahiro Yamada @ 2019-01-18  4:14 UTC (permalink / raw)


On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
>         Hi all,
>
> This patch series contains several build fixes and cleanups for issues I
> encountered when trying to cross-build an rtctest binary in a separate
> output directory (like I use for all my kernel builds).

Geert,
Thanks for working on this!


My fundamental question is,
why did tools/ opt out Kbuild?

I think lots of mess comes in
in order to support
  cd tools/gpio; make

instead of

  make tools/gpio/


Lots of files are duplicated in tools/build/
in order to invent a different build system for tools/


Similar, but not exactly the same files. For example,

diff -u scripts/basic/fixdep.c tools/build/fixdep.c




> Most patches are independent. Exceptions are:
>   - Patch 3 depends on patch 2,
>   - Patch 7 depends on patch 6,
>   - Patch 11 depends on patches 2 and 3,
>
> This has been tested with native (amd64):
>   - make kselftest-build
>   - make -C tools/testing/selftests
>   - make O=/tmp/kselftest kselftest-build
>   - make O=/tmp/kselftest -C tools/testing/selftests
> and cross-builds (arm):
>   - make kselftest-build (from a separate output directory).
>
> Known remaining issues (not introduced by this patch series):
>   - tools/lib/bpf fails to build in some cases (cfr.
>     https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ at mail.gmail.com/),
>   - tools/gpio is not always built correctly,
>   - When building in a separate output directory, there are still files
>     created in the source directory under:
>         - arch/x86/include/generated/,
>         - arch/x86/tools/,
>         - include/generated/uapi/linux,
>         - scripts (fixdep and unifdef),
>   - Some tests may fail to find the installed header files,
>   - There may be^H^H^H^H^H^Hare more.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (12):
>   selftests: gpio-mockup-chardev: Check asprintf() for error
>   selftests: Fix output directory with O=
>   selftests: Fix header install directory with O=
>   selftests: android: ion: Fix ionmap_test dependencies
>   selftests: seccomp: Fix test dependencies and rules
>   selftests: lib.mk: Add rule to build object file from C source file
>   selftests: memfd: Fix build with O=
>   selftests: timestamping: Remove superfluous rules
>   selftests: sparc64: Remove superfluous rules
>   selftests: intel_pstate: Remove unused header dependency rule
>   selftests: Add kselftest-build target
>   [RFC] selftests: gpio: Fix building tools/gpio from kselftests
>
>  Documentation/dev-tools/kselftest.rst             |  4 ++++
>  Makefile                                          |  9 +++++++--
>  tools/testing/selftests/android/ion/Makefile      |  6 +-----
>  tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
>  .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
>  tools/testing/selftests/intel_pstate/Makefile     |  2 --
>  tools/testing/selftests/lib.mk                    |  4 ++++
>  tools/testing/selftests/memfd/Makefile            |  8 +++-----
>  .../selftests/networking/timestamping/Makefile    |  5 -----
>  tools/testing/selftests/seccomp/Makefile          | 15 +++------------
>  tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
>  11 files changed, 35 insertions(+), 43 deletions(-)
>
> --
> 2.17.1
>
> Gr{oetje,eeting}s,
>
>                                                 Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                                             -- Linus Torvalds



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  4:14   ` yamada.masahiro
  0 siblings, 0 replies; 54+ messages in thread
From: Masahiro Yamada @ 2019-01-18  4:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Shuah Khan, Michal Marek, Jonathan Corbet, Bamvor Jian Zhang,
	Kees Cook, open list:KERNEL SELFTEST FRAMEWORK,
	Linux Kbuild mailing list, Linux Kernel Mailing List,
	Sam Ravnborg

On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
>         Hi all,
>
> This patch series contains several build fixes and cleanups for issues I
> encountered when trying to cross-build an rtctest binary in a separate
> output directory (like I use for all my kernel builds).

Geert,
Thanks for working on this!


My fundamental question is,
why did tools/ opt out Kbuild?

I think lots of mess comes in
in order to support
  cd tools/gpio; make

instead of

  make tools/gpio/


Lots of files are duplicated in tools/build/
in order to invent a different build system for tools/


Similar, but not exactly the same files. For example,

diff -u scripts/basic/fixdep.c tools/build/fixdep.c




> Most patches are independent. Exceptions are:
>   - Patch 3 depends on patch 2,
>   - Patch 7 depends on patch 6,
>   - Patch 11 depends on patches 2 and 3,
>
> This has been tested with native (amd64):
>   - make kselftest-build
>   - make -C tools/testing/selftests
>   - make O=/tmp/kselftest kselftest-build
>   - make O=/tmp/kselftest -C tools/testing/selftests
> and cross-builds (arm):
>   - make kselftest-build (from a separate output directory).
>
> Known remaining issues (not introduced by this patch series):
>   - tools/lib/bpf fails to build in some cases (cfr.
>     https://lore.kernel.org/lkml/CAMuHMdXRN=mSKTjZNBSxQi-pkgSrKqeANxD-GB+hqC8pDjx7nQ@mail.gmail.com/),
>   - tools/gpio is not always built correctly,
>   - When building in a separate output directory, there are still files
>     created in the source directory under:
>         - arch/x86/include/generated/,
>         - arch/x86/tools/,
>         - include/generated/uapi/linux,
>         - scripts (fixdep and unifdef),
>   - Some tests may fail to find the installed header files,
>   - There may be^H^H^H^H^H^Hare more.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (12):
>   selftests: gpio-mockup-chardev: Check asprintf() for error
>   selftests: Fix output directory with O=
>   selftests: Fix header install directory with O=
>   selftests: android: ion: Fix ionmap_test dependencies
>   selftests: seccomp: Fix test dependencies and rules
>   selftests: lib.mk: Add rule to build object file from C source file
>   selftests: memfd: Fix build with O=
>   selftests: timestamping: Remove superfluous rules
>   selftests: sparc64: Remove superfluous rules
>   selftests: intel_pstate: Remove unused header dependency rule
>   selftests: Add kselftest-build target
>   [RFC] selftests: gpio: Fix building tools/gpio from kselftests
>
>  Documentation/dev-tools/kselftest.rst             |  4 ++++
>  Makefile                                          |  9 +++++++--
>  tools/testing/selftests/android/ion/Makefile      |  6 +-----
>  tools/testing/selftests/gpio/Makefile             | 12 +++++++-----
>  .../testing/selftests/gpio/gpio-mockup-chardev.c  |  9 ++++++---
>  tools/testing/selftests/intel_pstate/Makefile     |  2 --
>  tools/testing/selftests/lib.mk                    |  4 ++++
>  tools/testing/selftests/memfd/Makefile            |  8 +++-----
>  .../selftests/networking/timestamping/Makefile    |  5 -----
>  tools/testing/selftests/seccomp/Makefile          | 15 +++------------
>  tools/testing/selftests/sparc64/drivers/Makefile  |  4 ----
>  11 files changed, 35 insertions(+), 43 deletions(-)
>
> --
> 2.17.1
>
> Gr{oetje,eeting}s,
>
>                                                 Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                                             -- Linus Torvalds



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 00/12] selftests: Miscellaneous fixes
  2019-01-18  4:14   ` yamada.masahiro
  (?)
  (?)
@ 2019-01-18  7:57     ` geert
  -1 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18  7:57 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Geert Uytterhoeven, Shuah Khan, Michal Marek, Jonathan Corbet,
	Bamvor Jian Zhang, Kees Cook,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kbuild mailing list,
	Linux Kernel Mailing List, Sam Ravnborg

Hi Yamada-san,

On Fri, Jan 18, 2019 at 5:15 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > This patch series contains several build fixes and cleanups for issues I
> > encountered when trying to cross-build an rtctest binary in a separate
> > output directory (like I use for all my kernel builds).
>
> Geert,
> Thanks for working on this!
>
> My fundamental question is,
> why did tools/ opt out Kbuild?

Good question.  I think it originally started as a separate small project.

> I think lots of mess comes in
> in order to support
>   cd tools/gpio; make
>
> instead of
>
>   make tools/gpio/
>
> Lots of files are duplicated in tools/build/
> in order to invent a different build system for tools/

I agree switching to kbuild would be the best solution.
Unfortunately my kbuild foo is not strong enough...

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  7:57     ` geert
  0 siblings, 0 replies; 54+ messages in thread
From: geert @ 2019-01-18  7:57 UTC (permalink / raw)


Hi Yamada-san,

On Fri, Jan 18, 2019 at 5:15 AM Masahiro Yamada
<yamada.masahiro at socionext.com> wrote:
> On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
> <geert+renesas at glider.be> wrote:
> > This patch series contains several build fixes and cleanups for issues I
> > encountered when trying to cross-build an rtctest binary in a separate
> > output directory (like I use for all my kernel builds).
>
> Geert,
> Thanks for working on this!
>
> My fundamental question is,
> why did tools/ opt out Kbuild?

Good question.  I think it originally started as a separate small project.

> I think lots of mess comes in
> in order to support
>   cd tools/gpio; make
>
> instead of
>
>   make tools/gpio/
>
> Lots of files are duplicated in tools/build/
> in order to invent a different build system for tools/

I agree switching to kbuild would be the best solution.
Unfortunately my kbuild foo is not strong enough...

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  7:57     ` geert
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18  7:57 UTC (permalink / raw)


Hi Yamada-san,

On Fri, Jan 18, 2019 at 5:15 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > This patch series contains several build fixes and cleanups for issues I
> > encountered when trying to cross-build an rtctest binary in a separate
> > output directory (like I use for all my kernel builds).
>
> Geert,
> Thanks for working on this!
>
> My fundamental question is,
> why did tools/ opt out Kbuild?

Good question.  I think it originally started as a separate small project.

> I think lots of mess comes in
> in order to support
>   cd tools/gpio; make
>
> instead of
>
>   make tools/gpio/
>
> Lots of files are duplicated in tools/build/
> in order to invent a different build system for tools/

I agree switching to kbuild would be the best solution.
Unfortunately my kbuild foo is not strong enough...

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 00/12] selftests: Miscellaneous fixes
@ 2019-01-18  7:57     ` geert
  0 siblings, 0 replies; 54+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18  7:57 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Geert Uytterhoeven, Shuah Khan, Michal Marek, Jonathan Corbet,
	Bamvor Jian Zhang, Kees Cook,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kbuild mailing list,
	Linux Kernel Mailing List, Sam Ravnborg

Hi Yamada-san,

On Fri, Jan 18, 2019 at 5:15 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> On Mon, Jan 14, 2019 at 10:52 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > This patch series contains several build fixes and cleanups for issues I
> > encountered when trying to cross-build an rtctest binary in a separate
> > output directory (like I use for all my kernel builds).
>
> Geert,
> Thanks for working on this!
>
> My fundamental question is,
> why did tools/ opt out Kbuild?

Good question.  I think it originally started as a separate small project.

> I think lots of mess comes in
> in order to support
>   cd tools/gpio; make
>
> instead of
>
>   make tools/gpio/
>
> Lots of files are duplicated in tools/build/
> in order to invent a different build system for tools/

I agree switching to kbuild would be the best solution.
Unfortunately my kbuild foo is not strong enough...

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2019-01-18  7:57 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 13:51 [PATCH 00/12] selftests: Miscellaneous fixes Geert Uytterhoeven
2019-01-14 13:51 ` Geert Uytterhoeven
2019-01-14 13:51 ` geert+renesas
2019-01-14 13:51 ` [PATCH 01/12] selftests: gpio-mockup-chardev: Check asprintf() for error Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-16 22:03   ` shuah
2019-01-16 22:03     ` shuah
2019-01-16 22:03     ` shuah
2019-01-14 13:51 ` [PATCH 02/12] selftests: Fix output directory with O= Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 03/12] selftests: Fix header install " Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 04/12] selftests: android: ion: Fix ionmap_test dependencies Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 05/12] selftests: seccomp: Fix test dependencies and rules Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 23:16   ` Kees Cook
2019-01-14 23:16     ` Kees Cook
2019-01-14 23:16     ` Kees Cook
2019-01-14 23:16     ` keescook
2019-01-14 13:51 ` [PATCH 06/12] selftests: lib.mk: Add rule to build object file from C source file Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 07/12] selftests: memfd: Fix build with O= Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 08/12] selftests: timestamping: Remove superfluous rules Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 09/12] selftests: sparc64: " Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 10/12] selftests: intel_pstate: Remove unused header dependency rule Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH 11/12] selftests: Add kselftest-build target Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-14 13:51 ` [PATCH/RFC 12/12] selftests: gpio: Fix building tools/gpio from kselftests Geert Uytterhoeven
2019-01-14 13:51   ` Geert Uytterhoeven
2019-01-14 13:51   ` geert+renesas
2019-01-18  4:14 ` [PATCH 00/12] selftests: Miscellaneous fixes Masahiro Yamada
2019-01-18  4:14   ` Masahiro Yamada
2019-01-18  4:14   ` Masahiro Yamada
2019-01-18  4:14   ` yamada.masahiro
2019-01-18  7:57   ` Geert Uytterhoeven
2019-01-18  7:57     ` Geert Uytterhoeven
2019-01-18  7:57     ` Geert Uytterhoeven
2019-01-18  7:57     ` geert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.