Skip to content

Commit 3466fb1

Browse files
committed
test: add verbose mode for debug extension tests
If the environment variable `DEBUGGER_TEST_VERBOSE` is set, each test prints the generated command and its output and doesn't delete the files generated for it. Reviewed-by: Evgeniy Temirgaleev <e.temirgaleev@tarantool.org> Reviewed-by: Sergey Bronnikov <sergeyb@tarantool.org> Signed-off-by: Sergey Kaplun <skaplun@tarantool.org>
1 parent a5de08e commit 3466fb1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

test/tarantool-debugger-tests/debug-extension-tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
# Don't run any initialization scripts.
4444
RUN_CMD_FILE = ['--batch', '--nx', '--quiet', '--command']
4545

46+
TEST_VERBOSE = os.getenv('DEBUGGER_TEST_VERBOSE', default=False)
47+
4648
RX_ADDR = r'0x[a-f0-9]+'
4749
RX_HASH = RX_ADDR # The same pattern for hexademic values.
4850
RX_BCN = r'00\d\d'
@@ -52,7 +54,7 @@
5254

5355

5456
def persist(data):
55-
tmp = tempfile.NamedTemporaryFile(mode='w')
57+
tmp = tempfile.NamedTemporaryFile(mode='w', delete=not TEST_VERBOSE)
5658
tmp.write(data)
5759
tmp.flush()
5860
return tmp
@@ -149,7 +151,12 @@ def setUpClass(cls):
149151
LUAJIT_BINARY,
150152
script_file.name,
151153
]
154+
if TEST_VERBOSE:
155+
print('# Test name: {}'.format(cls.__name__))
156+
print('# Test command: {}'.format(' '.join(process_cmd)))
152157
cls.output = execute_process(process_cmd)
158+
if TEST_VERBOSE:
159+
print('# Command output:\n{}'.format(cls.output))
153160
cmd_file.close()
154161
script_file.close()
155162

0 commit comments

Comments
 (0)