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

Enable luatest logging #429

Merged

Conversation

ochaplashkin
Copy link

@ochaplashkin ochaplashkin commented May 22, 2024

tap13: fix parsing non-utf8 chars

The log file may contain non-utf8 characters which will cause an error:

  TAP13 parse failed ('utf-8' codec can't decode byte 0xbe ...

Replace non-utf8 characters when reading a file.

Part of #427

Enable logging to unified file

If the test fails and there is a unified log file(run.log by default) you'll see the following output:

- [box-luatest/varbinary_test.lua, null]
  # logfile:         /tmp/t/log/031_box-luatest.log
  # reproduce file:  /tmp/t/reproduce/031_box-luatest.list.yaml
  # unified logfile: /tmp/t/031_box-luatest/run.log

Closes #427

@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch from eb7b84d to 6ba1e3a Compare May 22, 2024 14:21
@coveralls
Copy link

coveralls commented May 22, 2024

Coverage Status

coverage: 62.625%. remained the same
when pulling 9727b6c on ochaplashkin:bump-luatest-to-add-more-logs
into dd00063 on tarantool:master.

@ochaplashkin ochaplashkin requested a review from ylobankov May 27, 2024 10:41
lib/options.py Outdated Show resolved Hide resolved
@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch 3 times, most recently from 0a477cf to e85db54 Compare June 10, 2024 12:55
@ochaplashkin ochaplashkin changed the title Enable logging to unified file and bump luatest to 1.0.1-6-gd985997 Enable luatest logging Jun 10, 2024
@ochaplashkin
Copy link
Author

Statistics:
* pass: 1881
* disabled: 73
* skip: 8
* fail: 5
Failed tasks:
- [box-luatest/gh_9797_netbox_on_disconnect_error_hangs_server_test.lua, null]
# logfile:        /tmp/t/log/067_box-luatest.log
# reproduce file: /tmp/t/reproduce/067_box-luatest.list.yaml
# luatest logfile: /tmp/t/067_box-luatest/run.log
- [box-luatest/gh_9309_errors_in_triggers_test.lua, null]
# logfile:        /tmp/t/log/058_box-luatest.log
# reproduce file: /tmp/t/reproduce/058_box-luatest.list.yaml
# luatest logfile: /tmp/t/058_box-luatest/run.log
- [box-luatest/gh_9994_next_prefix_iterator_test.lua, null]
# logfile:        /tmp/t/log/067_box-luatest.log
# reproduce file: /tmp/t/reproduce/067_box-luatest.list.yaml
# luatest logfile: /tmp/t/067_box-luatest/run.log
- [box-luatest/varbinary_test.lua, null]
# logfile:        /tmp/t/log/061_box-luatest.log
# reproduce file: /tmp/t/reproduce/061_box-luatest.list.yaml
# luatest logfile: /tmp/t/061_box-luatest/run.log
- [box-luatest/gh_7904_export_box_schema_version_to_public_api_test.lua, null]
# logfile:        /tmp/t/log/061_box-luatest.log
# reproduce file: /tmp/t/reproduce/061_box-luatest.list.yaml
# luatest logfile: /tmp/t/061_box-luatest/run.log

Patch:

diff --git a/.gitmodules b/.gitmodules
index 229062bea..716b602c8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -17,7 +17,7 @@
 	ignore = dirty
 [submodule "test-run"]
 	path = test-run
-	url = https://github.com/tarantool/test-run.git
+	url = https://github.com/ochaplashkin/test-run.git
 	ignore = dirty
 [submodule "src/lib/small"]
 	path = src/lib/small
diff --git a/test-run b/test-run
index dd0006329..e85db54ee 160000
--- a/test-run
+++ b/test-run
@@ -1 +1 @@
-Subproject commit dd0006329d3c9ca30a956b66e8b61db1a57e51b9
+Subproject commit e85db54eec64bcbd066416f7e1c7a680e31fb6c1
diff --git a/test/box-luatest/gh_7904_export_box_schema_version_to_public_api_test.lua b/test/box-luatest/gh_7904_export_box_schema_version_to_public_api_test.lua
index 18af7968f..9953e2b28 100644
--- a/test/box-luatest/gh_7904_export_box_schema_version_to_public_api_test.lua
+++ b/test/box-luatest/gh_7904_export_box_schema_version_to_public_api_test.lua
@@ -23,7 +23,7 @@ g.test_box_internal_schema_version_deprecation = function(cg)
     local deprecation_warning =
         'box.internal.schema_version will be removed, please use box.info.schema_version instead'
     t.assert_is_not(cg.server:grep_log(deprecation_warning, 256), nil)
-    local log_file = g.server:exec(function() return box.cfg.log end)
+    local log_file = g.server:exec(function() return rawget(_G, 'box_cfg_log_file') or box.cfg.log end)
     fio.truncate(log_file)
     cg.server:exec(function()
         box.internal.schema_version()
diff --git a/test/box-luatest/gh_9309_errors_in_triggers_test.lua b/test/box-luatest/gh_9309_errors_in_triggers_test.lua
index 5c142adbf..d636f3708 100644
--- a/test/box-luatest/gh_9309_errors_in_triggers_test.lua
+++ b/test/box-luatest/gh_9309_errors_in_triggers_test.lua
@@ -95,7 +95,9 @@ g.test_ctl_triggers_error = function()
         box.ctl.on_shutdown(function() error("on_shutdown error") end, nil)
     end)
 
-    local server_log_path = g.server:exec(function() return box.cfg.log end)
+    local server_log_path = g.server:exec(function()
+        return rawget(_G, 'box_cfg_log_file') or box.cfg.log
+    end)
     g.server:drop()
     t.assert(g.server:grep_log("on_shutdown error", nil,
         {filename = server_log_path}))
diff --git a/test/box-luatest/gh_9797_netbox_on_disconnect_error_hangs_server_test.lua b/test/box-luatest/gh_9797_netbox_on_disconnect_error_hangs_server_test.lua
index bff0cbc37..727c7dbbd 100644
--- a/test/box-luatest/gh_9797_netbox_on_disconnect_error_hangs_server_test.lua
+++ b/test/box-luatest/gh_9797_netbox_on_disconnect_error_hangs_server_test.lua
@@ -24,7 +24,7 @@ g.test_on_disconnect_error_hangs_server = function(cg)
     local log_file = cg.server:exec(function()
         box.ctl.set_on_shutdown_timeout(1)
         -- `grep_log` will not be able to retrieve it after we drop the server.
-        return box.cfg.log
+        return rawget(_G, 'box_cfg_log_file') or box.cfg.log
     end)
     cg.server:drop()
     t.assert_not(cg.server:grep_log('on_shutdown triggers failed', 1024,

Failed tests:
box-luatest/varbinary_test.lua and box-luatest/gh_9994_next_prefix_iterator_test.lua with following error:

TAP13 parse failed ('utf-8' codec can't decode byte 0xbe in position 4198: invalid start byte)

lib/luatest_server.py Outdated Show resolved Hide resolved
@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch 2 times, most recently from 1e3fb83 to a26c9dc Compare June 10, 2024 17:09
@ochaplashkin
Copy link
Author

Done

Statistics:
* pass: 1886 (flaky: 1)
* disabled: 73
* skip: 8

lib/luatest_server.py Outdated Show resolved Hide resolved
lib/luatest_server.py Outdated Show resolved Hide resolved
lib/test.py Show resolved Hide resolved
@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch from a26c9dc to e7310f1 Compare June 11, 2024 14:13
The log file may contain non-utf8 characters which will cause an error:

  TAP13 parse failed ('utf-8' codec can't decode byte 0xbe ...

Replace non-utf8 characters when reading a file.

Part of tarantool#427
@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch from e7310f1 to 81ee5d3 Compare June 11, 2024 14:14
If the test fails and there is a luatest log file (`run.log` by default)
you'll see the following output:

 - [box-luatest/varbinary_test.lua, null]
  # logfile:         /tmp/t/log/031_box-luatest.log
  # luatest logfile: /tmp/t/031_box-luatest/run.log
  # reproduce file:  /tmp/t/reproduce/031_box-luatest.list.yaml

Closes tarantool#427
@ochaplashkin ochaplashkin force-pushed the bump-luatest-to-add-more-logs branch from 81ee5d3 to 9727b6c Compare June 11, 2024 15:00
@ylobankov ylobankov merged commit b8b60b4 into tarantool:master Jun 11, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable logging to unified file for luatest
3 participants