From 4428c7bcdc07203d864c504bfa3420fd176bafc6 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 20 Oct 2022 23:22:43 +0200 Subject: [PATCH] pmbootstrap log: show testsuite log too When running the testsuite, most logging gets written to a separate log_testsuite.txt file. Check if it exists, and if so, instruct tail to print its output as well. This allows immediatelly figuring out what the testsuite is doing without manually attaching to log_testsuite.txt (which I often did while running the testsuite). --- pmb/helpers/frontend.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 77735cfb..e9e24370 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -541,8 +541,21 @@ def work_migrate(args): def log(args): if args.clear_log: pmb.helpers.run.user(args, ["truncate", "-s", "0", args.log]) - pmb.helpers.run.user(args, ["tail", "-n", args.lines, "-F", args.log], - output="tui") + + cmd = ["tail", "-n", args.lines, "-F"] + + # Follow the testsuite's log file too if it exists. It will be created when + # starting a test case that writes to it (git -C test grep log_testsuite). + log_testsuite = f"{args.work}/log_testsuite.txt" + if os.path.exists(log_testsuite): + cmd += [log_testsuite] + + # tail writes the last lines of the files to the terminal. Put the regular + # log at the end, so that output is visible at the bottom (where the user + # looks for an error / what's currently going on). + cmd += [args.log] + + pmb.helpers.run.user(args, cmd, output="tui") def log_distccd(args):