linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Simplify kselftest build and install use-cases
@ 2019-09-25 23:04 Shuah Khan
  2019-09-25 23:04 ` [PATCH 1/2] Makefile: Add kselftest_build target to build tests Shuah Khan
  2019-09-25 23:04 ` [PATCH 2/2] selftests: Add kselftest_install target to main Makefile Shuah Khan
  0 siblings, 2 replies; 5+ messages in thread
From: Shuah Khan @ 2019-09-25 23:04 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, shuah
  Cc: Shuah Khan, linux-kbuild, linux-kselftest, linux-kernel

This patch series simplifies kselftest use-cases and addresses requests
from developers and testers to add support for building and installing
from the main Makefile.

Shuah Khan (2):
  Makefile: Add kselftest_build target to build tests
  selftests: Add kselftest_install target to main Makefile

 Makefile                                     | 8 ++++++++
 tools/testing/selftests/Makefile             | 8 ++++++--
 tools/testing/selftests/kselftest_install.sh | 4 ++--
 3 files changed, 16 insertions(+), 4 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] Makefile: Add kselftest_build target to build tests
  2019-09-25 23:04 [PATCH 0/2] Simplify kselftest build and install use-cases Shuah Khan
@ 2019-09-25 23:04 ` Shuah Khan
  2019-09-25 23:04 ` [PATCH 2/2] selftests: Add kselftest_install target to main Makefile Shuah Khan
  1 sibling, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2019-09-25 23:04 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, shuah
  Cc: Shuah Khan, linux-kbuild, linux-kselftest, linux-kernel

Add kselftest_build target to build tests from the top level
Makefile. This is to simplify kselftest use-cases for CI and
distributions where build and test systems are different.

Current kselftest target builds and runs tests on a development
system which is a developer use-case.

This change addresses requests from developers and testers to add
support for building from the main Makefile.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index d456746da347..ac4af6fc4b50 100644
--- a/Makefile
+++ b/Makefile
@@ -1233,6 +1233,10 @@ scripts_unifdef: scripts_basic
 # ---------------------------------------------------------------------------
 # Kernel selftest
 
+PHONY += kselftest_build
+kselftest_build:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests all
+
 PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
-- 
2.20.1


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

* [PATCH 2/2] selftests: Add kselftest_install target to main Makefile
  2019-09-25 23:04 [PATCH 0/2] Simplify kselftest build and install use-cases Shuah Khan
  2019-09-25 23:04 ` [PATCH 1/2] Makefile: Add kselftest_build target to build tests Shuah Khan
@ 2019-09-25 23:04 ` Shuah Khan
  2019-09-26  3:24   ` Masahiro Yamada
  1 sibling, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2019-09-25 23:04 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, shuah
  Cc: Shuah Khan, linux-kbuild, linux-kselftest, linux-kernel

Add kselftest_install target to install tests from the top level
Makefile. This is to simplify kselftest use-cases for CI and
distributions where build and test systems are different.

This change addresses requests from developers and testers to add
support for installing kselftest from the main Makefile.

In addition, make the install directory the same when install is
run using "make kselftest_install" or by running kselftest_install.sh.
Also fix the INSTALL_PATH variable conflict between main Makefile.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 Makefile                                     | 4 ++++
 tools/testing/selftests/Makefile             | 8 ++++++--
 tools/testing/selftests/kselftest_install.sh | 4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ac4af6fc4b50..65c62af6b6fa 100644
--- a/Makefile
+++ b/Makefile
@@ -1241,6 +1241,10 @@ PHONY += kselftest
 kselftest:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
 
+PHONY += kselftest_install
+kselftest_install:
+	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests install
+
 PHONY += kselftest-clean
 kselftest-clean:
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index c3feccb99ff5..bad18145ed1a 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -171,9 +171,12 @@ run_pstore_crash:
 # 1. output_dir=kernel_src
 # 2. a separate output directory is specified using O= KBUILD_OUTPUT
 # 3. a separate output directory is specified using KBUILD_OUTPUT
+# Avoid conflict with INSTALL_PATH set by the main Makefile
 #
-INSTALL_PATH ?= $(BUILD)/install
-INSTALL_PATH := $(abspath $(INSTALL_PATH))
+KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install
+KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH))
+# Avoid changing the rest of the logic here and lib.mk.
+INSTALL_PATH := $(KSFT_INSTALL_PATH)
 ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
 
 install: all
@@ -203,6 +206,7 @@ ifdef INSTALL_PATH
 		echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
 		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
 		echo -n "run_many" >> $(ALL_SCRIPT); \
+		echo -n "Emit Tests for $$TARGET\n"; \
 		$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
 		echo "" >> $(ALL_SCRIPT);	    \
 		echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
diff --git a/tools/testing/selftests/kselftest_install.sh b/tools/testing/selftests/kselftest_install.sh
index ec304463883c..e2e1911d62d5 100755
--- a/tools/testing/selftests/kselftest_install.sh
+++ b/tools/testing/selftests/kselftest_install.sh
@@ -24,12 +24,12 @@ main()
 		echo "$0: Installing in specified location - $install_loc ..."
 	fi
 
-	install_dir=$install_loc/kselftest
+	install_dir=$install_loc/kselftest_install
 
 # Create install directory
 	mkdir -p $install_dir
 # Build tests
-	INSTALL_PATH=$install_dir make install
+	KSFT_INSTALL_PATH=$install_dir make install
 }
 
 main "$@"
-- 
2.20.1


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

* Re: [PATCH 2/2] selftests: Add kselftest_install target to main Makefile
  2019-09-25 23:04 ` [PATCH 2/2] selftests: Add kselftest_install target to main Makefile Shuah Khan
@ 2019-09-26  3:24   ` Masahiro Yamada
  2019-09-26 22:11     ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2019-09-26  3:24 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Michal Marek, Cc: Shuah Khan, Linux Kbuild mailing list,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List

Hi Shuah,



On Thu, Sep 26, 2019 at 8:05 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> Add kselftest_install target to install tests from the top level
> Makefile. This is to simplify kselftest use-cases for CI and
> distributions where build and test systems are different.
>
> This change addresses requests from developers and testers to add
> support for installing kselftest from the main Makefile.
>
> In addition, make the install directory the same when install is
> run using "make kselftest_install" or by running kselftest_install.sh.
> Also fix the INSTALL_PATH variable conflict between main Makefile.
>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

So, if these two patches were applied, we would see the following:


PHONY += kselftest_build
kselftest_build:
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests all

PHONY += kselftest
kselftest:
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests

PHONY += kselftest_install
kselftest_install:
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests install

PHONY += kselftest-clean
kselftest-clean:
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean


I do not want to see this endless crap addition just for
changing the working directory to $(srctree)/tools/testing/selftests



Why don't you use pattern rule?
Those will be reduced into the two rules.



PHONY += kselftest
kselftest:
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests

kselftest-%: FORCE
        $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*



This also avoids your inconsistency about
"kselftest-" vs "kselftest_".


Given the existing "kselftest-clean" and "kselftest-merge",
"kselftest_build" and "kselftest_install"
(using an underscore instead of n hyphen)
would add needless confusion.


-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH 2/2] selftests: Add kselftest_install target to main Makefile
  2019-09-26  3:24   ` Masahiro Yamada
@ 2019-09-26 22:11     ` Shuah Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2019-09-26 22:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michal Marek, Cc: Shuah Khan, Linux Kbuild mailing list,
	open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List,
	skh >> Shuah Khan

On 9/25/19 9:24 PM, Masahiro Yamada wrote:
> Hi Shuah,
> 
> 
> 
> On Thu, Sep 26, 2019 at 8:05 AM Shuah Khan <skhan@linuxfoundation.org> wrote:
>>
>> Add kselftest_install target to install tests from the top level
>> Makefile. This is to simplify kselftest use-cases for CI and
>> distributions where build and test systems are different.
>>
>> This change addresses requests from developers and testers to add
>> support for installing kselftest from the main Makefile.
>>
>> In addition, make the install directory the same when install is
>> run using "make kselftest_install" or by running kselftest_install.sh.
>> Also fix the INSTALL_PATH variable conflict between main Makefile.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> So, if these two patches were applied, we would see the following:
> 
> 
> PHONY += kselftest_build
> kselftest_build:
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests all
> 
> PHONY += kselftest
> kselftest:
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> 
> PHONY += kselftest_install
> kselftest_install:
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests install
> 
> PHONY += kselftest-clean
> kselftest-clean:
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests clean
> 
> 
> I do not want to see this endless crap addition just for
> changing the working directory to $(srctree)/tools/testing/selftests
> 
> 
> 
> Why don't you use pattern rule?
> Those will be reduced into the two rules.
> 

I just didn't think about simplifying it. Thanks for
being direct.

> 
> 
> PHONY += kselftest
> kselftest:
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
> 
> kselftest-%: FORCE
>          $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
> 
> 
> 
> This also avoids your inconsistency about
> "kselftest-" vs "kselftest_".
> 
> 
> Given the existing "kselftest-clean" and "kselftest-merge",
> "kselftest_build" and "kselftest_install"
> (using an underscore instead of n hyphen)
> would add needless confusion.
> 
> 

Done. Sending v2 with two patches collapsed into one.

thanks,
-- Shuah

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

end of thread, other threads:[~2019-09-26 22:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 23:04 [PATCH 0/2] Simplify kselftest build and install use-cases Shuah Khan
2019-09-25 23:04 ` [PATCH 1/2] Makefile: Add kselftest_build target to build tests Shuah Khan
2019-09-25 23:04 ` [PATCH 2/2] selftests: Add kselftest_install target to main Makefile Shuah Khan
2019-09-26  3:24   ` Masahiro Yamada
2019-09-26 22:11     ` Shuah Khan

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