tools: test run-native.sh's argument checks, and refuse --console=-x (#580) #585

Open
github-bot wants to merge 1 commit from github-bot/gh-581 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:03 UTC · original
AnastasisKon:vibe/run-native-args-tests-4f9c68 → main · +85 −1 · 3 files · 1 commits · open

What this changes

Refs #584.

run-native.sh's first job is refusing bad input clearly — no argument, two targets, --seconds without a value or with a non-number, a value past the timer range, --console without a model, a path that is not a file, and a folder whose download does not hold game_*master.exe yet. All of those paths exist and none was tested (console-default.sh covers only the RAM-to-model rule).

  • A real inconsistency, found by writing the test: --console -h is refused, because the next word starts with - and is therefore a switch, not a model. --console=-h was accepted and handed to the game as the model, so a forgotten model surfaced as the game's own parser error. Both forms now answer the same way.
  • tools/macos/tests/run-native-args.sh pins every check above: the usage paths, each refused value, a path that is not a file, a folder holding no game_*master.exe, and a folder holding a file of the wrong name. Each case asserts both the exit status (2, or 0 for --help) and the message. Every case stops before a game would be launched, so it needs no game and no build.
  • The step joins the macos-scripts CI job, beside the other script tests.

The two "no executable" cases are exactly what a partial download or the wrong folder produces, which is the most common way a first run fails.

How it was tested

  • /bin/bash tools/macos/tests/run-native-args.sh → run-native arguments: ok.
  • The other nine macos-scripts tests, run as ci.yml runs them: target-directory.sh, console-default.sh, verify-target.sh, verify-msc.sh, msc-check.sh, tester-report.sh, run-summary-compare.sh, run-summary.sh --self-test, tools/corpus/compare.sh --self-test — all pass.
  • cargo xtask policy: 399 files ok.
  • ci.yml parses, and the new step sits in the macos-scripts job.
  • By hand, on a real folder that holds the game's archives but not the executable yet: No game_*master.exe found in /Volumes/…, exit 2, nothing launched.
  • Ran the game: not needed, and not possible here yet — that folder's download has not delivered game_scarlett_master.exe.

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md: none added
  • New diagnostics are behind a VICTORY_* variable and documented: none added
**@⁠AnastasisKon** on GitHub · 2026-11-28 10:03 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/581) `AnastasisKon:vibe/run-native-args-tests-4f9c68` → `main` · +85 −1 · 3 files · 1 commits · open ## What this changes Refs #584. `run-native.sh`'s first job is refusing bad input clearly — no argument, two targets, `--seconds` without a value or with a non-number, a value past the timer range, `--console` without a model, a path that is not a file, and a folder whose download does not hold `game_*master.exe` yet. All of those paths exist and none was tested (`console-default.sh` covers only the RAM-to-model rule). - **A real inconsistency, found by writing the test:** `--console -h` is refused, because the next word starts with `-` and is therefore a switch, not a model. `--console=-h` was accepted and handed to the game as the model, so a forgotten model surfaced as the game's own parser error. Both forms now answer the same way. - **`tools/macos/tests/run-native-args.sh`** pins every check above: the usage paths, each refused value, a path that is not a file, a folder holding no `game_*master.exe`, and a folder holding a file of the wrong name. Each case asserts both the exit status (2, or 0 for `--help`) and the message. Every case stops before a game would be launched, so it needs no game and no build. - **The step joins the `macos-scripts` CI job**, beside the other script tests. The two "no executable" cases are exactly what a partial download or the wrong folder produces, which is the most common way a first run fails. ## How it was tested - [x] `/bin/bash tools/macos/tests/run-native-args.sh` → `run-native arguments: ok`. - [x] The other nine `macos-scripts` tests, run as `ci.yml` runs them: `target-directory.sh`, `console-default.sh`, `verify-target.sh`, `verify-msc.sh`, `msc-check.sh`, `tester-report.sh`, `run-summary-compare.sh`, `run-summary.sh --self-test`, `tools/corpus/compare.sh --self-test` — all pass. - [x] `cargo xtask policy`: 399 files ok. - [x] `ci.yml` parses, and the new step sits in the `macos-scripts` job. - [x] By hand, on a real folder that holds the game's archives but not the executable yet: `No game_*master.exe found in /Volumes/…`, exit 2, nothing launched. - [ ] Ran the game: not needed, and not possible here yet — that folder's download has not delivered `game_scarlett_master.exe`. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md: none added - [x] New diagnostics are behind a `VICTORY_*` variable and documented: none added
run-native.sh is the first thing a tester or an agent runs, and its early
exits are what turn a wrong folder or a forgotten value into a clear message
rather than a confusing run. None of them had a test.

Writing one turned up an inconsistency: the space form already refuses a model
that starts with a dash (the next word is a switch, not a model), but the
--console=<value> form accepted it and handed it to the game, so the mistake
surfaced as the game's parser error. Both forms now answer the same way.

The test covers the usage paths, each refused value, a path that is not a
file, and a folder holding no game_*master.exe: every case stops before a
game would be launched, so it needs no game and no build. It joins the
macos-scripts CI job beside the other script tests.

Refs #580
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 10:09:11 +00:00
github-bot force-pushed github-bot/gh-581 from 323af7f33a to b48fdb90e6 2026-11-28 12:33:22 +00:00 Compare
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 12:26 UTC · original

Rebased onto current main (ci.yml step list conflicted with the rustup-path test step; both kept). Bash test, cargo tests, clippy (windows target, --locked, -D warnings) and cargo xtask policy all pass locally.

**@⁠AnastasisKon** on GitHub · 2026-11-28 12:26 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/581#issuecomment-7239225399) Rebased onto current main (ci.yml step list conflicted with the rustup-path test step; both kept). Bash test, cargo tests, clippy (windows target, --locked, -D warnings) and cargo xtask policy all pass locally.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/585/head:github-bot/gh-581'
git switch 'github-bot/gh-581'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-581'
git switch 'github-bot/gh-581'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-581'
git switch 'github-bot/gh-581'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-581'
git switch 'main'
git merge --squash 'github-bot/gh-581'
git switch 'main'
git merge --ff-only 'github-bot/gh-581'
git switch 'main'
git merge 'github-bot/gh-581'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.