aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 13b06e7f1b..5882758b5a 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -32,20 +32,15 @@ local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent'
..' belloff= noshowcmd noruler nomore'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', nvim_set, '--embed'}
-
-local mpack = require('mpack')
-
-local tmpname = global_helpers.tmpname
-local uname = global_helpers.uname
-
--- Formulate a path to the directory containing nvim. We use this to
--- help run test executables. It helps to keep the tests working, even
--- when the build is not in the default location.
+-- Directory containing nvim.
local nvim_dir = nvim_prog:gsub("[/\\][^/\\]+$", "")
if nvim_dir == nvim_prog then
nvim_dir = "."
end
+local mpack = require('mpack')
+local tmpname = global_helpers.tmpname
+local uname = global_helpers.uname
local prepend_argv
if os.getenv('VALGRIND') then
@@ -353,7 +348,7 @@ end
local function set_shell_powershell()
source([[
set shell=powershell shellquote=\" shellpipe=\| shellredir=>
- set shellcmdflag=\ -ExecutionPolicy\ RemoteSigned\ -Command
+ set shellcmdflag=\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
let &shellxquote=' '
]])
end
@@ -430,21 +425,27 @@ end
local function do_rmdir(path)
if lfs.attributes(path, 'mode') ~= 'directory' then
- return nil
+ return -- Don't complain.
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
local abspath = path..'/'..file
if lfs.attributes(abspath, 'mode') == 'directory' then
- local ret = do_rmdir(abspath) -- recurse
- if not ret then
- return nil
- end
+ do_rmdir(abspath) -- recurse
else
local ret, err = os.remove(abspath)
if not ret then
- error('os.remove: '..err)
- return nil
+ if not session then
+ error('os.remove: '..err)
+ else
+ -- Try Nvim delete(): it handles `readonly` attribute on Windows,
+ -- and avoids Lua cross-version/platform incompatibilities.
+ if -1 == nvim_call('delete', abspath) then
+ local hint = (os_name() == 'windows'
+ and ' (hint: try :%bwipeout! before rmdir())' or '')
+ error('delete() failed'..hint..': '..abspath)
+ end
+ end
end
end
end
@@ -453,7 +454,6 @@ local function do_rmdir(path)
if not ret then
error('lfs.rmdir('..path..'): '..err)
end
- return ret
end
local function rmdir(path)