mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
To: shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/7] selftests: lib.mk: cleanup RUN_TESTS define and make it readable
Date: Tue,  1 May 2018 16:54:33 -0600	[thread overview]
Message-ID: <00bbd3e056ada1aeebc3cd108dcb5c780ae2f76e.1525212671.git.shuah@kernel.org> (raw)
In-Reply-To: <cover.1525212671.git.shuah@kernel.org>
In-Reply-To: <cover.1525212671.git.shuah@kernel.org>

Refine RUN_TESTS define's output block for summary and non-summary code
to remove duplicate code and make it readable.

cd `dirname $$TEST` > /dev/null; and cd - > /dev/null; are moved
to common code block and indentation fixed.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
---
 tools/testing/selftests/lib.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index c1b1a4dc6a96..1d2b48f2d481 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -32,11 +32,13 @@ define RUN_TESTS
 			echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\
 			echo "not ok 1..$$test_num selftests: $$BASENAME_TEST [FAIL]"; \
 		else					\
-		if [ "X$(summary)" != "X" ]; then		\
-				cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+			cd `dirname $$TEST` > /dev/null; \
+			if [ "X$(summary)" != "X" ]; then	\
+				(./$$BASENAME_TEST > /tmp/$$BASENAME_TEST 2>&1 && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]";		\
 			else				\
-				cd `dirname $$TEST` > /dev/null; (./$$BASENAME_TEST && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]"; cd - > /dev/null;\
+				(./$$BASENAME_TEST && echo "ok 1..$$test_num selftests: $$BASENAME_TEST [PASS]") || echo "not ok 1..$$test_num selftests:  $$BASENAME_TEST [FAIL]";					\
 			fi;				\
+			cd - > /dev/null;		\
 		fi;					\
 	done;
 endef
-- 
2.14.1


  reply	other threads:[~2018-05-01 22:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 22:54 [PATCH 0/7] Kselftest framework SKIP handling Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` Shuah Khan (Samsung OSG) [this message]
2018-05-01 22:54 ` [PATCH 2/7] selftests: lib.mk: add SKIP handling to RUN_TESTS define Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` [PATCH 3/7] selftests: lib.mk: move running and printing result to a new function Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` [PATCH 4/7] selftests: lib.mk: Include test suite name in the RUN_TESTS output Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` [PATCH 5/7] selftests: lib.mk: add SKIP handling and test suite name to EMIT_TESTS Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` [PATCH 6/7] selftests: lib.mk: add test execute bit check " Shuah Khan (Samsung OSG)
2018-05-01 22:54 ` [PATCH 7/7] selftests: kselftest: change KSFT_SKIP=4 instead of KSFT_PASS Shuah Khan (Samsung OSG)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00bbd3e056ada1aeebc3cd108dcb5c780ae2f76e.1525212671.git.shuah@kernel.org \
    --to=shuah@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®