Test 12 (util) Failing on Windows
Reproduction steps
README.md
Expected behavior
There should be no failing tests when you build an unmodified source tree from a [release](https://github.com/libgit2/libgit2/releases), or from the [main branch](https://github.com/libgit2/libgit2/tree/main). Please contact us or [open an issue](https://github.com/libgit2/libgit2/issues) if you see test failures.
Actual behavior
12: posix......
12: pqueue.....'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12:
12: process::env.'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12: .'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12: .'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12: F'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12:
12: process::start..'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a07432'
12: CMD.EXE was started with the above path as the current directory.
12: UNC paths are not supported. Defaulting to Windows directory.
12: ...
12: process::win32....
12: zstream....
12:
12: 1) Failure:
12: process::env::can_clear_env [D:\Apps\Fritzing Entirity\libgit2-1.8.1\tests\util\process\env.c:52]
12: 0 != result.exitcode
12: 0 != 1
12:
12/12 Test #12: util .............................***Failed 4.61 sec
92% tests passed, 1 tests failed out of 12
Total Test time (real) = 1169.06 sec
The following tests FAILED:
12 - util (Failed)
Errors while running CTest
Output from these tests are in: D:/Apps/Fritzing Entirity/libgit2-1.8.1/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
After rebuilding after removing space from parent directory name,
PS D:\Apps\FritzingEntirity\libgit2-1.8.1\build> ctest -R util
Test project D:/Apps/FritzingEntirity/libgit2-1.8.1/build
Start 12: util
1/1 Test #12: util .............................***Failed 4.05 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 4.06 sec
The following tests FAILED:
12 - util (Failed)
Errors while running CTest
Output from these tests are in: D:/Apps/FritzingEntirity/libgit2-1.8.1/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
PS D:\Apps\FritzingEntirity\libgit2-1.8.1\build> ctest --rerun-failed --output-on-failure
Test project D:/Apps/FritzingEntirity/libgit2-1.8.1/build
Start 12: util
1/1 Test #12: util .............................***Failed 4.03 sec
Loaded 54 suites:
Started (test status codes: OK='.' FAILURE='F' SKIPPED='S')
alloc....
array.
assert.....
bitvec.
copy...
dirent.........
encoding..
errors.......
filebuf............
ftruncateSS
futils...S
gitstr..........................
hex.
hostname.
iconv...
init...
integer...
link..SSSSSSSSS....SS....SSS
memmem...
mkdir......
path::core.................................
path::win32.............
pool...
posix......
pqueue.....'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
process::env.'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
.'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
.'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
F'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
process::start..'\\?\C:\Users\siddh\AppData\Local\Temp\libgit2_tests_a30044'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
...
process::win32....
qsort......
regexp.SSS.........
rmdir.....
sha1...
sha256....
sortedcache...
stat..
str::basic...
str::oom...
str::percent..
str::quote...
str::splice.........
string........
strmap...........
strtol........
url::http.................................................
url::joinpath......
url::parse......................................................
url::pattern..
url::redirect...........
url::scp.....................
url::valid.
utf8.
vector..........
wildmatch........
zstream....
1) Failure:
process::env::can_clear_env [D:\Apps\FritzingEntirity\libgit2-1.8.1\tests\util\process\env.c:52]
0 != result.exitcode
0 != 1
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 4.05 sec
The following tests FAILED:
12 - util (Failed)
Errors while running CTest
PS D:\Apps\FritzingEntirity\libgit2-1.8.1\build>
D:/Apps/FritzingEntirity/libgit2-1.8.1/build/Testing/Temporary/LastTest.log :
12:util
Version of libgit2 (release number or SHA1)
libgit2 v1.8.1
Operating system(s) tested
Edition Windows 11 Home Single Language Version 23H2 Installed on 05-02-2023 OS build 22631.4169 Experience Windows Feature Experience Pack 1000.22700.1034.0
Windows PowerShell
Interesting, and surprising. I've not seen this before.
The failure is that it's not getting a 0 exit code from the env.cmd tool that we bundle to check that we are successfully handling environment variables during execution. But it works for the other process::env tests. 🤔
@ethomson I can confirm this still exists as of v1.9.1, using both GCC (MinGW) 15.1.0 and MSVC (cl.exe 19.44.35211) on Windows 11 24H2 (OS Build 26100.4349). I am trying to repro this, I'll come back to you if I find anything notable.
@ethomson I think I cracked this nut. After a short session of printf-debugging, I noticed that test_process_env__can_clear_env clears the environment (as the name would suggest). Well... the problem with that is that this also clears SystemRoot, which Windows requires to be there (it's C:\Windows on my system). I thought COMSPEC would also be required as it is the actual cmd.exe executable, but I made the test pass with just:
void test_process_env__can_clear_env(void)
{
const char* env_array[] = { "TEST_NEW_ENV=added",
"TEST_OTHER_ENV=also_added",
"SystemRoot=C:\\Windows" };
int result;
cl_setenv("SOME_EXISTING_ENV", "propagated");
run_env(env_array, 3, 1);
result = git_vector_search(
NULL, &env_result, "SOME_EXISTING_ENV=propagated");
cl_assert_equal_i(GIT_ENOTFOUND, result);
}