Skip to content

test(deploy): setup-vm and build-snapshot tests run on macOS's bash 3.2 - #815

Merged
webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i720-bash32
Nov 16, 2026
Merged

webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/i720-bash32

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #720.

Two deploy shell suites stopped under macOS's /bin/bash 3.2. The BSD sed part of #720 was fixed earlier (#717's merge); this PR makes both suites 3.2-clean and adds them to make test-deploy-bash32, which the deploy-scripts-bash32 CI job runs on macOS.

deploy/vm/tests/setup-vm.test.sh

  • mapfile (bash 4) is replaced by read loops for the two arrays checked against main.ts.
  • Three require_cmds cases ran as PATH=/nonexistent require_cmds …. With a prefix assignment to a function call, bash 3.2 keeps its command hash, so command -v still found a hashed command and the "missing tool" checks failed under 3.2. They now set PATH in a subshell (with shellcheck disable=SC2123 on purpose).

deploy/microvm/tests/build-snapshot.test.sh

  • Comments with an apostrophe (scenario 1's comment, preflight's own) sat inside $( … ). bash 3.2 reads the apostrophe as an open quote, so the command substitution never closed: vfs_out was unassigned at the first use and the rest of the file did not parse. The comments are reworded. /bin/bash -n now passes.

Makefile

  • test-deploy-bash32 lists both suites. Its comment no longer names setup-vm.test.sh as a bash-4 suite, and it says how each suite meets the interpreter (build-snapshot.test.sh runs its own checks on /bin/bash; build-snapshot.sh, a Linux-only tool, runs with PATH's bash, and its tests pass with either).

Tested on macOS: both suites under /bin/bash 3.2.57 and bash 5 (every check passes in both), make test-deploy-bash32 (all six suites pass), shellcheck through pre-commit.

Signed-off-by is on the commit (DCO).

Assisted-By: Claude Code

Two deploy shell suites stopped under /bin/bash 3.2:

- deploy/vm/tests/setup-vm.test.sh used `mapfile`, which bash 3.2 lacks.
  It now fills both arrays with a read loop. Three require_cmds cases ran
  as `PATH=/nonexistent require_cmds ...`. With that prefix assignment to
  a function call, bash 3.2 keeps its command hash, so `command -v` still
  found a hashed command and the "missing tool" checks failed. They now
  set PATH in a subshell.
- deploy/microvm/tests/build-snapshot.test.sh had comments with an
  apostrophe ("scenario 1's comment", "preflight's own") inside
  `$( ... )`. bash 3.2 reads that apostrophe as an open quote, so
  `vfs_out` was never assigned and the script failed to parse past it.
  The comments are reworded.

Both suites now pass under /bin/bash 3.2 and bash 5. make
test-deploy-bash32 runs them, and the Makefile comment says how each
suite meets the interpreter.

Closes rossoctl#720

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 15, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes setup-vm.test.sh and build-snapshot.test.sh bash 3.2-clean and adds both to make test-deploy-bash32. Checked: the read loops keep mapfile's semantics, the subshell assignments don't leak PATH/SH_CMD_HINT_DIRS (and require_cmds reads the latter as a shell var, so SC2034 is right), the Makefile's "two" bash-4 suites matches a scan of every test-deploy suite at this head, and build-snapshot.test.sh does run the script under test with PATH's bash. deploy-scripts-bash32 is green and now covers both suites. LGTM.

Assisted-By: Claude Code

@webchang
webchang merged commit ccf393b into rossoctl:main Nov 16, 2026
16 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 16, 2026
Brings rossoctl#815 (setup-vm and build-snapshot tests on macOS's bash 3.2;
both join test-deploy-bash32). No conflicts.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added this to the v0.11.0 milestone Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy shell tests stop on macOS (BSD sed in #701's OIDC cases; two bash 3.2 stops)

3 participants