diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-01 22:56:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 22:56:41 -0700 |
commit | 099445cc07b0154edc6ecd562a28e86c87c0096b (patch) | |
tree | bb539bd3877fc0545b1c7db13039b357477e5758 | |
parent | 7bb029eeef65f57d94cef4e4b709e6c3ebefcf08 (diff) | |
parent | ead39d6ce6d1c5e5b6130c6823d071889c207bde (diff) | |
download | rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.tar.gz rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.tar.bz2 rneovim-099445cc07b0154edc6ecd562a28e86c87c0096b.zip |
Merge #10804 'CI/OpenBSD: functional tests'
-rw-r--r-- | .builds/openbsd.yml | 9 | ||||
-rw-r--r-- | test/functional/core/channels_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/eval/timer_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/fixtures/shell-test.c | 6 | ||||
-rw-r--r-- | test/functional/helpers.lua | 18 | ||||
-rw-r--r-- | test/functional/terminal/scrollback_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 10 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/embed_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/output_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 7 | ||||
-rw-r--r-- | test/helpers.lua | 20 |
13 files changed, 64 insertions, 39 deletions
diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index 1ac830e6ad..a8f6992e3f 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -28,11 +28,14 @@ tasks: cd .. mkdir build cd build - cmake -G Ninja .. + cmake -G Ninja -DMIN_LOG_LEVEL=3 .. cmake --build . --config Debug ./bin/nvim --version - test: | export LC_CTYPE=en_US.UTF-8 - cd neovim + # functional tests + cd neovim/build + # cmake --build . --config Debug --target functionaltest # oldtests - gmake -C src/nvim/testdir NVIM_PRG=`pwd`/build/bin/nvim + cd .. + gmake oldtest diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index ddaed1c448..852d9808f5 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -139,8 +139,8 @@ describe('channels', function() command("call chansend(id, 'incomplet\004')") - local is_freebsd = (string.lower(uname()) == 'freebsd') - local bsdlike = is_freebsd or (os_name() == "osx") + local is_bsd = not not string.find(uname(), 'bsd') + local bsdlike = is_bsd or (os_name() == "osx") local extra = bsdlike and "^D\008\008" or "" expect_twoline(id, "stdout", "incomplet"..extra, "[1, ['incomplet'], 'stdin']", true) diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 2531b45521..73b0a0009d 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -429,7 +429,7 @@ describe('jobs', function() if has('win32') let cmd = 'for /L %I in (1,1,5) do @(echo %I& ping -n 2 127.0.0.1 > nul)' else - let cmd = ['sh', '-c', 'for i in $(seq 1 5); do echo $i; sleep 0.1; done'] + let cmd = ['sh', '-c', 'for i in 1 2 3 4 5; do echo $i; sleep 0.1; done'] endif let g:id = jobstart(cmd, d) sleep 1500m @@ -472,7 +472,7 @@ describe('jobs', function() if has('win32') let cmd = 'for /L %I in (1,1,5) do @(echo %I& ping -n 2 127.0.0.1 > nul)' else - let cmd = ['sh', '-c', 'for i in $(seq 1 5); do echo $i; sleep 0.1; done'] + let cmd = ['sh', '-c', 'for i in 1 2 3 4 5; do echo $i; sleep 0.1; done'] endif let g:id = jobstart(cmd, d) sleep 1500m diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua index 48d10e46a9..2ccb9cfbac 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/eval/timer_spec.lua @@ -192,9 +192,10 @@ describe('timers', function() ]]) command("call timer_start(2, 'MyHandler', {'repeat': 3})") command("call timer_start(4, 'MyHandler2', {'repeat': 2})") - run(nil, nil, nil, load_adjust(30)) - eq(3,eval("g:val")) - eq(2,eval("g:val2")) + retry(nil, nil, function() + eq(3, eval("g:val")) + eq(2, eval("g:val2")) + end) end) it('do not crash when processing events in the handler', function() diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c index a221a31bde..b95e563932 100644 --- a/test/functional/fixtures/shell-test.c +++ b/test/functional/fixtures/shell-test.c @@ -13,7 +13,7 @@ static void flush_wait(void) { - fflush(stdout); + fflush(NULL); usleep(10*1000); // Wait 10 ms. } @@ -78,10 +78,10 @@ int main(int argc, char **argv) } for (int i = 0; i < count; i++) { printf("%d: %s\n", i, argv[3]); - fflush(stdout); if (i % 100 == 0) { usleep(1000); // Wait 1 ms (simulate typical output). } + fflush(NULL); } } else if (strcmp(argv[1], "UTF-8") == 0) { // test split-up UTF-8 sequence @@ -126,7 +126,7 @@ int main(int argc, char **argv) fprintf(stderr, "Unknown first argument: %s\n", argv[1]); return 3; } - fflush(stdout); + fflush(NULL); return 0; } else if (argc == 1) { fprintf(stderr, "ready $ "); diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 73f3c4c917..c34849b439 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -48,7 +48,7 @@ if module.nvim_dir == module.nvim_prog then end local tmpname = global_helpers.tmpname -local uname = global_helpers.uname +local iswin = global_helpers.iswin local prepend_argv if os.getenv('VALGRIND') then @@ -287,10 +287,6 @@ module.os_name = (function() end) end)() -function module.iswin() - return package.config:sub(1,1) == '\\' -end - -- Executes a VimL function. -- Fails on VimL error, but does not update v:errmsg. function module.call(name, ...) @@ -304,7 +300,7 @@ local function nvim_feed(input) local written = module.request('nvim_input', input) if written == nil then module.assert_alive() - error('nvim_input returned nil (Nvim process terminated?)') + error('crash? (nvim_input returned nil)') end input = input:sub(written + 1) end @@ -592,7 +588,7 @@ end -- Checks that the Nvim session did not terminate. function module.assert_alive() - eq(2, module.eval('1+1')) + assert(2 == module.eval('1+1'), 'crash? request failed') end local function do_rmdir(path) @@ -672,7 +668,7 @@ end -- Helper to skip tests. Returns true in Windows systems. -- pending_fn is pending() from busted function module.pending_win32(pending_fn) - if uname() == 'Windows' then + if iswin() then if pending_fn ~= nil then pending_fn('FIXME: Windows', function() end) end @@ -734,12 +730,12 @@ function module.redir_exec(cmd) end function module.get_pathsep() - return module.iswin() and '\\' or '/' + return iswin() and '\\' or '/' end function module.pathroot() local pathsep = package.config:sub(1,1) - return module.iswin() and (module.nvim_dir:sub(1,2)..pathsep) or '/' + return iswin() and (module.nvim_dir:sub(1,2)..pathsep) or '/' end -- Returns a valid, platform-independent $NVIM_LISTEN_ADDRESS. @@ -765,7 +761,7 @@ function module.missing_provider(provider) end function module.alter_slashes(obj) - if not module.iswin() then + if not iswin() then return obj end if type(obj) == 'string' then diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 544325e746..065cb98e69 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -406,7 +406,7 @@ describe("'scrollback' option", function() if iswin() then feed_data('for /L %I in (1,1,30) do @(echo line%I)\r') else - feed_data('for i in $(seq 1 30); do echo "line$i"; done\n') + feed_data('awk "BEGIN{for(n=1;n<=30;n++) print \\\"line\\\" n}"\n') end screen:expect{any='line30 '} retry(nil, nil, function() expect_lines(7) end) @@ -431,7 +431,7 @@ describe("'scrollback' option", function() if iswin() then feed_data('for /L %I in (1,1,30) do @(echo line%I)\r') else - feed_data('for i in $(seq 1 30); do echo "line$i"; done\n') + feed_data('awk "BEGIN{for(n=1;n<=30;n++) print \\\"line\\\" n}"\n') end screen:expect{any='line30 '} @@ -448,7 +448,7 @@ describe("'scrollback' option", function() if iswin() then feed_data('for /L %I in (1,1,40) do @(echo line%I)\r') else - feed_data('for i in $(seq 1 40); do echo "line$i"; done\n') + feed_data('awk "BEGIN{for(n=1;n<=40;n++) print \\\"line\\\" n}"\n') end screen:expect{any='line40 '} diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 312e060a70..99b25cbf48 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -902,7 +902,7 @@ end) -- does not initialize the TUI. describe("TUI 't_Co' (terminal colors)", function() local screen - local is_freebsd = (string.lower(uname()) == 'freebsd') + local is_freebsd = (uname() == 'freebsd') local function assert_term_colors(term, colorterm, maxcolors) helpers.clear({env={TERM=term}, args={}}) @@ -1176,8 +1176,8 @@ end) -- does not initialize the TUI. describe("TUI 'term' option", function() local screen - local is_bsd = not not string.find(string.lower(uname()), 'bsd') - local is_macos = not not string.find(string.lower(uname()), 'darwin') + local is_bsd = not not string.find(uname(), 'bsd') + local is_macos = not not string.find(uname(), 'darwin') local function assert_term(term_envvar, term_expected) clear() @@ -1203,7 +1203,9 @@ describe("TUI 'term' option", function() end) it('gets system-provided term if $TERM is valid', function() - if is_bsd then -- BSD lacks terminfo, builtin is always used. + if uname() == "openbsd" then + assert_term("xterm", "xterm") + elseif is_bsd then -- BSD lacks terminfo, builtin is always used. assert_term("xterm", "builtin_xterm") elseif is_macos then local status, _ = pcall(assert_term, "xterm", "xterm") diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 1c4d5a5c6b..f9769c706f 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -828,6 +828,10 @@ describe('cmdline redraw', function() end) it('with <Cmd>', function() + if 'openbsd' == helpers.uname() then + pending('FIXME #10804', function() end) + return + end command('cmap a <Cmd>call sin(0)<CR>') -- no-op feed(':012345678901234567890123456789') screen:expect{grid=[[ diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 0f50baa73f..5e09dc4289 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -49,6 +49,10 @@ local function test_embed(ext_linegrid) end) it("doesn't erase output when setting color scheme", function() + if 'openbsd' == helpers.uname() then + pending('FIXME #10804', function() end) + return + end startup('--cmd', 'echoerr "foo"', '--cmd', 'color default', '--cmd', 'echoerr "bar"') screen:expect([[ | diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index 139ef5964e..c028f44b44 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -50,6 +50,10 @@ describe("shell command :!", function() end) it("throttles shell-command output greater than ~10KB", function() + if 'openbsd' == helpers.uname() then + pending('FIXME #10804', function() end) + return + end child_session.feed_data(":!"..nvim_dir.."/shell-test REP 30001 foo\n") -- If we observe any line starting with a dot, then throttling occurred. diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 02be714e0d..0e3b903398 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -615,7 +615,12 @@ function Screen:_redraw(updates) local handler_name = '_handle_'..method local handler = self[handler_name] if handler ~= nil then - handler(self, unpack(update[i])) + local status, res = pcall(handler, self, unpack(update[i])) + if not status then + error(handler_name..' failed' + ..'\n payload: '..inspect(update) + ..'\n error: '..tostring(res)) + end else assert(self._on_event, "Add Screen:"..handler_name.." or call Screen:set_on_event_handler") diff --git a/test/helpers.lua b/test/helpers.lua index 08a7822b19..25fff55596 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -158,7 +158,11 @@ function module.check_logs() table.concat(runtime_errors, ', '))) end --- Tries to get platform name from $SYSTEM_NAME, uname; fallback is "Windows". +function module.iswin() + return package.config:sub(1,1) == '\\' +end + +-- Gets (lowercase) OS name from CMake, uname, or "win" if iswin(). module.uname = (function() local platform = nil return (function() @@ -166,17 +170,19 @@ module.uname = (function() return platform end - platform = os.getenv("SYSTEM_NAME") - if platform then + if os.getenv("SYSTEM_NAME") then -- From CMAKE_SYSTEM_NAME. + platform = string.lower(os.getenv("SYSTEM_NAME")) return platform end local status, f = pcall(module.popen_r, 'uname', '-s') if status then - platform = f:read("*l") + platform = string.lower(f:read("*l")) f:close() + elseif module.iswin() then + platform = 'windows' else - platform = 'Windows' + error('unknown platform') end return platform end) @@ -203,11 +209,11 @@ module.tmpname = (function() return fname else local fname = os.tmpname() - if module.uname() == 'Windows' and fname:sub(1, 2) == '\\s' then + if module.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 module.uname() == 'Darwin' then + elseif fname:match('^/tmp') and module.uname() == 'darwin' then -- In OS X /tmp links to /private/tmp return '/private'..fname else |