smoketest: write run_in_vm's log as the command runs
So a long command (install.sh takes an hour or more) can be followed with tail -f; run_in_vm prints the log's path when it starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,14 +47,15 @@ skip() {
|
||||
|
||||
# run_in_vm NAME SCRIPT: run SCRIPT in the VM, keeping its output in $OUTPUT,
|
||||
# its exit status in $STATUS, and both in NN-NAME.log. Doesn't fail on its own:
|
||||
# check with assert_status.
|
||||
# check with assert_status. The log is written as SCRIPT runs, so a long one
|
||||
# (install.sh takes an hour or more) can be followed with tail -f.
|
||||
run_in_vm() {
|
||||
RUN_COUNT=$((RUN_COUNT + 1))
|
||||
LAST_RUN="$1"
|
||||
LAST_LOG="$SMOKETEST_RESULTS/$(printf '%02d' "$RUN_COUNT")-$1.log"
|
||||
echo "== $1"
|
||||
OUTPUT="$(vm_exec "$2" 2>&1)" && STATUS=0 || STATUS=$?
|
||||
printf '%s\n' "$OUTPUT" > "$LAST_LOG"
|
||||
echo "== $1 (to follow it: tail -f $LAST_LOG)"
|
||||
vm_exec "$2" > "$LAST_LOG" 2>&1 && STATUS=0 || STATUS=$?
|
||||
OUTPUT="$(cat "$LAST_LOG")"
|
||||
echo "== $1 exited $STATUS (log: $LAST_LOG)"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user