osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38643?usp=email )
Change subject: testenv: show testsuite results at the end ......................................................................
testenv: show testsuite results at the end
Show the testsuite results from junit-*.log not after each testenv*.cfg file is through, but for all of them at the end. This way the results are in one place when running with multiple configs, we don't need to scroll to the middle of the huge log to find out what tests passed with a previous config.
Adjust the podman container stop and restart logic, so the last container is still running until we use it for showing the results.
Change-Id: Ie4b70724a33932cd98ba0972db37bf72dc8affb8 --- M _testenv/testenv.py M _testenv/testenv/testsuite.py 2 files changed, 12 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/43/38643/1
diff --git a/_testenv/testenv.py b/_testenv/testenv.py index 23a2922..81b3aac 100755 --- a/_testenv/testenv.py +++ b/_testenv/testenv.py @@ -47,6 +47,10 @@ # Run the components + testsuite cfg_count = 0 for cfg_name, cfg in testenv.testenv_cfg.cfgs.items(): + # Restart podman container before running with another config + if testenv.args.podman and cfg_count: + testenv.podman.stop(True) + testenv.testenv_cfg.set_current(cfg_name)
if testenv.args.binary_repo: @@ -58,15 +62,15 @@ testenv.testsuite.run(cfg) testenv.daemons.stop() testenv.testdir.clean_run_scripts("finished") - testenv.testsuite.cat_junit_logs()
cfg_count += 1 testenv.set_log_prefix("[testenv]")
- # Restart podman container before running with another config - if testenv.args.podman: - restart = cfg_count < len(testenv.testenv_cfg.cfgs) - testenv.podman.stop(restart) + # Show test results + testenv.testsuite.cat_junit_logs() + + if testenv.args.podman: + testenv.podman.stop()
def init_podman(): diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py index 3bc8d9d..1878b5c 100644 --- a/_testenv/testenv/testsuite.py +++ b/_testenv/testenv/testsuite.py @@ -145,10 +145,10 @@ colors = os.environ.get("TESTENV_SOURCE_HIGHLIGHT_COLORS", "esc256") tool = f"source-highlight -f {shlex.quote(colors)} -s xml -i"
- pattern = os.path.join(testenv.testdir.testdir, "testsuite", "junit-*.log") - for path in glob.glob(pattern): + pattern = os.path.join(testenv.testdir.testdir_topdir, "**", "junit-*.log") + for path in glob.glob(pattern, recursive=True): cmd = f"echo && {tool} {shlex.quote(path)} && echo" - logging.info(f"Showing {os.path.basename(path)}") + logging.info(f"Showing {os.path.relpath(path, testenv.testdir.testdir_topdir)}") testenv.cmd.run(cmd)