diff --git a/lib/luatest_server.py b/lib/luatest_server.py index 0793601d..2e67f42a 100644 --- a/lib/luatest_server.py +++ b/lib/luatest_server.py @@ -34,10 +34,10 @@ def __init__(self, *args, **kwargs): def execute(self, server): """Execute test by luatest command - Execute `luatest -c --no-clean --verbose _test.lua --output tap` - command. Disable capture mode and deletion of the var directory. - Provide a verbose output in the tap format. Extend the command by - `--pattern ` if the corresponding option is provided. + Execute `luatest -c --no-clean -l --verbose _test.lua --output tap` + command. Disable capture mode and deletion of the var directory. Provide a verbose + output in the tap format. Extend the command by `--pattern ` if the + corresponding option is provided. """ server.current_test = self script = os.path.join(os.path.basename(server.testdir), self.name) @@ -51,6 +51,8 @@ def execute(self, server): if Options().args.pattern: for p in Options().args.pattern: command.extend(['--pattern', p]) + unified_logfile_path = os.path.join(server.vardir, 'run.log') + command.extend(['-l', unified_logfile_path]) # We start luatest from the project source directory, it # is the usual way to use luatest. diff --git a/lib/worker.py b/lib/worker.py index db54de9d..b691247c 100644 --- a/lib/worker.py +++ b/lib/worker.py @@ -69,6 +69,16 @@ def get_reproduce_file(worker_name): return os.path.join(reproduce_dir, '%s.list.yaml' % worker_name) +def get_unified_logfile(worker_name): + # Unified logging is only for LuatestServer workers. + # It doesn't always guarantee a log file. + # If it doesn't exist, it will return None. + if 'luatest' in worker_name: + path = os.path.join(main_vardir(), worker_name, Options().args.log) + if os.path.isfile(path): + return path + + def print_greetings(): # print information about tarantool color_stdout('\n') diff --git a/listeners.py b/listeners.py index 252f3b61..1d351385 100644 --- a/listeners.py +++ b/listeners.py @@ -14,6 +14,7 @@ from lib.worker import WorkerOutput from lib.worker import WorkerTaskResult from lib.worker import get_reproduce_file +from lib.worker import get_unified_logfile from lib.utils import prefix_each_line from lib.utils import safe_makedirs from lib.utils import print_tail_n @@ -167,6 +168,9 @@ def print_tasks_info(self, tasks): color_stdout("---\n", schema='separator') print_tail_n(reproduce_file_path) color_stdout("...\n", schema='separator') + unified_logfile_path = get_unified_logfile(worker_name) + if unified_logfile_path: + color_stdout('# unified logfile: %s\n' % unified_logfile_path) def print_statistics(self): """Print statistics and results of testing."""