Skip to content

Commit 7c10720

Browse files
committed
luatest: disable stdout buffering
Follows up #119
1 parent 9e326af commit 7c10720

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/luatest_server.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ def execute(self, server):
4141
"""
4242
server.current_test = self
4343
script = os.path.join(os.path.basename(server.testdir), self.name)
44-
command = ['luatest', '-c', '--verbose', script, '--output', 'tap']
44+
45+
# Disable stdout buffering.
46+
command = [server.binary, '-e', "io.stdout:setvbuf('no')"]
47+
# Add luatest as the script.
48+
command.extend([server.luatest])
49+
# Add luatest command-line options.
50+
command.extend(['-c', '--verbose', script, '--output', 'tap'])
4551
if Options().args.pattern:
4652
for p in Options().args.pattern:
4753
command.extend(['--pattern', p])
4854

49-
# Tarantool's build directory is added to PATH in
50-
# TarantoolServer.find_exe().
51-
#
5255
# We start luatest from the project source directory, it
5356
# is the usual way to use luatest.
5457
#
@@ -113,14 +116,15 @@ def find_exe(cls, builddir):
113116
cls.binary = TarantoolServer.binary
114117
cls.debug = bool(re.findall(r'^Target:.*-Debug$', str(cls.version()),
115118
re.M))
119+
cls.luatest = os.environ['TEST_RUN_DIR'] + '/lib/luatest/bin/luatest'
116120

117121
@classmethod
118122
def verify_luatest_exe(cls):
119123
"""Verify that luatest executable is available."""
120124
try:
121125
# Just check that the command returns zero exit code.
122126
with open(os.devnull, 'w') as devnull:
123-
returncode = Popen(['luatest', '--version'],
127+
returncode = Popen([cls.luatest, '--version'],
124128
stdout=devnull,
125129
stderr=devnull).wait()
126130
if returncode != 0:

0 commit comments

Comments
 (0)