Skip to content

Commit b8b60b4

Browse files
Oleg Chaplashkinylobankov
Oleg Chaplashkin
authored andcommitted
Enable luatest logging
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 #427
1 parent 7290540 commit b8b60b4

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

lib/luatest_server.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def __init__(self, *args, **kwargs):
3737
def execute(self, server):
3838
"""Execute test by luatest command
3939
40-
Execute `luatest -c --no-clean --verbose <name>_test.lua --output tap`
41-
command. Disable capture mode and deletion of the var directory.
42-
Provide a verbose output in the tap format. Extend the command by
43-
`--pattern <pattern>` if the corresponding option is provided.
40+
Execute `luatest -c --no-clean --verbose <name>_test.lua --output tap --log <path>`
41+
command. Disable capture mode and deletion of the var directory. Provide a verbose
42+
output in the tap format. Extend the command by `--pattern <pattern>` if the
43+
corresponding option is provided.
4444
"""
4545
server.current_test = self
4646
script = os.path.join(os.path.basename(server.testdir), self.name)
@@ -51,6 +51,8 @@ def execute(self, server):
5151
command.extend([server.luatest])
5252
# Add luatest command-line options.
5353
command.extend(['-c', '--no-clean', '--verbose', script, '--output', 'tap'])
54+
# Add luatest logging option.
55+
command.extend(['--log', os.path.join(server.vardir, 'run.log')])
5456
if Options().args.pattern:
5557
for p in Options().args.pattern:
5658
command.extend(['--pattern', p])

lib/worker.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ def get_reproduce_file(worker_name):
6969
return os.path.join(reproduce_dir, '%s.list.yaml' % worker_name)
7070

7171

72+
def get_luatest_logfile(worker_name):
73+
# Luatest logging is only for LuatestServer workers.
74+
# It doesn't always guarantee a log file.
75+
# If it doesn't exist, it will return None.
76+
if 'luatest' in worker_name:
77+
path = os.path.join(main_vardir(), worker_name, 'run.log')
78+
if os.path.isfile(path):
79+
return path
80+
81+
7282
def print_greetings():
7383
# print information about tarantool
7484
color_stdout('\n')

listeners.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from lib.worker import WorkerOutput
1515
from lib.worker import WorkerTaskResult
1616
from lib.worker import get_reproduce_file
17+
from lib.worker import get_luatest_logfile
1718
from lib.utils import prefix_each_line
1819
from lib.utils import safe_makedirs
1920
from lib.utils import print_tail_n
@@ -161,6 +162,9 @@ def print_tasks_info(self, tasks):
161162
task_id_str = yaml.safe_dump(task_id, default_flow_style=True)
162163
final_report('- %s' % task_id_str, schema='test_var')
163164
color_stdout('# logfile: %s\n' % logfile)
165+
luatest_logfile = get_luatest_logfile(worker_name)
166+
if luatest_logfile:
167+
color_stdout('# luatest logfile: %s\n' % luatest_logfile)
164168
reproduce_file_path = get_reproduce_file(worker_name)
165169
color_stdout('# reproduce file: %s\n' % reproduce_file_path)
166170
if show_reproduce_content:

0 commit comments

Comments
 (0)