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).
This commit is contained in:
Oliver Smith 2022-10-20 23:22:43 +02:00
parent 8770aba287
commit 4428c7bcdc
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 15 additions and 2 deletions

View File

@ -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):