Skip to content

tests: fix three vlib/v/types tests that only failed on Windows - #29704

Merged
medvednikov merged 3 commits into
vlang:masterfrom
metif12:tests-windows-portability
Oct 6, 2026
Merged

medvednikov merged 3 commits into
vlang:masterfrom
metif12:tests-windows-portability

Conversation

@metif12

@metif12 metif12 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

These three vlib/v/types tests fail on Windows and pass elsewhere. None of them is a compiler bug: each asserts something that only holds on a POSIX host, or depends on a POSIX-only executable.

parallel_check_min_items_test.v — test_a_lower_minimum_checks_a_program_on_the_pool_with_the_same_errors asserted !was_parallel under $if windows, but check_program sets VJOBS=4 and builds the checker pool, so the pool path runs on Windows as well. The branch also contradicted the test's own name. It now asserts was_parallel everywhere. That branch was present from the file's first commit (#29254), so this is not a regression.

import_diagnostics_test.v — compared current_file_module_source_root(), which answers with /-separated paths because the function applies .replace('\\', '/'), against a raw os.real_path(project), which is \-separated on Windows. The two cannot be equal there. The expectation is now normalised to match what the checker returns.

c_struct_module_views_test.v — ran os.exec(['env', 'VMODULES=...', @VEXE, ...]). env is not on PATH on Windows, so the exec failed with CreateProcess code 2 before the child compiler ever started. VMODULES is now set in the test process and restored afterwards, which the child inherits, so the environment it sees is unchanged.

Verified on Windows at 871b40e: each of the three files fails in isolation before the change and passes after it, and test vlib/v/types/ reports 110 passed, 110 total.

Test-only change; no compiler behaviour is affected.

check_program sets VJOBS=4 and builds the checker pool, so the parallel path
runs on Windows too. The `$if windows` branch asserted !was_parallel, which
contradicted the test's own name and failed there. It has been there since the
file was added in vlang#29254.
current_file_module_source_root() answers with '/' separated paths because it
applies .replace('\\', '/'), while the raw os.real_path(project) expectation is
'\\' separated on Windows, so the two could never be equal there.
env is not on PATH on Windows, so the exec failed with CreateProcess code 2
before the child compiler started. Setting it in the test process, and restoring
it afterwards, gives the child the same environment.

@medvednikov medvednikov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Independent review: PR #29704

Head: ff8affb0988190f00017aafbc9a319f9de40eb48
Verdict: PASS, no correctness findings requiring fixes.

The changed pool assertion matches the checker's cross-platform worker selection and the
VJOBS=4 fixture. Path normalization matches current_file_module_source_root. The VMODULES
change preserves the child environment and restores both unset and explicitly empty values
through defer, including on assertion failure.

Validation on macOS arm64, exact head:

  • ./v -cc clang self: passed.
  • ./v -new-compiler -cc clang vlib/v/types/c_struct_module_views_test.v: passed.
  • ./v -new-compiler -cc clang vlib/v/types/import_diagnostics_test.v: passed.
  • ./v -new-compiler -cc clang vlib/v/types/parallel_check_min_items_test.v: passed.

Existing checker_noalloc.v immutable-reference notices appeared during these tests.
Windows execution is unavailable locally. GitHub metadata showed no reviews, no failing
checks, and no pending checks when inspected; mergeStateStatus was UNSTABLE.
Root is coordinating required shared compiler/types suite validation separately.

Changed PR paths:

  • vlib/v/types/c_struct_module_views_test.v
  • vlib/v/types/import_diagnostics_test.v
  • vlib/v/types/parallel_check_min_items_test.v

Reviewer source edits: none. Review artifacts live outside the working tree.

@medvednikov
medvednikov merged commit bd509b9 into vlang:master Oct 6, 2026
@medvednikov

Copy link
Copy Markdown
Member

Final parallel-agent validation for independently reviewed head ff8affb0988190f00017aafbc9a319f9de40eb48, squash merged as bd509b9190071b9dd9c0448eada39964dbdbe498.

The final merged-source audit confirms all selected source paths match the tested integration and every reviewed documentation fix remains. Combined Clang regressions passed 14/14, the C codegen suite passed 60/60, and docs.md passed 326 checks across 371 examples with zero warnings/errors/format failures.

Compiler diagnostics: 1783 passed, four failed, five skipped. A fresh clean-master control has identical failure details after path/timing normalization. The full compiler-directory sweep remains incomplete because it exhausted local disk space. Windows execution was unavailable locally; GitHub CI is not uniformly green (Windows failures and pending jobs; no checks reported for the two contributor branches). These limitations are recorded explicitly; no baseline expectations were changed just to obtain passing results.

@metif12
metif12 deleted the tests-windows-portability branch October 10, 2026 19:57
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.

2 participants