aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-10-03 07:41:57 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-10-02 22:41:57 -0700
commitb069e9b20f9e1f24fde34bee7d6e5d95f47ef10d (patch)
tree24f81cb8f2f6a4a8403fd0d85b13dd7462d2b756
parent3d3c783fead3dc328ede3ccd0fb7b3befcad191a (diff)
downloadrneovim-b069e9b20f9e1f24fde34bee7d6e5d95f47ef10d.tar.gz
rneovim-b069e9b20f9e1f24fde34bee7d6e5d95f47ef10d.tar.bz2
rneovim-b069e9b20f9e1f24fde34bee7d6e5d95f47ef10d.zip
tests: unit: NVIM_TEST_TRACE_LEVEL: default to 0 #11144
Traces are not useful normally (unless debugging/fixing tests), but only add overhead. Disable them by default.
-rw-r--r--test/README.md11
-rw-r--r--test/unit/helpers.lua4
2 files changed, 8 insertions, 7 deletions
diff --git a/test/README.md b/test/README.md
index 64892b5576..2b19740434 100644
--- a/test/README.md
+++ b/test/README.md
@@ -315,11 +315,12 @@ Number; !must be defined to function properly):
- `NVIM_TEST_RUN_TESTTEST` (U) (1): allows running
`test/unit/testtest_spec.lua` used to check how testing infrastructure works.
-- `NVIM_TEST_TRACE_LEVEL` (U) (N): specifies unit tests tracing level: `0`
- disables tracing (the fastest, but you get no data if tests crash and there
- was no core dump generated), `1` or empty/undefined leaves only C function
- cals and returns in the trace (faster then recording everything), `2` records
- all function calls, returns and lua source lines exuecuted.
+- `NVIM_TEST_TRACE_LEVEL` (U) (N): specifies unit tests tracing level:
+ - `0` disables tracing (the fastest, but you get no data if tests crash and
+ there no core dump was generated),
+ - `1` leaves only C function calls and returns in the trace (faster than
+ recording everything),
+ - `2` records all function calls, returns and executed Lua source lines.
- `NVIM_TEST_TRACE_ON_ERROR` (U) (1): makes unit tests yield trace on error in
addition to regular error message.
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 24dbc65bd0..bacdc54416 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -545,7 +545,7 @@ local tracehelp = dedent([[
local function child_sethook(wr)
local trace_level = os.getenv('NVIM_TEST_TRACE_LEVEL')
if not trace_level or trace_level == '' then
- trace_level = 1
+ trace_level = 0
else
trace_level = tonumber(trace_level)
end
@@ -708,7 +708,7 @@ local function check_child_err(rd)
local eres = sc.read(rd, 2)
if eres ~= '$\n' then
if #trace == 0 then
- err = '\nTest crashed, no trace available\n'
+ err = '\nTest crashed, no trace available (check NVIM_TEST_TRACE_LEVEL)\n'
else
err = '\nTest crashed, trace:\n' .. tracehelp
for i = 1, #trace do