Hi, s I've seen that this patch was marked as pending. I'm not sure what should I change in it. The argv[0] argument is not used in child process so maybe it will be clearer if I put some dummy value there. I can also change the tests to not use _spawnvp.
There's following comment near _spawnvp implementation: Like on Windows, this function does not handle arguments with spaces or double-quotes.
Here are some results that shows what happens on windows when the tests are executed without this patch. The behavior on wine is similar. E:>msvcrt_crosstest.exe file file: 3 tests executed (0 marked as todo, 0 failures), 0 skipped. file: 1 tests executed (0 marked as todo, 0 failures), 0 skipped. file: 5 tests executed (0 marked as todo, 0 failures), 0 skipped. file: 5 tests executed (0 marked as todo, 0 failures), 0 skipped. file: 791 tests executed (0 marked as todo, 0 failures), 0 skipped.
E:>"a a\msvcrt_crosstest.exe" file Fatal: test 'a\msvcrt_crosstest.exe' does not exist. file.c:1417: Test failed: bad position 0 expecting 8 file.c:1419: Test failed: Couldn't read back the data Fatal: test 'a\msvcrt_crosstest.exe' does not exist. Fatal: test 'a\msvcrt_crosstest.exe' does not exist. file.c:1987: Test failed: i 0, got 0 file.c:1990: Test failed: expected to read 'Hello world', got '⌂' file.c:1987: Test failed: i 1, got 0 file.c:1990: Test failed: expected to read 'Hello world', got '⌂' file.c:1987: Test failed: i 2, got 0 file.c:1990: Test failed: expected to read 'Hello world', got '⌂' Fatal: test 'a\msvcrt_crosstest.exe' does not exist. file.c:2024: Test failed: fread() returned 0: ferror=0 file.c:2027: Test failed: got '⌂' expected 'Hello worldHello worldHello world' file: 791 tests executed (0 marked as todo, 10 failures), 0 skipped.
In the failing case argv[0] = "a" argv[1] = "a\msvcrt_crosstest.exe" argv[2] = "file"
Thanks, Piotr
Piotr Caban piotr.caban@gmail.com writes:
I've seen that this patch was marked as pending. I'm not sure what should I change in it. The argv[0] argument is not used in child process so maybe it will be clearer if I put some dummy value there. I can also change the tests to not use _spawnvp.
It's probably ok to use the basename, but you have to do it correctly. Also adding a helper function wouldn't hurt.