[Tarantool-patches] [PATCH v2 03/10] test: use CI friendly variables in lua-Harness

Maxim Kokryashkin max.kokryashkin at gmail.com
Tue Jul 20 19:26:51 MSK 2021


In scope of the commit 45ed138dcb9228d8ac5b8d82331ddd20a0bfada1
('test: set USERNAME env var for lua-Harness suite') the environment
of the testing process is tweaked via CMake, since both LOGNAME and
USERNAME environment variables might be missing.

Actually, POSIX standard states that every user must have HOME
environment variable set. It allows to use this in the corresponding
assertion instead of LOGNAME and USERNAME without additional
environment setup.

As a result this patch[1] from lua-Harness suite supersedes the
mentioned commit, and CMake hack can be dropped.

[1]: https://framagit.org/fperrad/lua-Harness/-/commit/6c2aa87

Part of tarantool/tarantool#5970
Part of tarantool/tarantool#4473
---
 test/lua-Harness-tests/309-os.t       | 4 ++--
 test/lua-Harness-tests/CMakeLists.txt | 5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/test/lua-Harness-tests/309-os.t b/test/lua-Harness-tests/309-os.t
index 2002ca47..14cbb89a 100755
--- a/test/lua-Harness-tests/309-os.t
+++ b/test/lua-Harness-tests/309-os.t
@@ -169,8 +169,8 @@ end
 do -- getenv
     equals(os.getenv('__IMPROBABLE__'), nil, "function getenv")
 
-    local user = os.getenv('LOGNAME') or os.getenv('USERNAME')
-    is_string(user, "function getenv")
+    local home = os.getenv('HOME') or os.getenv('HOMEPATH')
+    is_string(home, "function getenv")
 end
 
 do -- remove
diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt
index 9fddd625..b9804033 100644
--- a/test/lua-Harness-tests/CMakeLists.txt
+++ b/test/lua-Harness-tests/CMakeLists.txt
@@ -26,11 +26,6 @@ add_custom_command(TARGET lua-Harness-tests
   COMMAND
   env
     LUA_PATH="${LUA_PATH}\;"
-    # XXX: 309-os.t checks os.getenv() function by examining
-    # USERNAME or LOGNAME environment variable.
-    # These variables might not be set in the environment, so
-    # set one of them explicitly.
-    USERNAME="fperrad"
     ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR}
       --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21'
       ${LUA_TEST_FLAGS}
-- 
2.32.0



More information about the Tarantool-patches mailing list