Skip to content

Commit 9849621

Browse files
committed
test: qtdragon ui-smoke runs against writable config mirror
CI run hit a PermissionError in qtvcp's logger when it tried to open configs/sim/qtdragon/qtdragon_xyz/qtdragon.log for write: the GitHub Actions workspace is mounted read-only for the docker build user, and qtvcp resolves LOG_FILE = qtdragon.log into the config dir. hal_bridge then exits, linuxcnc tears down, and the driver retries ESTOP_RESET until the budget is exhausted. qtdragon test.sh now mirrors the qtdragon_xyz config dir to a mktemp directory, seds LOG_FILE to ~/qtdragon.log, and passes the absolute INI path to run-gui.sh. run-gui.sh treats any path starting with / as absolute; everything else still resolves under configs/sim. Trap cleans the tmp dir on exit so the working tree stays clean. Does not touch the shipped qtdragon config to avoid changing default behaviour for real users. The same fix would work for any other config that turns out to write into its own dir on CI.
1 parent 7725b56 commit 9849621

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

tests/ui-smoke/_lib/run-gui.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@ LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1212
TEST_DIR="${TEST_DIR:-$(cd "$(dirname "$0")" && pwd)}"
1313
CONFIGS_DIR="$(cd "$LIB_DIR/../../../configs/sim" && pwd)"
1414

15-
INI_REL="$1"
15+
INI_ARG="$1"
1616
shift
1717

18+
# Accept either a relative path under configs/sim/ or an absolute path.
19+
# Absolute paths are used by tests that need to point at a writable
20+
# mirror of a shipped config (qtdragon writes a log file inside the
21+
# config dir, which is read-only on CI).
22+
case "$INI_ARG" in
23+
/*) INI_PATH="$INI_ARG" ;;
24+
*) INI_PATH="$CONFIGS_DIR/$INI_ARG" ;;
25+
esac
26+
1827
export TEST_DIR
19-
exec "$LIB_DIR/launch.sh" "$CONFIGS_DIR/$INI_REL" "$@"
28+
exec "$LIB_DIR/launch.sh" "$INI_PATH" "$@"

tests/ui-smoke/qtdragon/test.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
#!/bin/bash
2+
# qtdragon's qtvcp logger writes its log file (path from INI [DISPLAY]
3+
# LOG_FILE) into the config directory. CI mounts the workspace read-
4+
# only for the runtime user, so a relative LOG_FILE like 'qtdragon.log'
5+
# resolves to a path qtvcp cannot create, hal_bridge then exits, and
6+
# linuxcnc tears down before our driver can do anything. Mirror the
7+
# config dir to a writable tmp location and patch LOG_FILE to be
8+
# rooted at $HOME so the log lands in a directory we can write to.
9+
set -u
10+
211
LIB_DIR="$(cd "$(dirname "$0")/../_lib" && pwd)"
3-
exec "$LIB_DIR/run-gui.sh" qtdragon/qtdragon_xyz/qtdragon_metric.ini \
12+
SRC_DIR="$(cd "$LIB_DIR/../../../configs/sim/qtdragon/qtdragon_xyz" && pwd)"
13+
14+
WORK_DIR="$(mktemp -d -t ui-smoke-qtdragon.XXXXXX)"
15+
trap 'rm -rf "$WORK_DIR"' EXIT
16+
cp -r "$SRC_DIR/." "$WORK_DIR/"
17+
sed -i 's|^LOG_FILE = qtdragon\.log$|LOG_FILE = ~/qtdragon.log|' \
18+
"$WORK_DIR/qtdragon_metric.ini"
19+
20+
exec "$LIB_DIR/run-gui.sh" "$WORK_DIR/qtdragon_metric.ini" \
421
--run-program "$LIB_DIR/smoke.ngc" --expect-delta-mm 1,1,0

0 commit comments

Comments
 (0)