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

Open
AnastasisKon wants to merge 1 commit from upstream-pr/581 into main
AnastasisKon commented 2026-11-28 10:03:14 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:03:14Z.


What this changes

Refs #580.

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
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5539008259 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/581). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T10:03:14Z. --- ## What this changes Refs #580. `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
AnastasisKon commented 2026-11-28 12:26:10 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:26:10Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239225399 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/581#issuecomment-7239225399). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:26:10Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/581:upstream-pr/581'
git switch 'upstream-pr/581'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/581'
git switch 'upstream-pr/581'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/581'
git switch 'upstream-pr/581'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/581'
git switch 'main'
git merge --squash 'upstream-pr/581'
git switch 'main'
git merge --ff-only 'upstream-pr/581'
git switch 'main'
git merge 'upstream-pr/581'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS!581
No description provided.