aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--cmake/RunTests.cmake3
-rw-r--r--runtime/doc/change.txt4
-rw-r--r--src/nvim/os/win_defs.h2
-rw-r--r--test/functional/core/job_spec.lua3
-rw-r--r--test/helpers.lua41
6 files changed, 35 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index 68c0e9d17c..fb506305b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,9 +39,6 @@ tags
# generated by luacheck during `make testlint'
/test/.luacheckcache
-# luarocks, not added as a subtree because of the large number of blobs
-/third-party/luarocks
-
# local make targets
local.mk
@@ -49,6 +46,3 @@ local.mk
/runtime/doc/*.html
/runtime/doc/tags.ref
/runtime/doc/errors.log
-
-# clint errors, generated by `make lint`
-/errors.json
diff --git a/cmake/RunTests.cmake b/cmake/RunTests.cmake
index 38e0f35213..bd7b630708 100644
--- a/cmake/RunTests.cmake
+++ b/cmake/RunTests.cmake
@@ -25,6 +25,8 @@ if(DEFINED ENV{TEST_FILTER})
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
endif()
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${WORKING_DIR}/Xtest-tmpdir)
+set(ENV{TMPDIR} ${WORKING_DIR}/Xtest-tmpdir)
set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
execute_process(
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
@@ -37,6 +39,7 @@ execute_process(
file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
+file(REMOVE_RECURSE ${WORKING_DIR}/Xtest-tmpdir)
if(NOT res EQUAL 0)
message(STATUS "Output to stderr:\n${err}")
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index c8576d83e8..e0974b103c 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -601,8 +601,8 @@ all files in it are deleted. When Vim has the setuid bit set this may cause
problems, the temp file is owned by the setuid user but the filter command
probably runs as the original user.
Directory for temporary files is created in the first suitable directory of:
-For Unix: $TMPDIR, /tmp, current-dir, $HOME.
-For MS-Windows: $TMP, $TEMP, $USERPROFILE, current-dir.
+ Unix: $TMPDIR, /tmp, current-dir, $HOME.
+ Windows: $TMPDIR, $TMP, $TEMP, $USERPROFILE, current-dir.
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 827fb2f247..7c980c3768 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -19,7 +19,7 @@
#define NAME_MAX _MAX_PATH
-#define TEMP_DIR_NAMES { "$TMP", "$TEMP", "$USERPROFILE", "" }
+#define TEMP_DIR_NAMES { "$TMPDIR", "$TMP", "$TEMP", "$USERPROFILE", "" }
#define TEMP_FILE_PATH_MAXLEN _MAX_PATH
#define FNAME_ILLEGAL "\"*?><|"
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index e442c2a317..9ee91f2fe9 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -8,6 +8,7 @@ local clear, eq, eval, exc_exec, execute, feed, insert, neq, next_msg, nvim,
local command = helpers.command
local wait = helpers.wait
local iswin = helpers.iswin
+local get_pathsep = helpers.get_pathsep
local Screen = require('test.functional.ui.screen')
describe('jobs', function()
@@ -65,7 +66,7 @@ describe('jobs', function()
end)
it('changes to given `cwd` directory', function()
- local dir = eval('resolve(tempname())')
+ local dir = eval("resolve(tempname())"):gsub("/", get_pathsep())
mkdir(dir)
nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
if iswin() then
diff --git a/test/helpers.lua b/test/helpers.lua
index 1a86effa1c..82451bc61d 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -106,20 +106,33 @@ local uname = (function()
end)
end)()
-local function tmpname()
- local fname = os.tmpname()
- if uname() == 'Windows' and fname:sub(1, 2) == '\\s' then
- -- In Windows tmpname() returns a filename starting with
- -- special sequence \s, prepend $TEMP path
- local tmpdir = os.getenv('TEMP')
- return tmpdir..fname
- elseif fname:match('^/tmp') and uname() == 'Darwin' then
- -- In OS X /tmp links to /private/tmp
- return '/private'..fname
- else
- return fname
- end
-end
+local tmpname = (function()
+ local seq = 0
+ local tmpdir = os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
+ -- Is $TMPDIR defined local to the project workspace?
+ local in_workspace = not not (tmpdir and string.find(tmpdir, 'Xtest'))
+ return (function()
+ if in_workspace then
+ -- Cannot control os.tmpname() dir, so hack our own tmpname() impl.
+ seq = seq + 1
+ local fname = tmpdir..'/nvim-test-lua-'..seq
+ io.open(fname, 'w'):close()
+ return fname
+ else
+ local fname = os.tmpname()
+ if uname() == 'Windows' and fname:sub(1, 2) == '\\s' then
+ -- In Windows tmpname() returns a filename starting with
+ -- special sequence \s, prepend $TEMP path
+ return tmpdir..fname
+ elseif fname:match('^/tmp') and uname() == 'Darwin' then
+ -- In OS X /tmp links to /private/tmp
+ return '/private'..fname
+ else
+ return fname
+ end
+ end
+ end)
+end)()
local function map(func, tab)
local rettab = {}