test: avoid writing ~/.bash_history #15621

Problem:
- If I run 'make test' on Linux (Fedora), a few lines like
  /path/to/neovim/build/bin/shell-test REP 31 line
  /path/to/neovim/build/bin/shell-test REP 41 line
  are written to my ~/.bash_history.
  These comes from from test/functional/terminal/scrollback_spec.lua.
- If $HISTFILE is unset, shell will not write to history file.
  But bash sets $HISTFILE to default value (~/.bash_history) if it is unset.
- Unknown how to set an env var to empty string in CMake. These do NOT work:
  set(HISTFILE "")
  set(ENV{HISTFILE} "")
  unset(ENV{HISTFILE})

Solution:
Set HISTFILE=/dev/null
This commit is contained in:
Justin M. Keyes 2021-09-10 11:54:36 -07:00 committed by GitHub
commit 5e22fdd9cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,9 @@ endif()
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})
# HISTFILE: do not write into user's ~/.bash_history
set(ENV{HISTFILE} "/dev/null")
if(NOT DEFINED ENV{TEST_TIMEOUT} OR "$ENV{TEST_TIMEOUT}" STREQUAL "")
set(ENV{TEST_TIMEOUT} 1200)
endif()