Skip to content

Comments

Windows: unit test fixes and skips#15279

Closed
puffnfresh wants to merge 1 commit intoNixOS:masterfrom
puffnfresh:windows/unit-test-fixes
Closed

Windows: unit test fixes and skips#15279
puffnfresh wants to merge 1 commit intoNixOS:masterfrom
puffnfresh:windows/unit-test-fixes

Conversation

@puffnfresh
Copy link
Member

@puffnfresh puffnfresh commented Feb 18, 2026

@Ericson2314 I rebased these old commits because I saw you mention unit tests on Windows. From memory, this was enough to make units tests go green.


Fix test infrastructure for Windows and skip tests that don't pass yet (all with TODO comments to fix later).

  • nix_api_store.hh: use create_directories (supports nested paths)
  • compression.cc: add isWine() runtime detection; skip decompression tests under Wine only (exception handling broken in Wine)
  • file-system.cc: fix makeParentCanonical root test for Windows path
  • flakeref.cc: add BASE_PATH macro for platform-appropriate paths
  • nix_api_flake.cc: skip getFlake test on Windows
  • machines.cc: skip /dev/null and /not/a/file reference tests
  • nar-info-disk-cache.cc: skip create_and_read on Windows
  • nix_api_store.cc: skip 11 store API tests on Windows
  • store-reference.cc: add Windows URI test variation with Z: paths; create local_shorthand_2_windows.txt test data
  • error_traces.cc: skip filterSource on Windows
  • nix_api_expr.cc: skip 5 drv/eval tests on Windows
  • primops.cc: skip baseNameOf, dirOf on Windows; guard coercion test
  • value/print.cc: fix ansiColorsPath for Windows root path

Motivation

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Fix test infrastructure for Windows and skip tests that don't pass
yet (all with TODO comments to fix later).

- nix_api_store.hh: use create_directories (supports nested paths)
- compression.cc: add isWine() runtime detection; skip decompression
  tests under Wine only (exception handling broken in Wine)
- file-system.cc: fix makeParentCanonical root test for Windows path
- flakeref.cc: add BASE_PATH macro for platform-appropriate paths
- nix_api_flake.cc: skip getFlake test on Windows
- machines.cc: skip /dev/null and /not/a/file reference tests
- nar-info-disk-cache.cc: skip create_and_read on Windows
- nix_api_store.cc: skip 11 store API tests on Windows
- store-reference.cc: add Windows URI test variation with Z: paths;
  create local_shorthand_2_windows.txt test data
- error_traces.cc: skip filterSource on Windows
- nix_api_expr.cc: skip 5 drv/eval tests on Windows
- primops.cc: skip baseNameOf, dirOf on Windows; guard coercion test
- value/print.cc: fix ansiColorsPath for Windows root path
@puffnfresh puffnfresh requested a review from edolstra as a code owner February 18, 2026 07:54
@github-actions github-actions bot added the c api Nix as a C library with a stable interface label Feb 18, 2026
auto s = BASE_PATH "?revCount=123&rev=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
auto flakeref = parseFlakeRef(fetchSettings, s);
ASSERT_EQ(flakeref.to_string(), "path:/foo/bar?rev=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&revCount=123");
ASSERT_EQ(flakeref.to_string(), "path:" BASE_PATH "?rev=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&revCount=123");
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, this doesn't parse right. path:C:\ isn't what we want for flakerefs. URLs always need forward slashes even on windows. I think the way for flakerefs on windows paths would be to use the same approach as file: URL RFC specifies - file:///C:/blah/blah.

Comment on lines +360 to +364
#ifdef _WIN32
"C:\\"
#else
"/"
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't seem correct. CanonPath is still a unixy path even on windows paths- as it should be for now.

@puffnfresh
Copy link
Member Author

I'm not sure how much of this is still relevant so I think I'll add the skips to #15303 as needed.

@puffnfresh puffnfresh closed this Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants