Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fails when the directory defined by XDG_CACHE_HOME does not exist #20040

Closed
smalltalkman opened this issue Nov 30, 2023 · 0 comments · Fixed by #20046
Closed

Test fails when the directory defined by XDG_CACHE_HOME does not exist #20040

smalltalkman opened this issue Nov 30, 2023 · 0 comments · Fixed by #20046
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@smalltalkman
Copy link
Contributor

smalltalkman commented Nov 30, 2023

Describe the bug

After pointing the XDG_CACHE_HOME environment variable to a non-existent directory, the relevant tests will fail.

Reproduction Steps

Point the XDG_CACHE_HOME environment variable to a non-existent directory:

# echo $XDG_CACHE_HOME
/d/gym/test/mingw-w64-packages/mingw-w64-v/.cache/mingw-w64-x86_64-v-0.4.3-1
# ll $XDG_CACHE_HOME
ls: cannot access '/d/gym/test/mingw-w64-packages/mingw-w64-v/.cache/mingw-w64-x86_64-v-0.4.3-1': No such file or directory

Perform related tests:

# ./v0 -keepc -g -showcc -cc gcc -o test_v.exe cmd/v
> C compiler cmd: gcc "@D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0\test_v.exe.tmp.c.rsp"
> C compiler response file "D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0\test_v.exe.tmp.c.rsp":
  -fwrapv -g -no-pie -o "D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\test_v.exe" -Wl,-stack=16777216 -Werror=implicit-function-declaration -I "D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\thirdparty\\stdatomic\\win" "D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\tmp\\mingw-w64-x86_64-v-0.4.3-1\\v_0\\test_v.exe.tmp.c" -std=c99 -D_DEFAULT_SOURCE -municode -ldbghelp -lws2_32 -ladvapi32 -lshell32
# ./test_v test vlib/flag/default_flag_options_test.v
---- Testing... ----------------------------------------------------------------
 FAIL  3866.702 ms vlib/flag/default_flag_options_test.v
D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\vlib\\flag\\default_flag_options_test.v:11: fn testsuite_begin
   > assert res.exit_code == 0
     Left value: 1
    Right value: 0

D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\vlib\\flag\\default_flag_options_test.v:24: fn check_program
   > assert res.exit_code == 0
     Left value: 1
    Right value: 0

--------------------------------------------------------------------------------
Failed command 1:    "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\test_v.exe"   -o "D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0\tsession_478c_14158731\01HGFFJ9RCMDYD0XSW6460YP0H\default_flag_options_test.exe" "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\vlib\flag\default_flag_options_test.v"
Summary for all V _test.v files: 1 failed, 1 total. Runtime: 3870 ms, on 1 job.
# ./test_v test vlib/flag/usage_example_test.v
---- Testing... ----------------------------------------------------------------
 FAIL  3873.308 ms vlib/flag/usage_example_test.v
D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\vlib\\flag\\usage_example_test.v:11: fn testsuite_begin
   > assert res.exit_code == 0
     Left value: 1
    Right value: 0

D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\vlib\\flag\\usage_example_test.v:26: fn check_program
   > assert res.exit_code == 0
     Left value: 1
    Right value: 0

--------------------------------------------------------------------------------
Failed command 1:    "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\test_v.exe"   -o "D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0\tsession_1c04_13286576\01HGFFM4V4MZY0R8AMMNH9WAN5\usage_example_test.exe" "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\vlib\flag\usage_example_test.v"
Summary for all V _test.v files: 1 failed, 1 total. Runtime: 3875 ms, on 1 job.
# ./test_v test vlib/vweb/tests/vweb_test.v
---- Testing... ----------------------------------------------------------------
 FAIL 138246.860 ms vlib/vweb/tests/vweb_test.v
builder error: `D:\gym\test\mingw-w64-packages\mingw-w64-v\.cache\mingw-w64-x86_64-v-0.4.3-1` does not exist; code: 1
D:\\gym\\test\\mingw-w64-packages\\mingw-w64-v\\src\\v-0.4.3\\vlib\\vweb\\tests\\vweb_test.v:32: fn test_a_simple_vweb_app_can_be_compiled
   > assert did_server_compile == 0
     Left value: 1
    Right value: 0

The system cannot find the path specified.
> client retries: 1
> client retries: 2
> client retries: 3
> client retries: 4
> client retries: 5
> client retries: 6
> client retries: 7
> client retries: 8
> client retries: 9
> client retries: 10
> client retries: 11
> client retries: 12
> client retries: 13
> client retries: 14
> client retries: 15
> client retries: 16
> client retries: 17
> client retries: 18
> client retries: 19
> client retries: 20
could not create a tcp client connection to 127.0.0.1:12380 after 20 retries

--------------------------------------------------------------------------------
Failed command 1:    "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\test_v.exe"   -o "D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0\tsession_406c_13320179\01HGFFNAXWMB6VC44GKRQEA33V\vweb_test.exe" "D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\vlib\vweb\tests\vweb_test.v"
Summary for all V _test.v files: 1 failed, 1 total. Runtime: 138249 ms, on 1 job.

Expected Behavior

All tests pass.

Current Behavior

Tests related to the XDG_CACHE_HOME environment variable failed.

Possible Solution

Automatically create the directory specified by XDG_CACHE_HOME, just like creating $HOME/.cache.

v/vlib/os/os.v

Line 739 in 00b1ce5

if !is_dir(cdir) && !is_link(cdir) {

Additional Information/Context

No response

V version

0.4.3

Environment details (OS name and version, etc.)

V full version: V 0.4.3 44cf145
OS: windows, Microsoft Windows 7 רҵ▒▒ v7601 64-bit
Processor: 4 cpus, 64bit, little endian,

getwd: D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3
vexe: D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3\test_v.exe
vexe mtime: 2023-11-30 06:43:53

vroot: OK, value: D:\gym\test\mingw-w64-packages\mingw-w64-v\src\v-0.4.3
VMODULES: NOT writable, value: D:/gym/test/mingw-w64-packages/mingw-w64-v/vmodules/mingw-w64-x86_64-v-0.4.3-1
VTMP: OK, value: D:\gym\test\mingw-w64-packages\mingw-w64-v\tmp\mingw-w64-x86_64-v-0.4.3-1\v_0

Git version: Error: 'git' is not recognized as an internal or external command,
operable program or batch file.

Git vroot status: Error: 'git' is not recognized as an internal or external command,
operable program or batch file.
.git/config present: false

CC version: cc (Rev2, Built by MSYS2 project) 13.2.0
thirdparty/tcc: N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant