From 6d9e89be8b5fadd91b372c8043ccf2b5cf99ed9d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 13 Jan 2020 09:45:20 -0500 Subject: [PATCH] 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 Reviewed-By: Richard Lau --- test/test-env-vars.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-env-vars.c b/test/test-env-vars.c index 3c9de95b..f61c1c6c 100644 --- a/test/test-env-vars.c +++ b/test/test-env-vars.c @@ -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);