test: fix env-vars flakiness

It has been observed that running the tests via shell script
can cause special environment variables to be missing. This
commit ensures that a special Windows environment variable is set.

Fixes: https://github.com/libuv/libuv/issues/2622
PR-URL: https://github.com/libuv/libuv/pull/2624
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
cjihrig 2020-01-13 09:45:20 -05:00
parent a740889e70
commit 6d9e89be8b
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -102,6 +102,12 @@ TEST_IMPL(env_vars) {
ASSERT(r == 0);
r = uv_os_setenv(name2, "");
ASSERT(r == 0);
#ifdef _WIN32
/* Create a special environment variable on Windows in case there are no
naturally occurring ones. */
r = uv_os_setenv("=Z:", "\\");
ASSERT(r == 0);
#endif
r = uv_os_environ(&envitems, &envcount);
ASSERT(r == 0);