unit-test: Find all test-suite.log
This removes the hard coding of the test-suite.log reading logic so that
autotools test-suite logs can be in any output build directory.
Tested:
Added a test failure to sdbusplus and logs are still printed out
correctly when the failure occurs. Successful runs are not printed.
Change-Id: I85fcc7d99b34bcaa5fcc398052844410047367d2
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index de657d8..891e2af 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -437,17 +437,14 @@
# Refresh dynamic linker run time bindings for dependencies
check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), 'ldconfig')
# Run package unit tests
- rv = 0
try:
cmd = [ 'make', 'check' ]
for i in range(0, args.repeat):
check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), *cmd)
except CalledProcessError:
- rv = 1
- for relpath in ("test/test-suite.log", "src/test/test-suite.log"):
- log = os.path.join(WORKSPACE, UNIT_TEST_PKG, relpath)
- if not os.path.exists(log):
+ for root, _, files in os.walk(os.path.join(WORKSPACE, UNIT_TEST_PKG)):
+ if 'test-suite.log' not in files:
continue
- check_call_cmd(os.path.join(WORKSPACE, UNIT_TEST_PKG), "cat", log)
+ check_call_cmd(root, 'cat', os.path.join(root, 'test-suite.log'))
+ raise Exception('Unit tests failed')
os.umask(prev_umask)
- sys.exit(rv)