diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13ddf04..885c18f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - name: Check ATP tester image selection + if: runner.os == 'Linux' + run: sh atp/scripts/test_tester_image.sh - uses: actions/setup-node@v4 with: node-version: "22.19.0" diff --git a/atp/CoreTrace-GUI_ATP.xlsx b/atp/CoreTrace-GUI_ATP.xlsx index f21280e..29aed26 100644 Binary files a/atp/CoreTrace-GUI_ATP.xlsx and b/atp/CoreTrace-GUI_ATP.xlsx differ diff --git a/atp/CoreTrace-GUI_ATP_appendices.zip b/atp/CoreTrace-GUI_ATP_appendices.zip index eb6ee6a..9e5e615 100644 Binary files a/atp/CoreTrace-GUI_ATP_appendices.zip and b/atp/CoreTrace-GUI_ATP_appendices.zip differ diff --git a/atp/README.md b/atp/README.md index 2ffa109..6d1d4ba 100644 --- a/atp/README.md +++ b/atp/README.md @@ -41,6 +41,22 @@ so `./build.sh` was refused outright. `make_appendices_zip.py` normalises line endings, sets 0755 on scripts, and marks entries as Unix-created so `unzip` honours the mode at all. +## Acceptance run on 2026-11-22 + +Tested the published v6.0.0-beta.3 Linux package and ctrace v0.85.0 from the +appendices ZIP on Docker Desktop for macOS (amd64 container, UID 501). +The run used a fresh dataset and a signed-out session. + +| Scenarios | Result | Observed | +|---|---|---| +| F1–F9 | PASS | noVNC connected, version and licence matched, edits persisted on the host, discard and refresh worked, and the app prompted for and accepted ctrace. | +| F10–F16 | PASS | DS01–DS07 returned 1, 0, 2, 0, 2, 2 and 0 findings. Recursion showed an error and a note. The unsupported file showed the tool failure. | +| F17 | PASS | Clicking the DS01 finding opened the editor on line 12. | +| F18 | FAIL | The app analysed 6 of 6 files and displayed 0 of the expected 7 findings. The raw output contained findings. | +| F19–F21 | PASS | The device-code dialog opened and could be dismissed. Public cloning worked while signed out. Ctrl+S saved to disk. Ctrl+P, Tab, DS01 and Enter opened the file. | +| F22 | FAIL | Ctrl+F left focus in the editor. Typing `buf` edited the source. | +| F23–F24 | Account required (expected) | Sign-in waited for external approval. Cloud analysis was disabled while signed out. No job was submitted or billed. | + ## Known gaps to close before the next test cycle Found while running the plan against v6.0.0-beta.3 in Docker: diff --git a/atp/appendices/README.md b/atp/appendices/README.md index e8d33e7..0fb25ee 100644 --- a/atp/appendices/README.md +++ b/atp/appendices/README.md @@ -12,7 +12,8 @@ appendices/ │ ├── Dockerfile │ ├── entrypoint.sh │ ├── build.sh -│ └── run.sh +│ ├── run.sh +│ └── tester.sh └── datasets/ ← C/C++ corpus with known, verified expected results ├── MANIFEST.md ← the expected result of every file ├── DS01_stack_overflow.c @@ -47,7 +48,16 @@ cd appendices/docker ./run.sh # mounts ../datasets at /home/tester/workspace ``` -Then open . The page connects on its own — there is no +On Linux, use Docker Engine with its default UID mapping. Rootless Docker and +daemons configured with `userns-remap` translate file owners on bind mounts, +so the tester cannot write the host-owned dataset with its default permissions. + +Build and run as the user who owns the extracted dataset. If you override +`TESTER_UID`, set it to the same value for both commands. Each UID gets its +own image and container. If another tester is using port 6080, run +`ATP_PORT=6081 ./run.sh` and open the address it prints. + +By default, open . The page connects on its own — there is no Connect button to find — and shows the CoreTrace window. Inside the app, the test data set is at `/home/tester/workspace`. @@ -69,7 +79,8 @@ The container prints a lot at startup — xkbcomp keysym warnings, not stop the application. Judge the container by these instead: ```sh -docker exec coretrace-gui-atp xwininfo -root -tree -display :99 | grep '"CoreTrace"' +# Use the container name and port printed by run.sh (example for UID 1000). +docker exec coretrace-gui-atp-1000 xwininfo -root -tree -display :99 | grep '"CoreTrace"' curl -s -o /dev/null -w '%{http_code}\n' http://localhost:6080/ ``` diff --git a/atp/appendices/docker/Dockerfile b/atp/appendices/docker/Dockerfile index 6230033..5b7105b 100644 --- a/atp/appendices/docker/Dockerfile +++ b/atp/appendices/docker/Dockerfile @@ -65,7 +65,11 @@ RUN mkdir -p /opt/coretrace \ # /tmp/.X11-unix is created here because Xvfb cannot create it as a non-root user # and prints an alarming "ERROR" when it is missing, even though it goes on to # start normally — a tester should not have to judge whether that is a defect. -RUN useradd -m -s /bin/bash tester && mkdir -p /home/tester/workspace \ +# ubuntu:24.04 ships a "ubuntu" user with UID 1000: remove it so tester can take the +# host user's UID, or the mounted data set is read-only inside the container. +ARG TESTER_UID=1000 +RUN userdel -r ubuntu 2>/dev/null || true \ + && useradd -m -l -u "$TESTER_UID" -s /bin/bash tester && mkdir -p /home/tester/workspace \ && chown -R tester:tester /home/tester \ && mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix diff --git a/atp/appendices/docker/build.sh b/atp/appendices/docker/build.sh old mode 100644 new mode 100755 index 8db02cc..747e799 --- a/atp/appendices/docker/build.sh +++ b/atp/appendices/docker/build.sh @@ -8,6 +8,8 @@ PLATFORM_FLAG="" if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then PLATFORM_FLAG="--platform linux/amd64" fi +. "$(dirname "$0")/tester.sh" # shellcheck disable=SC2086 -docker build $PLATFORM_FLAG --build-arg CORETRACE_VERSION="$VERSION" -t coretrace-gui-atp . +docker build $PLATFORM_FLAG --build-arg CORETRACE_VERSION="$VERSION" \ + --build-arg TESTER_UID="$TESTER_UID" -t "$IMAGE" . echo "Image built: coretrace-gui-atp (CoreTrace Desktop $VERSION)" diff --git a/atp/appendices/docker/entrypoint.sh b/atp/appendices/docker/entrypoint.sh index 73e327e..a9bd41d 100644 --- a/atp/appendices/docker/entrypoint.sh +++ b/atp/appendices/docker/entrypoint.sh @@ -18,8 +18,6 @@ openbox & x11vnc -display :99 -forever -shared -nopw -quiet -rfbport 5900 & websockify --web=/usr/share/novnc 6080 localhost:5900 & -echo "CoreTrace is starting. Open http://localhost:6080/ in a browser (it connects on its own)." - # There is no GPU in the container: make WebKitGTK render in software instead of # opening a blank window. export WEBKIT_DISABLE_COMPOSITING_MODE=1 diff --git a/atp/appendices/docker/run.sh b/atp/appendices/docker/run.sh old mode 100644 new mode 100755 index 2200fbc..8e92970 --- a/atp/appendices/docker/run.sh +++ b/atp/appendices/docker/run.sh @@ -2,16 +2,21 @@ # Starts the acceptance-test container and mounts the test data set read-write # (scenarios create, rename and delete files, so it must not be read-only). set -e +. "$(dirname "$0")/tester.sh" +ATP_PORT="${ATP_PORT:-6080}" DATASETS="${1:-$(cd "$(dirname "$0")/../datasets" && pwd)}" PLATFORM_FLAG="" if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then PLATFORM_FLAG="--platform linux/amd64" fi +echo "Starting coretrace-gui-atp-$TESTER_UID at http://localhost:$ATP_PORT/" echo "Mounting data set: $DATASETS -> /home/tester/workspace" +# noVNC has no password and the data set is writable: publish the port on this machine +# only, never on the network. # shellcheck disable=SC2086 docker run --rm -it $PLATFORM_FLAG \ - --name coretrace-gui-atp \ - -p 6080:6080 \ + --name "coretrace-gui-atp-$TESTER_UID" \ + -p "127.0.0.1:$ATP_PORT:6080" \ -v "$DATASETS":/home/tester/workspace \ --shm-size=1g \ - coretrace-gui-atp + "$IMAGE" diff --git a/atp/appendices/docker/tester.sh b/atp/appendices/docker/tester.sh new file mode 100644 index 0000000..b58c121 --- /dev/null +++ b/atp/appendices/docker/tester.sh @@ -0,0 +1,29 @@ +# Shared by build.sh and run.sh so both select the same image. +# The container user takes the UID of whoever owns the mounted data set, so the app can +# change its files. Under sudo, that is the user who ran sudo, not root. +if [ -z "$TESTER_UID" ]; then + TESTER_UID="$(id -u)" + if [ "$TESTER_UID" = "0" ] && [ -n "$SUDO_UID" ]; then + TESTER_UID="$SUDO_UID" + fi +fi +# Check the UID here, so a bad value fails now rather than after the package downloads. +case "$TESTER_UID" in + '' | *[!0-9]*) + echo "TESTER_UID must be a decimal number, not '$TESTER_UID'." >&2 + exit 1 + ;; +esac +# Drop leading zeros: "0010" is UID 10, and "0000" is root. +TESTER_UID="$(printf '%s' "$TESTER_UID" | sed 's/^0*//')" +if [ "${#TESTER_UID}" -gt 10 ] || [ "${TESTER_UID:-0}" -gt 4294967294 ]; then + echo "TESTER_UID is out of range: the largest UID is 4294967294." >&2 + exit 1 +fi +if [ -z "$TESTER_UID" ]; then + echo "Run the ATP scripts as your own user, or set TESTER_UID to the" >&2 + echo "UID that owns the data set. To use Docker without sudo, see" >&2 + echo "https://docs.docker.com/engine/install/linux-postinstall/" >&2 + exit 1 +fi +IMAGE="coretrace-gui-atp:uid-$TESTER_UID" diff --git a/atp/scripts/gen_atp.py b/atp/scripts/gen_atp.py index d6a7e63..36b2cff 100644 --- a/atp/scripts/gen_atp.py +++ b/atp/scripts/gen_atp.py @@ -41,7 +41,7 @@ ] GETTING_STARTED = [ - "1. Install Docker (Docker Desktop on macOS and Windows) and start it. Nothing else is needed: the plan runs the same way on Linux, macOS and Windows.", + "1. Install Docker (Docker Desktop on macOS and Windows) and start it. On Linux, use Docker Engine with default UID mapping (see the appendices README).", "2. Download CoreTrace-GUI_ATP_appendices.zip, delivered alongside this workbook, and unzip it. It contains the Docker environment, the test data set and a README.", "3. In a terminal, go to appendices/docker and run ./build.sh (once, about 5 minutes), then ./run.sh. On Windows, use WSL or Git Bash.", "4. Open http://localhost:6080/ in a browser: the CoreTrace window appears. The test data set is already mounted at /home/tester/workspace.", @@ -58,7 +58,7 @@ S = [ ("F1", "Launch the application through Docker", CRIT, "Bring the test environment up from the published package, with no build step.", - "Any computer (Linux, macOS or Windows) with Docker installed and running, 3 GB of free disk space, an internet connection. On Windows, run the scripts from WSL or Git Bash.", + "Linux with default Docker UID mapping, macOS or Windows with Docker installed and running, 3 GB of free disk space, an internet connection. On Windows, run the scripts from WSL or Git Bash.", "1. Unzip the appendices archive\n2. cd appendices/docker\n3. Run ./build.sh (about 5 min the first time)\n4. Run ./run.sh\n5. Open http://localhost:6080/ in a browser (it connects on its own)", "The build ends with 'Image built: coretrace-gui-atp (CoreTrace Desktop 6.0.0-beta.3)'. The browser shows a window titled 'CoreTrace'. Its left menu lists 'Nouvelle analyse', 'Accueil', 'Analyses', 'Dépôts', 'Espace de code' and 'Paramètres'. The home page reads 'Bonjour. Que souhaitez-vous analyser ?' and the bottom-right corner reads 'Aucun dossier ouvert'.", DONE), @@ -149,7 +149,7 @@ ("F16", "Unsupported input file", CRIT, "Never present a file that could not be analysed as clean.", "ctrace is selected (F9) and the workspace is open.", - "1. In 'Espace de code', open DS07_invalid.txt\n" + RUN + "\n5. Click 'Sortie de ctrace' to unfold the raw output", + "1. In 'Espace de code', open DS07_invalid.txt\n" + RUN + "\n5. Read 'Sortie de ctrace' (click to expand it if it is collapsed)", "The status reads 'Terminée avec avertissements' and a banner states 'Un ou plusieurs outils n'ont pas pu terminer l'analyse.' The page shows 'Résultats 0'. The unfolded output quotes the analyser: 'Unsupported input file type' and 'Failed to analyze'. The application does not hang and stays usable.", DONE), ("F17", "Jump from a finding to the code", CRIT, @@ -179,7 +179,7 @@ ("F21", "Keyboard shortcuts: save and quick open", UI, "Save a file and open another one without the mouse.", "The workspace is open (F3). Click once inside the application so the keyboard goes to it. If your browser keeps a shortcut for itself, open the noVNC panel on the left edge of the page, click 'Show extra keys', click 'Ctrl', press the letter, then click 'Ctrl' again.", - "1. Click DS04_infeasible_path.c in the file tree\n2. Click at the end of the last line and type: // key\n3. Press Ctrl+S\n4. Press Ctrl+P\n5. Type DS01 and press Enter", + "1. Click DS04_infeasible_path.c in the file tree\n2. Click at the end of the last line and type: // key\n3. Press Ctrl+S\n4. Press Ctrl+P\n5. Press Tab if the close button has focus, then type DS01 in 'Nom ou chemin…' and press Enter", "After step 2 the 'Enregistrer' button is active. After step 3 it is greyed out again without having been clicked. After step 4 a dialog 'Ouvrir un fichier' opens with a field 'Nom ou chemin…' and lists the files of the folder. After step 5 the dialog closes and DS01_stack_overflow.c is open in the editor.", DONE), ("F22", "Search in a file", UI, @@ -249,10 +249,10 @@ info.cell(row=note, column=1, value="Notes").font = Font(bold=True, size=12) NOTES = [ "Version under test: CoreTrace Desktop v6.0.0-beta.3, installed from its published Linux package. The interface is in French; the plan quotes its labels as displayed.", - "The whole plan runs in the Docker image in appendices/docker, on any computer with Docker (Linux, macOS, Windows). No scenario depends on the tester's operating system.", + "The whole plan runs in the Docker image in appendices/docker, on Linux with default Docker UID mapping, macOS or Windows. No scenario depends on the tester's operating system.", "Local analysis uses ctrace v0.85.0, installed in the image at /opt/coretrace/bin/ctrace, with clang 20. Do not use ctrace v0.74.0: the application cannot read the report that version writes ('Format de rapport non reconnu').", "Only the stack analyser built into ctrace runs. cppcheck, tscancode, ikos and flawfinder are not installed in the image; the application lists them as missing (scenario F9).", - "F23 and F24 need a CoreTrace account and spend its CTU; every other scenario runs without an account. Out of scope: connected repositories, organisation dashboards and automatic updates.", + "F23 and F24 require a CoreTrace account. Without one, record both as account required. Only a confirmed cloud run in F24 spends CTU. Out of scope: connected repositories, organisation dashboards and automatic updates.", "A scenario is validated when every expected result is obtained with no blocking or critical anomaly. Report anything else in the Feedback column of the test plan.", ] for i, line in enumerate(NOTES): diff --git a/atp/scripts/test_tester_image.sh b/atp/scripts/test_tester_image.sh new file mode 100644 index 0000000..561d671 --- /dev/null +++ b/atp/scripts/test_tester_image.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Exercise both entry points without building images or starting a container. +set -eu +docker_dir=$(cd "$(dirname "$0")/../appendices/docker" && pwd) +temp=$(mktemp -d) +trap 'rm -rf "$temp"' EXIT +printf '%s\n' '#!/bin/sh' 'printf "%s\n" "$@"' > "$temp/docker" +printf '%s\n' '#!/bin/sh' 'echo "$HOST_UID"' > "$temp/id" +chmod +x "$temp/docker" "$temp/id" +export PATH="$temp:$PATH" +cd "$docker_dir" + +check_image() { + ./build.sh > "$temp/build" + ./run.sh > "$temp/run" + grep -Fxq "TESTER_UID=$1" "$temp/build" + grep -Fxq "coretrace-gui-atp:uid-$1" "$temp/build" + grep -Fxq "coretrace-gui-atp:uid-$1" "$temp/run" + grep -Fxq "coretrace-gui-atp-$1" "$temp/run" +} + +unset SUDO_UID TESTER_UID +export HOST_UID=501 +check_image 501 +export HOST_UID=0 SUDO_UID=1000 +check_image 1000 +export TESTER_UID=001001 +check_image 1001 +for TESTER_UID in 0 0000 invalid 4294967295; do + if ./build.sh >/dev/null 2>&1 || ./run.sh >/dev/null 2>&1; then + echo "Accepted invalid TESTER_UID=$TESTER_UID" >&2 + exit 1 + fi +done