Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep the developer's environment out of the tests
The test library clears only Git's variables, so a CGI variable or
CGIT_SCINTILLUA_PATH exported in the shell reached every request, and
NO_HTTP alone strips every header. LUA_INIT runs code in each
standalone interpreter. The umask is pinned so files the tests create
get the same modes everywhere.
| -rwxr-xr-x | tests/setup.sh | 15 |
1 file changed, 15 insertions, 0 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 421e043..6e2e3f0 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -49,6 +49,21 @@ TEST_NO_CREATE_REPO=YesPlease TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/results" TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME$TEST_STRESS_JOB_SFX" +# cgit reads the CGI variables and a few of its own from the environment, and +# the library clears only Git's, so a developer's shell could hand any of them +# to every request. LUA_INIT runs code in each standalone interpreter. The Lua +# search paths are left alone, since they are how a system points Lua at its +# modules. +for cgit_variable in SCRIPT_NAME PATH_INFO QUERY_STRING HTTP_HOST HTTPS NO_HTTP \ + REQUEST_METHOD SERVER_NAME SERVER_PORT HTTP_COOKIE HTTP_REFERER CONTENT_LENGTH \ + CONTENT_TYPE REMOTE_ADDR REMOTE_USER CGIT_CONFIG CGIT_SCINTILLUA_PATH \ + LUA_INIT LUA_INIT_5_2 LUA_INIT_5_3 LUA_INIT_5_4 LUA_INIT_5_5 +do + unset $cgit_variable +done +unset cgit_variable +umask 022 + # The library has moved into the trash directory by now, so paths outside it # are anchored to TEST_OUTPUT_DIRECTORY. The tests run cgit by name, so the # binary just built has to come ahead of any copy already installed. Under |
