[Tarantool-patches] [PATCH v2 1/3] test: corrected reported error lines

Timur Safin tsafin at tarantool.org
Fri Jun 11 10:48:11 MSK 2021


It always was a problem that reported source line was not
pointing to the actual callee line number, but rather to
the start of file, i.e. we have seen:
```
[001] sql-tap/tkt-9a8b09f8e6.test.lua                 memtx
[001] not ok 22 - 4.3 #
[001] Traceback:
[001] [Lua ] function 'do_catchsql_test' at </home/tsafin/tarantool/test/var/001_sql-tap/sqltester.lua:123>
[001] [main] at </home/tsafin/tarantool/test/sql-tap/tkt-9a8b09f8e6.test.lua:0>
[001]
[001] not ok 23 - 4.4 #
[001] Traceback:
[001] [Lua ] function 'do_catchsql_test' at </home/tsafin/tarantool/test/var/001_sql-tap/sqltester.lua:123>
[001] [main] at </home/tsafin/tarantool/test/sql-tap/tkt-9a8b09f8e6.test.lua:0>
```
(see the :0 part)
Instead of correct line numbers:
```
[001] sql-tap/tkt-9a8b09f8e6.test.lua                 memtx
[001] not ok 22 - 4.3 #
[001] Traceback:
[001] [Lua ] function 'do_catchsql_test' at </home/tsafin/tarantool/test/var/001_sql-tap/sqltester.lua:142>
[001] [main] at </home/tsafin/tarantool/test/sql-tap/tkt-9a8b09f8e6.test.lua:242>
[001]
[001] not ok 23 - 4.4 #
[001] Traceback:
[001] [Lua ] function 'do_catchsql_test' at </home/tsafin/tarantool/test/var/001_sql-tap/sqltester.lua:142>
[001] [main] at </home/tsafin/tarantool/test/sql-tap/tkt-9a8b09f8e6.test.lua:252>
```

The problem was due to `.linedefined` used, instead of source line in `.currentline`.

Closes #6134
---
 src/lua/tap.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lua/tap.lua b/src/lua/tap.lua
index 346724d84..77fd8d096 100644
--- a/src/lua/tap.lua
+++ b/src/lua/tap.lua
@@ -23,7 +23,7 @@ local function traceback(level)
         local frame = {
             source = info.source;
             src = info.short_src;
-            line = info.linedefined or 0;
+            line = info.currentline or info.linedefined or 0;
             what = info.what;
             name = info.name;
             namewhat = info.namewhat;
-- 
2.29.2



More information about the Tarantool-patches mailing list