mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
Merge PR #2146 'Improve functional test debuggability and efficiency'
This commit is contained in:
@@ -17,9 +17,17 @@ if(BUSTED_OUTPUT_TYPE STREQUAL junit)
|
|||||||
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED ENV{TEST_TAG})
|
||||||
|
set(TEST_TAG "--tags=$ENV{TEST_TAG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED ENV{TEST_FILTER})
|
||||||
|
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
|
||||||
|
endif()
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
|
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
||||||
--helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
||||||
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
|
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
|
||||||
WORKING_DIRECTORY ${WORKING_DIR}
|
WORKING_DIRECTORY ${WORKING_DIR}
|
||||||
ERROR_VARIABLE err
|
ERROR_VARIABLE err
|
||||||
|
@@ -4,8 +4,8 @@ local clear, nvim, buffer, curbuf, curwin, eq, neq, ok =
|
|||||||
helpers.eq, helpers.neq, helpers.ok
|
helpers.eq, helpers.neq, helpers.ok
|
||||||
|
|
||||||
describe('TabNew', function()
|
describe('TabNew', function()
|
||||||
|
setup(clear)
|
||||||
describe('au TabNew', function()
|
describe('au TabNew', function()
|
||||||
clear()
|
|
||||||
describe('with * as <afile>', function()
|
describe('with * as <afile>', function()
|
||||||
it('matches when opening any new tab', function()
|
it('matches when opening any new tab', function()
|
||||||
nvim('command', 'au! TabNew * echom "tabnew:".tabpagenr().":".bufnr("")')
|
nvim('command', 'au! TabNew * echom "tabnew:".tabpagenr().":".bufnr("")')
|
||||||
|
@@ -162,15 +162,20 @@ local function rawfeed(...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function spawn(argv)
|
||||||
|
local loop = Loop.new()
|
||||||
|
local msgpack_stream = MsgpackStream.new(loop)
|
||||||
|
local async_session = AsyncSession.new(msgpack_stream)
|
||||||
|
local session = Session.new(async_session)
|
||||||
|
loop:spawn(argv)
|
||||||
|
return session
|
||||||
|
end
|
||||||
|
|
||||||
local function clear()
|
local function clear()
|
||||||
if session then
|
if session then
|
||||||
session:exit(0)
|
session:exit(0)
|
||||||
end
|
end
|
||||||
local loop = Loop.new()
|
session = spawn(nvim_argv)
|
||||||
local msgpack_stream = MsgpackStream.new(loop)
|
|
||||||
local async_session = AsyncSession.new(msgpack_stream)
|
|
||||||
session = Session.new(async_session)
|
|
||||||
loop:spawn(nvim_argv)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function insert(...)
|
local function insert(...)
|
||||||
@@ -271,10 +276,9 @@ local function expect(contents)
|
|||||||
return eq(dedent(contents), curbuf_contents())
|
return eq(dedent(contents), curbuf_contents())
|
||||||
end
|
end
|
||||||
|
|
||||||
clear()
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clear = clear,
|
clear = clear,
|
||||||
|
spawn = spawn,
|
||||||
dedent = dedent,
|
dedent = dedent,
|
||||||
source = source,
|
source = source,
|
||||||
rawfeed = rawfeed,
|
rawfeed = rawfeed,
|
||||||
@@ -292,6 +296,7 @@ return {
|
|||||||
expect = expect,
|
expect = expect,
|
||||||
ok = ok,
|
ok = ok,
|
||||||
nvim = nvim,
|
nvim = nvim,
|
||||||
|
nvim_prog = nvim_prog,
|
||||||
nvim_dir = nvim_dir,
|
nvim_dir = nvim_dir,
|
||||||
buffer = buffer,
|
buffer = buffer,
|
||||||
window = window,
|
window = window,
|
||||||
|
@@ -6,10 +6,14 @@ local clear, nvim, eq, neq, ok, expect, eval, next_message, run, stop, session
|
|||||||
helpers.stop, helpers.session
|
helpers.stop, helpers.session
|
||||||
local nvim_dir, insert = helpers.nvim_dir, helpers.insert
|
local nvim_dir, insert = helpers.nvim_dir, helpers.insert
|
||||||
|
|
||||||
local channel = nvim('get_api_info')[1]
|
|
||||||
|
|
||||||
describe('jobs', function()
|
describe('jobs', function()
|
||||||
before_each(clear)
|
local channel
|
||||||
|
|
||||||
|
before_each(function()
|
||||||
|
clear()
|
||||||
|
channel = nvim('get_api_info')[1]
|
||||||
|
end)
|
||||||
|
|
||||||
-- Creates the string to make an autocmd to notify us.
|
-- Creates the string to make an autocmd to notify us.
|
||||||
local notify_str = function(expr1, expr2)
|
local notify_str = function(expr1, expr2)
|
||||||
|
@@ -123,15 +123,25 @@ if os.getenv('CI_TARGET') then
|
|||||||
default_screen_timeout = default_screen_timeout * 3
|
default_screen_timeout = default_screen_timeout * 3
|
||||||
end
|
end
|
||||||
|
|
||||||
local colors = request('vim_get_color_map')
|
do
|
||||||
|
local spawn, nvim_prog = helpers.spawn, helpers.nvim_prog
|
||||||
|
local session = spawn({nvim_prog, '-u', 'NONE', '-N', '--embed'})
|
||||||
|
local status, rv = session:request('vim_get_color_map')
|
||||||
|
if not status then
|
||||||
|
print('failed to get color map')
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
local colors = rv
|
||||||
local colornames = {}
|
local colornames = {}
|
||||||
for name, rgb in pairs(colors) do
|
for name, rgb in pairs(colors) do
|
||||||
-- we disregard the case that colornames might not be unique, as
|
-- we disregard the case that colornames might not be unique, as
|
||||||
-- this is just a helper to get any canonical name of a color
|
-- this is just a helper to get any canonical name of a color
|
||||||
colornames[rgb] = name
|
colornames[rgb] = name
|
||||||
end
|
end
|
||||||
|
session:exit(0)
|
||||||
Screen.colors = colors
|
Screen.colors = colors
|
||||||
|
Screen.colornames = colornames
|
||||||
|
end
|
||||||
|
|
||||||
function Screen.debug(command)
|
function Screen.debug(command)
|
||||||
if not command then
|
if not command then
|
||||||
@@ -497,8 +507,8 @@ function pprint_attrs(attrs)
|
|||||||
for f, v in pairs(attrs) do
|
for f, v in pairs(attrs) do
|
||||||
local desc = tostring(v)
|
local desc = tostring(v)
|
||||||
if f == "foreground" or f == "background" then
|
if f == "foreground" or f == "background" then
|
||||||
if colornames[v] ~= nil then
|
if Screen.colornames[v] ~= nil then
|
||||||
desc = "Screen.colors."..colornames[v]
|
desc = "Screen.colors."..Screen.colornames[v]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(items, f.." = "..desc)
|
table.insert(items, f.." = "..desc)
|
||||||
|
8
third-party/cmake/BuildLuarocks.cmake
vendored
8
third-party/cmake/BuildLuarocks.cmake
vendored
@@ -36,11 +36,11 @@ add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/stable-busted-deps
|
|||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build dkjson 2.5-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build dkjson 2.5-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build say 1.2-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build say 1.3-0 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build luassert 1.7.2-0 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build luassert 1.7.4-0 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build ansicolors 1.0.2-3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build lua-term 0.1-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build penlight 1.0.0-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build penlight 1.0.0-1 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
@@ -56,7 +56,7 @@ add_custom_target(stable-busted-deps
|
|||||||
|
|
||||||
add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted
|
add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted
|
||||||
COMMAND ${DEPS_BIN_DIR}/luarocks
|
COMMAND ${DEPS_BIN_DIR}/luarocks
|
||||||
ARGS build busted 2.0.rc4 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
ARGS build https://raw.githubusercontent.com/Olivine-Labs/busted/master/busted-scm-0.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/utfTerminalDetailed.lua
|
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/utfTerminalDetailed.lua
|
||||||
${DEPS_INSTALL_DIR}/share/lua/5.1/busted/outputHandlers
|
${DEPS_INSTALL_DIR}/share/lua/5.1/busted/outputHandlers
|
||||||
DEPENDS stable-busted-deps)
|
DEPENDS stable-busted-deps)
|
||||||
|
9
third-party/utfTerminalDetailed.lua
vendored
9
third-party/utfTerminalDetailed.lua
vendored
@@ -1,13 +1,18 @@
|
|||||||
-- busted output handler that immediately prints file and test names before
|
-- busted output handler that immediately prints file and test names before
|
||||||
-- tests are executed. It simplifies identifying which tests are
|
-- tests are executed. It simplifies identifying which tests are
|
||||||
-- hanging/crashing
|
-- hanging/crashing
|
||||||
local ansicolors = require 'ansicolors'
|
if package.config:sub(1,1) == '\\' and not os.getenv("ANSICON") then
|
||||||
|
-- Disable colors on Windows.
|
||||||
|
colors = setmetatable({}, {__index = function() return function(s) return s end end})
|
||||||
|
else
|
||||||
|
colors = require 'term.colors'
|
||||||
|
end
|
||||||
|
|
||||||
return function(options, busted)
|
return function(options, busted)
|
||||||
local handler = require 'busted.outputHandlers.utfTerminal'(options, busted)
|
local handler = require 'busted.outputHandlers.utfTerminal'(options, busted)
|
||||||
|
|
||||||
handler.fileStart = function(name)
|
handler.fileStart = function(name)
|
||||||
io.write('\n' .. ansicolors('%{cyan}' .. name) .. ':')
|
io.write('\n' .. colors.cyan(name) .. ':')
|
||||||
end
|
end
|
||||||
|
|
||||||
handler.testStart = function(element, parent, status, debug)
|
handler.testStart = function(element, parent, status, debug)
|
||||||
|
Reference in New Issue
Block a user