Skip to content

test, win32: fix up symlink tests

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test, win32

Description of change

On Windows, creating a symlink requires admin privileges. There were two tests which created symlinks which were failing when run as non-admin.

test-fs-symlink.js already had a check for privileges on Windows but it had a couple issues:

  1. It assumed that whoami was the one that came with windows. However, whoami also ships with Win32 Unix utility ports like the distribution with git, which can cause this to get check tripped up.
  2. On failure, the check would just return from the callback instead of exiting
  3. whoami was executed asynchronously so the test would run regardless of privilege state.

test-fs-options-immutable had no check.

As part of this change, I refactored the privilege checking to a function in common, and changed both above tests to use the refactored function.

Merge request reports

Loading