lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ab170b7a08109f313199baa59da42e829a9ddd69.1419387513.git.shuahkh@osg.samsung.com>
Date:	Wed, 24 Dec 2014 09:27:55 -0700
From:	Shuah Khan <shuahkh@....samsung.com>
To:	mmarek@...e.cz, gregkh@...uxfoundation.org,
	akpm@...ux-foundation.org, rostedt@...dmis.org, mingo@...hat.com,
	davem@...emloft.net, keescook@...omium.org, tranmanphong@...il.com,
	mpe@...erman.id.au, cov@...eaurora.org, dh.herrmann@...il.com,
	hughd@...gle.com, bobby.prani@...il.com, serge.hallyn@...ntu.com,
	ebiederm@...ssion.com, tim.bird@...ymobile.com,
	josh@...htriplett.org, koct9i@...il.com
Cc:	Shuah Khan <shuahkh@....samsung.com>, linux-kbuild@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
	netdev@...r.kernel.org
Subject: [PATCH v3 19/20] selftests: add install target to enable test install

Add a new make target to enable installing selftests. This
new target will call install targets for the tests that are
specified in INSTALL_TARGETS. During install, a script is
generated to run tests that are installed. This script will
be installed in the selftest install directory. Individual
test Makefiles are changed to add to the script. This will
allow new tests to add install and run test commands to the
generated kselftest script. run_tests target runs the
generated kselftest script to run tests when it is initiated
from from "make kselftest" from top level source directory.

Approach:

Add a new kselftest_install target:
-- exports kselftest INSTALL_KSFT_PATH
   default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
-- exports INSTALL_KSFT_PATH
-- runs selftests make kselftest_install target:

selftests make install target
-- Sets up environment for sub-makefiles
-- creates kselftest.sh script in install install dir
-- runs install targets for INSTALL_TARGETS
-- install target can be run only from top level source dir.

Individual test make install targets:
-- install test programs and/or scripts in install dir
-- append to the ksefltest.sh file to add commands to run test
-- install target can be run only from top level source dir.

Adds the following new ways to initiate selftests:
-- Installing and running kselftest from install directory
   by running  "make kselftest"
-- Running kselftest script from install directory

Maintains the following ways to run tests:
-- make TARGETS=net kselftest
-- make -C tools/testing/selftests run_tests
-- make -C tools/testing/selftests TARGETS=target run_tests
   Ability specify targets: e.g TARGETS=net
-- make run_tests from tools/testing/selftests
-- make run_tests from individual test directories:
   e.g: make run_tests in tools/testing/selftests/net

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
 tools/testing/selftests/Makefile | 54 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4e51122..e70cdc9 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -22,15 +22,67 @@ TARGETS += vm
 TARGETS_HOTPLUG = cpu-hotplug
 TARGETS_HOTPLUG += memory-hotplug
 
+# Used in only run_tests target when make kselftest is run in
+# top level source directory
+ifeq "$(origin TARGETS)" "command line"
+no_install_run=1
+endif
+
+ifdef INSTALL_KSFT_PATH
+KSELFTEST=$(INSTALL_KSFT_PATH)/kselftest.sh
+export KSELFTEST
+# TODO add install target for SKIP_INSTALL_TARGETS
+SKIP_INSTALL_TARGETS = exec powerpc
+INSTALL_TARGETS = $(filter-out $(SKIP_INSTALL_TARGETS),$(TARGETS)) ipc
+else
+no_install_run=1
+endif
+
+INSTALL_KSFT_ERR = Run make kselftest_install in top level source directory
+
 all:
 	for TARGET in $(TARGETS); do \
 		make -C $$TARGET; \
 	done;
 
-run_tests: all
+install:
+ifdef INSTALL_KSFT_PATH
+	rm -rf $(INSTALL_KSFT_PATH)
+	mkdir -p $(INSTALL_KSFT_PATH)
+
+	make all
+	@echo "#!/bin/sh\n# Kselftest Run Tests ...." >> $(KSELFTEST)
+	@echo "# This file is generated by kselftest_install" >> $(KSELFTEST)
+	@echo "# Please don't change it !!\n"  >> $(KSELFTEST)
+	@echo echo ============================== >> $(KSELFTEST)
+	for TARGET in $(INSTALL_TARGETS); do \
+		echo Installing $$TARGET; \
+		echo echo Start $$TARGET test .... >> $(KSELFTEST); \
+		make -C $$TARGET install; \
+		echo echo End $$TARGET test .... >> $(KSELFTEST); \
+		echo echo ============================== >> $(KSELFTEST); \
+	done;
+	chmod +x $(KSELFTEST)
+else
+	@echo $(INSTALL_KSFT_ERR)
+endif
+
+run_tests:
+ifndef no_install_run
+# ifdef INSTALL_KSFT_PATH
+	make install
+	@cd $(INSTALL_KSFT_PATH); ./kselftest.sh; cd -
+# invoke run_tests for SKIP_INSTALL_TARGETS
+	for TARGET in $(SKIP_INSTALL_TARGETS); do \
+		make -C $$TARGET run_tests; \
+	done;
+# endif
+else
+	make all
 	for TARGET in $(TARGETS); do \
 		make -C $$TARGET run_tests; \
 	done;
+endif
 
 hotplug:
 	for TARGET in $(TARGETS_HOTPLUG); do \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ