aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-28 08:58:22 +0200
committerGitHub <noreply@github.com>2018-09-28 08:58:22 +0200
commit6e146d413267de044a1f9f0bbb0290b5387e631c (patch)
tree79392e4dec153a78ccaf83acb7eb54391c25b27e
parentb09f173d93b960df6706fcff0e9fd595eee467a4 (diff)
downloadrneovim-6e146d413267de044a1f9f0bbb0290b5387e631c.tar.gz
rneovim-6e146d413267de044a1f9f0bbb0290b5387e631c.tar.bz2
rneovim-6e146d413267de044a1f9f0bbb0290b5387e631c.zip
test: check_cores(): Fix tmp dir exclusion (#9061)
tmpdir_get() may be an absolute path, but we invoke glob() with a relative `initial_path`. That can lead to this error: [ ERROR ] test/functional/helpers.lua @ 752: after_each test/helpers.lua:95: cannot open ./Xtest-tmpdir/nvim8jKCjR: No such file or directory stack traceback: test/helpers.lua:95: in function 'glob' test/helpers.lua:273: in function 'check_cores' test/functional/helpers.lua:757: in function <test/functional/helpers.lua:752>
-rw-r--r--test/helpers.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index da18c0f39f..6ef7a456f4 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -1,6 +1,7 @@
local assert = require('luassert')
local luv = require('luv')
local lfs = require('lfs')
+local relpath = require('pl.path').relpath
local quote_me = '[^.%w%+%-%@%_%/]' -- complement (needn't quote)
local function shell_quote(str)
@@ -244,7 +245,7 @@ local function check_cores(app, force)
-- Workspace-local $TMPDIR, scrubbed and pattern-escaped.
-- "./Xtest-tmpdir/" => "Xtest%-tmpdir"
local local_tmpdir = (tmpdir_is_local(tmpdir_get())
- and tmpdir_get():gsub('^[ ./]+',''):gsub('%/+$',''):gsub('([^%w])', '%%%1')
+ and relpath(tmpdir_get()):gsub('^[ ./]+',''):gsub('%/+$',''):gsub('([^%w])', '%%%1')
or nil)
local db_cmd
if hasenv('NVIM_TEST_CORE_GLOB_DIRECTORY') then