Skip to content

Skip pre-1.0.2 Terraform test cases on Apple Silicon without Rosetta 2 - #542

Open
marcleblanc2 wants to merge 1 commit into
tfutils:masterfrom
marcleblanc2:test/skip-pre-1.0.2-without-rosetta
Open

marcleblanc2 wants to merge 1 commit into
tfutils:masterfrom
marcleblanc2:test/skip-pre-1.0.2-without-rosetta

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Oct 30, 2026 •

Copy link
Copy Markdown

Description

On Apple Silicon without Rosetta 2, four test suites fail on master:

bin/terraform: line 32: .../versions/0.12.1/terraform: Bad CPU type in executable

HashiCorp shipped no darwin_arm64 builds before Terraform 1.0.2, so tfenv-install correctly falls back to darwin_amd64 for those versions (see #437, #372). The binary installs, but check_installed_version / check_active_version cannot execute it without Rosetta. install_and_use, prerelease_filter, use_dash and use_latestallowed all exercise pre-1.0.2 versions, so AGENTS.md's "run the test suite locally and verify all tests pass" is impossible on such a machine.

This PR makes the suite Rosetta-aware without losing coverage anywhere Rosetta is present:

  • test_common.sh: can_run_pre_1_0_2_terraform() returns false only on Darwin arm64 where arch -x86_64 /usr/bin/true fails. Linux, Windows, Intel macOS and Apple Silicon with Rosetta are unaffected.
  • Cases that exist specifically to exercise 0.x ranges (latest:^0.14., latest:^0.11., 0.11.15-oci, <=0.13.0-rc1, ~> 0.12) are skipped with a warn log when it returns false, following the existing "We're Darwin! Skipping legacy tests" pattern.
  • Cases that only used an old version incidentally now use 1.x so they run everywhere: tfenv use - (0.12.1/0.12.2 → 1.6.0/1.6.1), v prefix (v0.14.6 → v1.5.7), -chdir auto-install (~> 0.14.3 → ~> 1.6.3, resolving to 1.6.6).

No change to lib/, libexec/ or bin/.

Issue Link

Fixes #543

Related: #437, #372 (maintainer confirmed Rosetta 2 is the supported path for pre-1.0.2 on Apple Silicon)

Testing

  • Ran ./test/run.sh locally; all suites pass. The four affected suites now log a skip for the pre-1.0.2 cases and pass the rest, where on master they fail with Bad CPU type in executable.
  • Tested on at least one platform (note which below)
  • This branch passes on macos-latest (arm64, Rosetta 2 present) and ubuntu-latest with this repo's unchanged test.yml run on a fork (run 41151236326): all 15 suites pass, and on macOS the pre-1.0.2 cases run rather than skip, so CI coverage is unchanged. Note: fork PR runs on this repo currently die before any job starts ("workflow file issue"), so the checks here have not executed.
  • New tests added: none; existing cases reorganised

Platform tested: macOS 26 (arm64), no Rosetta 2 installed

Quality Checklist

  • Shell quoting verified — all variables quoted, braces used
  • Cross-platform considered — BSD vs GNU tool differences (arch is macOS-only and only reached on Darwin)
  • No unintended changes to other commands
  • README.md updated (not user-facing)
  • CHANGELOG.md updated (test-only change)

HashiCorp shipped no darwin_arm64 builds before Terraform 1.0.2, so tfenv
installs the amd64 build for those versions. Without Rosetta 2 the binary
installs but cannot run, and install_and_use, prerelease_filter, use_dash
and use_latestallowed fail with 'Bad CPU type in executable'.

Adds can_run_pre_1_0_2_terraform to test_common.sh and skips the cases
that exist specifically to exercise 0.x version ranges when it returns
false, following the existing Darwin legacy-version skip. Cases that only
used an old version incidentally (use -, v prefix, -chdir auto-install)
now use 1.x versions so they run everywhere.

Amp-Thread-ID: https://ampcode.com/threads/T-01a18edd-7c03-774f-890d-1da6f2ebc8c4
Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test suite fails on Apple Silicon without Rosetta 2: pre-1.0.2 cases hit 'Bad CPU type in executable'

1 participant