Commit Graph

6 Commits

Author SHA1 Message Date
Hüseyin Açacak
83306585ff
win: fix env var in uv_os_homedir and uv_os_tmpdir (#4464)
If the corresponding environment variables are empty, the
uv_us_homedir() and uv_os_tmpdir() return garbage values. The reason
for this situation is the Windows API which doesn't return an error
even if the path is empty.

This PR fixes this problem by checking the return value of the API
call. If it is not an error and the length of the value is less than 3,
uv_us_homedir() and uv_os_tmpdir() will return UV_ENOENT.

Fixes: https://github.com/libuv/libuv/issues/2328
2024-07-29 17:50:11 -04:00
Pleuvens
011a1ac1a3
test: switch to new-style ASSERT_EQ macros (#4159)
Switch from old-style ASSERT macro to new-style ASSERT_EQ,... macros.

Using new-style macros makes it easier to debug test failures

Fixes: https://github.com/libuv/libuv/issues/2974
2023-10-06 19:50:15 +02:00
Ben Noordhuis
fa1da18549 test: canonicalize argv[0] in exepath test
Commit ff29322b ("test: canonicalize test runner path") from 2014
changed the test runner to call `realpath(3)` on `argv[0]` in order
to fix the `get_currentexe` test failing with the autotools build when
the executable path contained symbolic links but that is now causing
the `spawn_reads_child_path` test to fail on z/os with the cmake build.

Fix that by only doing path canonicalization in the `get_currentexe`
test, not always.

An auxiliary fix is applied to the `process_title_threadsafe` test
because it assumed that setting the process title to a long string,
then reading it back produces in the original string.

On some platforms however the maximum size of the process title is
limited to the size of the `argv` vector.

Because the test runner used absolute paths until now, the argv vector
was bigger than it is with relative paths, big enough to let this bad
assumption go unnoticed until now.

Minor fixes are applied to tests that assumed 1024 for the maximum
path size because this commit makes visible that some of the CI matrix
systems support much longer paths.

PR-URL: https://github.com/libuv/libuv/pull/2755
Refs: https://github.com/libuv/libuv/pull/2737#issuecomment-602800431
Refs: https://github.com/libuv/libuv/pull/2754#issuecomment-604015785
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-03-27 23:51:22 +01:00
cjihrig
a84caf6fd7 test: handle root home directories
Currently, the tests assert that the home directory doesn't end
in a slash. However, if the home directory is / or something like
C:\, then this assertion is incorrect. This commit adds special
handling for these cases.

Fixes: https://github.com/libuv/libuv/issues/812
PR-URL: https://github.com/libuv/libuv/pull/813
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-08 11:08:46 -04:00
cjihrig
13f4dc8288 test: add missing copyright header
This commit adds the copyright header to the two tests that
were missing it.

PR-URL: https://github.com/libuv/libuv/pull/782
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-24 13:17:31 -04:00
cjihrig
a62c2d5928 unix,win: add uv_os_homedir()
PR-URL: https://github.com/libuv/libuv/pull/350
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-05-21 17:31:35 +02:00