Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .agents/skills/labkit-codecheck-fixer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Coordinate with:
5. Run focused validation for the touched area. Examples:

```bash
scripts/run_matlab_tests.sh testLabkitBiosignal
scripts/run_matlab_tests.sh testLabkitDta
scripts/run_matlab_tests.sh testLabkitUi
scripts/run_matlab_tests.sh testAppsImageMeasurement
scripts/run_matlab_tests.sh testProject
buildtool testLabkitBiosignal
buildtool testLabkitDta
buildtool testLabkitUi
buildtool testAppsImageMeasurement
buildtool testProject
```

Pick the smallest source-aligned task that covers the behavior, adding
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/labkit-test-planner/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ another skill already read shared AGENTS context, do not reread it.
## Task Routing

Use the smallest source-aligned validation set that covers the touched
boundary. `docs/testing.md` owns the canonical build-task names, wrappers, and
boundary. `docs/testing.md` owns the canonical build-task names, CI scope, and
command examples.

```text
Expand Down
32 changes: 8 additions & 24 deletions .github/workflows/matlab-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:
cancel-in-progress: true

jobs:
shell-wrapper:
name: Shell Wrapper Checks
repository-hygiene:
name: Repository Hygiene
runs-on: ubuntu-latest
timeout-minutes: 5

Expand All @@ -33,30 +33,14 @@ jobs:
exit 1
fi

- name: Check Bash wrapper syntax
run: bash -n scripts/run_matlab_tests.sh
- name: Check MATLAB batch locator syntax
run: bash -n scripts/matlab_batch.sh

- name: Check Bash wrapper help
run: bash scripts/run_matlab_tests.sh --help
- name: Check MATLAB batch locator help
run: bash scripts/matlab_batch.sh --help

- name: Check Bash wrapper build task smoke
run: MATLAB_CMD=true bash scripts/run_matlab_tests.sh testProject

- name: Check PowerShell wrapper parser
run: pwsh -NoProfile -Command '$null = [scriptblock]::Create((Get-Content -Raw -LiteralPath "scripts/run_matlab_tests.ps1"))'

- name: Check PowerShell wrapper help
run: pwsh -NoProfile -File scripts/run_matlab_tests.ps1 --help

- name: Check PowerShell wrapper build task smoke
run: pwsh -NoProfile -Command '$env:MATLAB_CMD="true"; ./scripts/run_matlab_tests.ps1 testProject'

- name: Check removed selector flags are rejected
run: |
if bash scripts/run_matlab_tests.sh --suite; then
echo "Expected --suite to be rejected"
exit 1
fi
- name: Check MATLAB batch locator smoke
run: MATLAB_CMD=true bash scripts/matlab_batch.sh "buildtool listTasks"

quality:
name: Quality Guardrails
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ When using local lab files to reproduce a bug:

Run relevant automated checks after executable MATLAB, test, fixture, package, or validation-rule changes. Use focused checks during iteration and the default non-GUI build task for broad changes.

Use `docs/testing.md` as the canonical command matrix for build tasks, wrapper
behavior, CI scope, fixture expectations, and GUI validation limits. Scoped
Use `docs/testing.md` as the canonical command matrix for build tasks, CI
scope, fixture expectations, and GUI validation limits. Scoped
`AGENTS.md` files should only route by ownership and should not duplicate the
full task list.

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ These docs are written for people who run, maintain, or extend LabKit. Start wit
| --- | --- |
| `../README.md` | Project overview, app launch list, and the default validation entry point. |
| `*.md` component docs | Human-readable behavior, architecture, public APIs, and maintenance contracts. |
| `testing.md` | The canonical build-task matrix, wrapper behavior, CI scope, fixture expectations, and GUI validation limits. |
| `testing.md` | The canonical build-task matrix, CI scope, fixture expectations, and GUI validation limits. |
| `../AGENTS.md` and scoped `AGENTS.md` files | Future execution rules for agent work, ownership red lines, and routing rules. |
| `../.agents/migration_guide.md` | Agent-facing migration debt ledger, current debt snapshot, and future debt-handling rules. |
| `../.agents/skills/` | Task procedures for boundary checks, app building, migration planning, and validation routing. |
Expand Down
54 changes: 19 additions & 35 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,16 @@ Default non-GUI build task:
buildtool test
```

On Windows PowerShell:
If MATLAB is not on `PATH`, use the thin MATLAB locator:

```powershell
.\scripts\run_matlab_tests.ps1 test
```

If local execution policy blocks direct `.ps1` execution, run:

```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\run_matlab_tests.ps1 test
```bash
scripts/matlab_batch.sh "buildtool test"
```

Both wrappers accept build task names only and call `buildtool`. Selector flags
such as `--suite`, `--test`, and `--gui` are not supported. Set `MATLAB_CMD`
when MATLAB is not on `PATH`, set `MATLAB_FLAGS` for MATLAB startup flags, and
set `MATLAB_TEST_LOG` to override the default `matlab_test.log` location. Run
`buildtool listTasks` or `scripts/run_matlab_tests.sh listTasks` to inspect the
current task catalog.
`scripts/matlab_batch.sh` only locates MATLAB, changes to the repository root,
and runs the supplied MATLAB `-batch` command. It does not parse test task names
or maintain a separate test interface. Set `MATLAB_CMD` when MATLAB is not on
`PATH`. Run `buildtool listTasks` to inspect the current task catalog.

Advanced targeted debugging can call the internal runner directly:

Expand All @@ -112,12 +104,12 @@ commands.
| Focused GUI build tasks | Local MATLAB with graphics support | Noninteractive launch, layout, and callback wiring checks for selected app families. |
| Manual GUI validation | User-run app windows | Interactive file selection, drawing, visual inspection, and full workflow feel. |

CI runs shell-wrapper, quality, unit, and integration jobs on pushes and pull
requests for every branch through `.github/workflows/matlab-tests.yml`. Manual and
scheduled CI runs also execute coverage, GUI structural, and non-blocking GUI
gesture jobs. Coverage is intentionally outside the default PR gate to keep PR
feedback focused and avoid duplicate test execution. Do not describe CI as full
interactive GUI workflow validation.
CI runs repository-hygiene, quality, unit, and integration jobs on pushes and
pull requests for every branch through `.github/workflows/matlab-tests.yml`.
Manual and scheduled CI runs also execute coverage, GUI structural, and
non-blocking GUI gesture jobs. Coverage is intentionally outside the default PR
gate to keep PR feedback focused and avoid duplicate test execution. Do not
describe CI as full interactive GUI workflow validation.

Each MATLAB CI job writes a GitHub Step Summary with JUnit totals, artifact
locations, the slowest test cases, and failed-test details when available.
Expand All @@ -127,12 +119,12 @@ artifacts; GitHub Actions does not render artifact HTML inline, so interactive
HTML browsing still requires downloading the artifact or adding a separate
publishing target.

The shell-wrapper job owns repository-level checks that are cheaper and safer
outside MATLAB, including the rule that `LabKit.prj` and `resources/project/`
must stay untracked local IDE metadata. MATLAB build tasks should not shell out
to git for this repository-state check. CI jobs also use explicit job timeouts
so a MATLAB process hang fails quickly instead of consuming the GitHub Actions
six-hour default.
The repository-hygiene job owns repository-level checks that are cheaper and
safer outside MATLAB, including the rule that `LabKit.prj` and
`resources/project/` must stay untracked local IDE metadata. MATLAB build tasks
should not shell out to git for this repository-state check. CI jobs also use
explicit job timeouts so a MATLAB process hang fails quickly instead of
consuming the GitHub Actions six-hour default.

## Focused Build Tasks

Expand All @@ -155,14 +147,6 @@ buildtool testGuiStructural
buildtool testGuiGesture
```

Use task names from Windows PowerShell:

```powershell
.\scripts\run_matlab_tests.ps1 testLabkitDta
.\scripts\run_matlab_tests.ps1 testAppsElectrochem
.\scripts\run_matlab_tests.ps1 testGuiStructural
```

Focused build tasks mirror source ownership:

| Task | Use it for |
Expand Down
65 changes: 65 additions & 0 deletions scripts/matlab_batch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

usage() {
cat <<'USAGE'
Usage: scripts/matlab_batch.sh MATLAB_COMMAND

Finds MATLAB, changes to the LabKit repository root, and runs MATLAB_COMMAND
with MATLAB -batch.

Examples:
scripts/matlab_batch.sh "buildtool test"
scripts/matlab_batch.sh "buildtool testProject"
scripts/matlab_batch.sh "buildtool listTasks"

Environment:
MATLAB_CMD Optional path or command name for MATLAB.
USAGE
}

if [[ $# -ne 1 || "$1" == "-h" || "$1" == "--help" ]]; then
usage
if [[ $# -eq 1 && ( "$1" == "-h" || "$1" == "--help" ) ]]; then
exit 0
fi
exit 2
fi

find_matlab() {
if [[ -n "${MATLAB_CMD:-}" ]]; then
printf '%s\n' "$MATLAB_CMD"
return 0
fi

if command -v matlab >/dev/null 2>&1; then
command -v matlab
return 0
fi

local candidate
for candidate in /Applications/MATLAB_*.app/bin/matlab; do
if [[ -x "$candidate" ]]; then
printf '%s\n' "$candidate"
return 0
fi
done

return 1
}

matlab_literal() {
local value="$1"
value="${value//\'/\'\'}"
printf "'%s'" "$value"
}

MATLAB_BIN="$(find_matlab || true)"
if [[ -z "$MATLAB_BIN" ]]; then
echo "MATLAB executable not found. Set MATLAB_CMD=/path/to/matlab." >&2
exit 127
fi

exec "$MATLAB_BIN" -batch "cd($(matlab_literal "$ROOT_DIR")); $1;"
Loading
Loading