Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lua trace when throwing error raised in C to Lua #9914

Closed
locker opened this issue Apr 8, 2024 · 0 comments · Fixed by #9996
Closed

Add Lua trace when throwing error raised in C to Lua #9914

locker opened this issue Apr 8, 2024 · 0 comments · Fixed by #9996
Assignees
Labels
app feature A new functionality

Comments

@locker
Copy link
Member

locker commented Apr 8, 2024

If a built-in Tarantool Lua function implemented in C (e.g. space:insert) raises an exception, the exception trace points to the C code, not to the Lua code that called the function, for example:

-- test.lua
local yaml = require('yaml')

box.cfg{log_level = 'warn'}

local s = box.schema.create_space('test')
s:create_index('pk')
s:insert({1, 1})

local ok, err = pcall(s.insert, s, {1, 2})
assert(not ok)
print(yaml.encode(err:unpack()))

os.exit(0)

Output:

---
code: 3
base_type: ClientError
message: Duplicate key exists in unique index "pk" in space "test" with old tuple
  - [1, 1] and new tuple - [1, 2]
new_tuple: [1, 2]
trace:
- file: ./src/box/memtx_tree.cc
  line: 1160
old_tuple: [1, 1]
type: ClientError
space: test
index: pk
...

This isn't really helpful. Apparently, in this example the user would like to see the trace pointing to test.lua:10.

The suggestion is to add the trace of the calling Lua function when re-throwing an error raised in C code to Lua:

trace:
- file: ./src/box/memtx_tree.cc
  line: 1160
- file: test.lua
  line: 10

To achieve that, we probably need to patch luaT_error and a few Lua FFI wrappers.

Similar issues:

@locker locker added the feature A new functionality label Apr 8, 2024
@locker locker added the app label Apr 8, 2024
@nshy nshy self-assigned this Apr 24, 2024
nshy added a commit to nshy/tarantool that referenced this issue May 2, 2024
The level argument has same meaning as when error created or raised
with table/error argument. Examples:

```lua
e = box.error.new(box.error.SOME_ERROR, <error arguments>, level)
box.error(box.error.SOME_ERROR, <error arguments>, level)
```

Follows up tarantool#9792
Part of tarantool#9914

NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 7, 2024
Currently we may raise error using standard error() from Lua code or
luaL_error() from C code on paths of API from schema.lua module. Let's
fix is to use box.error.

Part of tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 7, 2024
We are going to add requirerement that Tarantool Lua API should return
box.error with trace frame set to the place of API invocation.

This should be tested. Let's use already existing tests. In order to
check the requirement in existing diff tests let's make console change
error if the requirement is not meet.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue May 7, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

We need to disable box_schema_before_box_cfg_test as it panic somewhere
in LuaJIT with error trace check done in luatest error assertions.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
nshy added a commit to tarantool/luatest that referenced this issue May 7, 2024
nshy added a commit to tarantool/luatest that referenced this issue May 8, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for schema.lua API at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to tarantool/luatest that referenced this issue May 8, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for schema.lua API at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
The level argument has same meaning as when error created or raised
with table/error argument. Examples:

```lua
e = box.error.new(box.error.SOME_ERROR, <error arguments>, level)
box.error(box.error.SOME_ERROR, <error arguments>, level)
```

Follows up tarantool#9792
Part of tarantool#9914

NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
Currently we may raise error using standard error() from Lua code or
luaL_error() from C code on paths of API from schema.lua module. Let's
fix is to use box.error.

Part of tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
We are going to add requirerement that Tarantool Lua API should return
box.error with trace frame set to the place of API invocation.

This should be tested. Let's use already existing tests. In order to
check the requirement in existing diff tests let's make console change
error if the requirement is not meet.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-7-g9a0ab36 [1]

[1] tarantool/test-run@b22665a

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

We need to disable box_schema_before_box_cfg_test as it panic somewhere
in LuaJIT with error trace check done in luatest error assertions.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
NO_TEST=using existing tests
nshy added a commit to nshy/tarantool that referenced this issue May 8, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
NO_TEST=using existing tests
nshy added a commit to nshy/tarantool that referenced this issue May 13, 2024
We are going to add requirerement that Tarantool Lua API should return
box.error with trace frame set to the place of API invocation.

This should be tested. Let's use already existing tests. In order to
check the requirement in existing diff tests let's make console change
error if the requirement is not meet.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue May 13, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-7-g9a0ab36 [1]

[1] tarantool/test-run@b22665a

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue May 13, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
NO_TEST=using existing tests
nshy added a commit to nshy/tarantool that referenced this issue May 13, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
NO_TEST=using existing tests
nshy added a commit to nshy/tarantool that referenced this issue May 14, 2024
We are going to add requirerement that Tarantool Lua API should return
box.error with trace frame set to the place of API invocation.

This should be tested. Let's use already existing tests. In order to
check the requirement in existing diff tests let's make console change
error if the requirement is not meet.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue May 14, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-7-g9a0ab36 [1]

[1] tarantool/test-run@b22665a

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue May 14, 2024
Currently trace points to the C code where diag is set or Lua code where
error is thrown. So it points to internal code which is not particularly
useful for the user. Let's make trace point the place where API is
called. This patch do it for API residing in box/lua/schema.lua only
though.

Closes tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
NO_TEST=using existing tests
nshy added a commit to nshy/tarantool that referenced this issue May 16, 2024
The level argument has same meaning as when error created or raised
with table/error argument. Examples:

```lua
e = box.error.new(box.error.SOME_ERROR, <error arguments>, level)
box.error(box.error.SOME_ERROR, <error arguments>, level)
```

Follows up tarantool#9792
Part of tarantool#9914

NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 16, 2024
Currently we may raise error using standard error() from Lua code or
`luaL_error()` from C code on paths of API from `schema.lua` module. Let's
fix is to use `box.error`.

Also let's use `box.error.ILLEGAL_PARAMS` instead of box.error.PROC_LUA`
in this module.

Part of tarantool#9914

NO_CHANGELOG=minor
NO_DOC=minor
nshy added a commit to nshy/tarantool that referenced this issue May 16, 2024
We are going to add requirerement that Tarantool Lua API should return
box.error with trace frame set to the place of API invocation.

This should be tested. Let's use already existing tests. In order to
check the requirement in existing diff tests let's make console change
error if the requirement is not meet.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue May 16, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-7-g9a0ab36 [1]

[1] tarantool/test-run@b22665a

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to tarantool/luatest that referenced this issue May 31, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for several modules at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to tarantool/luatest that referenced this issue May 31, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for several modules at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to tarantool/luatest that referenced this issue Jun 3, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for several modules at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to tarantool/luatest that referenced this issue Jun 3, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for several modules at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
ylobankov pushed a commit to tarantool/luatest that referenced this issue Jun 3, 2024
In the scope of the referenced Tarantool issue we are going to change
error trace of API to point to the caller place. The error should be
box.error and the trace will be changed for several modules at the
beginning (fix all API at once is difficult).

We are going to use existing tests to test the change. In particular in
case of Luatest let's check trace in `assert_error*` assertions besides
the main assertion.

Required for tarantool/tarantool#9914
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to XXXXXX [1]

[1] tarantool/test-run@XXXXXX

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
Here is just of bunch utility functions that used in the patch that make
several modules throw box.error with trace set to the caller place. That
patch is just a boring huge switch to box.error and setting proper level
on error creation. Factor out utility functions so that they and their
tests are not get lost.

Part of tarantool#9914

NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. For the API written in LuaC without any Lua code around
it is easy task. Just make `luaT_error` set the proper trace.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
Why these modules? Initially in the scope of tarantool#9914 we only want
to fix trace for `schema.lua` but there is an issue. In the next
patch we changing `console.lua` so that for existing diff test the
trace is checked (for specified modules).

In that patch we add a wrapper function around evaluated expression. So
that argument checking functions like `luaL_checklstring` start to refer
wrapper's ``fn`` in error instead of ``?``. We decided drop the usage of
such checkers in code covered by diff tests. Once we touch a module in
the scope this change we also fix all non box errors to box ones with
proper level.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. Let's leverage existing diff tests to check error trace.
Just check error trace when error is raised when evaluating expression
in console which is used in diff tests.

The check is done for test build only and only for Lua modules specified
in `tarantool._internal.trace_check_is_required`.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to XXXXXX [1]

[1] tarantool/test-run@XXXXXX

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 3, 2024
Bump test-run to new version with the following improvements:

-  Make assert_error_covers support stacked diagnostics [1]
-  Add trace check for error assertions [2]
-  Fix installer.sh URL in test_on_push.yaml workflow [3]
-  Fix package_test.yml workflow due to using `tt` [4]
-  Add Tarantool 2.11 and 3.0 to tests workflow [5]
-  Migrate `cbuilder` module and adapt it [6]
-  server: change error message for unix socket path [7]
-  Migrate `justrun` module and adapt it [8]
-  Add more logs [9]

[1] tarantool/luatest@dfee2f3
[2] tarantool/luatest@e7667b0
[3] tarantool/luatest@718b58b
[4] tarantool/luatest@4abb6c2
[5] tarantool/luatest@d596a19
[6] tarantool/luatest@87c6df0
[7] tarantool/luatest@ae8e3d2
[8] tarantool/luatest@c1b2622
[9] tarantool/luatest@d985997

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-14-gdfee2f3 [1]
- Adjust test result report width to terminal size [2]
- dispatcher: lift pipe buffer size restriction [3]
- flake8: fix E721 do not compare types [4]

[1] tarantool/test-run@84ebae5
[2] tarantool/test-run@1724211
[3] tarantool/test-run@81259c4
[4] tarantool/test-run@1037299

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Why these modules? Initially in the scope of tarantool#9914 we only want
to fix trace for `schema.lua` but there is an issue. In the next
patch we changing `console.lua` so that for existing diff test the
trace is checked (for specified modules).

In that patch we add a wrapper function around evaluated expression. So
that argument checking functions like `luaL_checklstring` start to refer
wrapper's ``fn`` in error instead of ``?``. We decided drop the usage of
such checkers in code covered by diff tests. Once we touch a module in
the scope this change we also fix all non box errors to box ones with
proper level.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. Let's leverage existing diff tests to check error trace.
Just check error trace when error is raised when evaluating expression
in console which is used in diff tests.

The check is done for test build only and only for Lua modules specified
in `tarantool._internal.trace_check_is_required`.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-14-gdfee2f3 [1]
- Adjust test result report width to terminal size [2]
- dispatcher: lift pipe buffer size restriction [3]
- flake8: fix E721 do not compare types [4]

[1] tarantool/test-run@84ebae5
[2] tarantool/test-run@1724211
[3] tarantool/test-run@81259c4
[4] tarantool/test-run@1037299

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. For the API written in LuaC without any Lua code around
it is easy task. Just make `luaT_error` set the proper trace.

By the way test we don't mess up trace for code evaluated thru netbox.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Why these modules? Initially in the scope of tarantool#9914 we only want
to fix trace for `schema.lua` but there is an issue. In the next
patch we changing `console.lua` so that for existing diff test the
trace is checked (for specified modules).

In that patch we add a wrapper function around evaluated expression. So
that argument checking functions like `luaL_checklstring` start to refer
wrapper's ``fn`` in error instead of ``?``. We decided drop the usage of
such checkers in code covered by diff tests. Once we touch a module in
the scope this change we also fix all non box errors to box ones with
proper level.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. Let's leverage existing diff tests to check error trace.
Just check error trace when error is raised when evaluating expression
in console which is used in diff tests.

The check is done for test build only and only for Lua modules specified
in `tarantool._internal.trace_check_is_required`.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-14-gdfee2f3 [1]
- Adjust test result report width to terminal size [2]
- dispatcher: lift pipe buffer size restriction [3]
- flake8: fix E721 do not compare types [4]

[1] tarantool/test-run@84ebae5
[2] tarantool/test-run@1724211
[3] tarantool/test-run@81259c4
[4] tarantool/test-run@1037299

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. For the API written in LuaC without any Lua code around
it is easy task. Just make `luaT_error` set the proper trace.

By the way test we don't mess up trace for code evaluated thru netbox.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Why these modules? Initially in the scope of tarantool#9914 we only want
to fix trace for `schema.lua` but there is an issue. In the next
patch we changing `console.lua` so that for existing diff test the
trace is checked (for specified modules).

In that patch we add a wrapper function around evaluated expression. So
that argument checking functions like `luaL_checklstring` start to refer
wrapper's ``fn`` in error instead of ``?``. We decided drop the usage of
such checkers in code covered by diff tests. Once we touch a module in
the scope this change we also fix all non box errors to box ones with
proper level.

Part of tarantool#9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
In scope of the tarantool#9914 issue we are setting error trace for API to the
caller frame. Let's leverage existing diff tests to check error trace.
Just check error trace when error is raised when evaluating expression
in console which is used in diff tests.

The check is done for test build only and only for Lua modules specified
in `tarantool._internal.trace_check_is_required`.

Part of tarantool#9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
nshy added a commit to nshy/tarantool that referenced this issue Jun 5, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-14-gdfee2f3 [1]
- Adjust test result report width to terminal size [2]
- dispatcher: lift pipe buffer size restriction [3]
- flake8: fix E721 do not compare types [4]

[1] tarantool/test-run@84ebae5
[2] tarantool/test-run@1724211
[3] tarantool/test-run@81259c4
[4] tarantool/test-run@1037299

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of tarantool#9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
locker pushed a commit that referenced this issue Jun 6, 2024
Here is just of bunch utility functions that used in the patch that make
several modules throw box.error with trace set to the caller place. That
patch is just a boring huge switch to box.error and setting proper level
on error creation. Factor out utility functions so that they and their
tests are not get lost.

Part of #9914

NO_CHANGELOG=internal
NO_DOC=internal
locker pushed a commit that referenced this issue Jun 6, 2024
In scope of the #9914 issue we are setting error trace for API to the
caller frame. For the API written in LuaC without any Lua code around
it is easy task. Just make `luaT_error` set the proper trace.

By the way test we don't mess up trace for code evaluated thru netbox.

Part of #9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
locker pushed a commit that referenced this issue Jun 6, 2024
Why these modules? Initially in the scope of #9914 we only want
to fix trace for `schema.lua` but there is an issue. In the next
patch we changing `console.lua` so that for existing diff test the
trace is checked (for specified modules).

In that patch we add a wrapper function around evaluated expression. So
that argument checking functions like `luaL_checklstring` start to refer
wrapper's ``fn`` in error instead of ``?``. We decided drop the usage of
such checkers in code covered by diff tests. Once we touch a module in
the scope this change we also fix all non box errors to box ones with
proper level.

Part of #9914

NO_CHANGELOG=incomplete
NO_DOC=incomplete
locker pushed a commit that referenced this issue Jun 6, 2024
In scope of the #9914 issue we are setting error trace for API to the
caller frame. Let's leverage existing diff tests to check error trace.
Just check error trace when error is raised when evaluating expression
in console which is used in diff tests.

The check is done for test build only and only for Lua modules specified
in `tarantool._internal.trace_check_is_required`.

Part of #9914

NO_TEST=internal
NO_CHANGELOG=internal
NO_DOC=internal
locker pushed a commit that referenced this issue Jun 6, 2024
Bump test-run to new version with the following improvements:

- Bump luatest to 1.0.1-14-gdfee2f3 [1]
- Adjust test result report width to terminal size [2]
- dispatcher: lift pipe buffer size restriction [3]
- flake8: fix E721 do not compare types [4]

[1] tarantool/test-run@84ebae5
[2] tarantool/test-run@1724211
[3] tarantool/test-run@81259c4
[4] tarantool/test-run@1037299

We also have to fix several tests that check that script with luatest
assertions have empty stderr output. test-run brings Luatest which
logs assertions at 'info' level.

Note that gh_8433_raft_is_candidate_test is different. Original
assertion involves logging huge tables that have somewhere closed
sockets inside. And 'socket.__tostring' currently raises error for
closed sockets.

We need to fix gh_6819_iproto_watch_not_implemented_test also to
account error created on loading `luatest` on `server:exec` after
the commit "Add trace check for error assertions".

Part of #9914

NO_DOC=internal
NO_TEST=internal
NO_CHANGELOG=internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app feature A new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants