]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selftests: lib.mk: cleanup RUN_TESTS define and make it readable
authorShuah Khan (Samsung OSG) <shuah@kernel.org>
Wed, 6 Nov 2019 10:29:05 +0000 (18:29 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 13 Nov 2019 05:30:04 +0000 (00:30 -0500)
BugLink: https://bugs.launchpad.net/bugs/1812352
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>
(cherry picked from commit 42b44c34136857ccdf90ebb1cbc38f2bf0aec7a1)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
tools/testing/selftests/lib.mk

index a001ccc77e898ee33542e4054c605a2c7dd62723..0b76e4ab4bbf4f858c823ef1d5c7148ad6f86f33 100644 (file)
@@ -44,11 +44,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