Files
scylladb/test.py
Tomasz Grabiec c4d18b6ae6 tests: introduce test runner script
To run all unit tests:

  $ ./test.py
  [3/6] RUNNING build/release/tests/sstring_test
2014-10-15 15:50:46 +02:00

48 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import sys
import subprocess
all_tests = [
'futures_test',
'sstring_test',
]
last_len = 0
def print_status(msg):
global last_len
print('\r' + ' '*last_len, end='')
last_len = len(msg)
print('\r' + msg, end='')
if __name__ == "__main__":
black_hole = open('/dev/null', 'w')
test_to_run = []
for mode in ['debug', 'release']:
for test in all_tests:
test_to_run.append(os.path.join('build', mode, 'tests', test))
all_ok = True
n_total = len(test_to_run)
for n, path in enumerate(test_to_run):
prefix = '[%d/%d]' % (n + 1, n_total)
if not os.path.exists(path):
print_status('MISSING: %s\n' % (path))
all_ok = False
else:
print_status('%s RUNNING %s' % (prefix, path))
if subprocess.call([path], stdout=black_hole, stderr=black_hole):
print_status('FAILED: %s\n' % (path))
all_ok = False
else:
print_status('%s PASSED %s' % (prefix, path))
if all_ok:
print('\nOK.')
else:
print_status('')
sys.exit(1)