vlang / vlang/v

cmd/v: `macos_v3_test.v` and `macos_v3_external_fallback_test.v` fail on the `-old-compiler` tools lanes — `@VEXE` is `v1_fallback`, not the V3 dispatcher

Open
#28,512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
V
Stars
37.9k
Forks
2.3k
Avg merge
17h 8m
Merged PRs (30d)
448

Description

Describe the bug

cmd/v/macos_v3_test.v and cmd/v/macos_v3_external_fallback_test.v both drive @VEXE and assume it is the V3 dispatcher v. On the tools-* CI lanes that set VFLAGS=-old-compiler ... (tools-linux, tools-macos, tools-docker-ubuntu-musl in .github/workflows/tools_ci.yml), ./v -silent test-self cmd dispatches to v1_fallback, so the test binaries are compiled by — and @VEXE points at — v1_fallback. Both tests then fail:

cmd/v/macos_v3_test.v:85: fn test_macos_v3_explicit_build_reports_a_regular_input_error
  > assert result.output.trim_space() == 'builder error: help doesn't exist', result.output
    Left value  (len: 29): `builder error:  doesn't exist`
    Right value (len: 33): `builder error: help doesn't exist`

cmd/v/macos_v3_external_fallback_test.v:70: fn test_macos_v3_uses_external_v1_fallback_after_c_compilation_error
   > assert strict.exit_code != 0, strict.output
     Left value: `0`

Reproduce lines from the run confirm the binary: '/home/runner/work/v/v/v1_fallback' -silent '/home/runner/work/v/v/cmd/v/macos_v3_test.v', VFLAGS was: "-old-compiler -cc gcc".

CI: tools-linux (gcc), tools-linux (tcc), tools-macos (clang) on #28503.

Per test:

  • test_macos_v3_explicit_build_reports_a_regular_input_error (added in 6eb1613ba2, #28490): runs @VEXE build help and expects the V3 message. The legacy builder prints the path as empty:
    $ ./v1_fallback build help
    builder error:  doesn't exist
    $ ./v build help
    builder error: help doesn't exist
    
    That empty path is itself a small legacy-builder bug (vlib/v/builder/compile.v:103 interpolates pref_.path, which is '' for build help — the legacy build command handling apparently does not carry help into pref.path), but the test cannot pass against v1_fallback regardless, since it also asserts -new-compiler build help behaviour.
  • test_macos_v3_uses_external_v1_fallback_after_c_compilation_error (added in 16b3017bcd, #28417): its stub C compiler exec cc "$@" only when ${VEXE##*/} = v1_fallback and exits 1 otherwise, then expects V_MACOS_V3_NO_FALLBACK=1 to make the build fail. When @VEXE is v1_fallback there is no V3 stage to reject, cc runs, the build succeeds, and strict.exit_code == 0.
Reproduction Steps
VFLAGS=-old-compiler ./v test cmd/v/macos_v3_test.v cmd/v/macos_v3_external_fallback_test.v
# or, equivalently:
./v1_fallback test cmd/v/macos_v3_test.v cmd/v/macos_v3_external_fallback_test.v
Expected Behavior

The tests either (a) skip when os.file_name(@VEXE) is the v1_fallback binary (or when -old-compiler is in VFLAGS), or (b) resolve the dispatcher explicitly as os.join_path(os.dir(@VEXE), 'v' + exe_ext) instead of using @VEXE, so they exercise the V3 dispatch on every lane. macos_v3_external_fallback_test.v already has a guard for the absence of v1_fallback; it needs the symmetric one for being run by it.

Separately, the legacy builder's build <missing> message should include the path (builder error: help doesn't exist), matching V3.

Current Behavior

Both tests fail on every -old-compiler tools lane (and the run takes 80-150 s per test before failing).

Why it has not shown on master CI

The tools-* "Test tools" step has been skipped on master because "Check build-tools" fails first (#28501). #28503 fixes that gate and is the first run to reach these tests.

V version

V 0.5.2 76c0d94619

Environment details

Ubuntu 22.04 / macOS CI runners with VFLAGS=-old-compiler -cc <cc>; v1_fallback build help output reproduced locally on Windows 11 with the same commit.

[!NOTE]
You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cmd/v/macos_v3_test.v and cmd/v/macos_v3_external_fallback_test.v, then reproduce them with VFLAGS=-old-compiler and inspect .github/workflows/tools_ci.yml. Compare @VEXE with the dispatcher and review vlib/v/builder/compile.v:103 for the legacy error case. Done means the tests behave correctly on the tools-* lanes and the missing-path message matches the stated expectation.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
build-system, ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.