OSDN Git Service

selftests: lib.mk: cleanup RUN_TESTS define and make it readable
authorShuah Khan (Samsung OSG) <shuah@kernel.org>
Thu, 19 Apr 2018 22:30:33 +0000 (16:30 -0600)
committerShuah Khan (Samsung OSG) <shuah@kernel.org>
Wed, 30 May 2018 21:21:51 +0000 (15:21 -0600)
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

index c1b1a4d..1d2b48f 100644 (file)
@@ -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