Skip to content
Snippets Groups Projects
Commit 40d4f768 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

tests/integration: mandatory self-checks before running

parent 62117a3a
Branches
Tags
No related merge requests found
......@@ -14,6 +14,8 @@ class Test:
""" Run planned tests. """
planned = len(self.tests)
passed = 0
if planned == 0:
return
print('[==========] Running %d test(s).' % planned)
for name, test_callback, args in self.tests:
......@@ -25,10 +27,12 @@ class Test:
except Exception as e:
print('[ FAIL ] %s (%s)' % (name, str(e)))
# Clear test set
self.tests = []
print('[==========] %d test(s) run.' % planned)
if passed == planned:
print('[ PASSED ] %d test(s).' % passed)
return 0
else:
print('[ FAILED ] %d test(s).' % (planned - passed))
return 1
return 1
\ No newline at end of file
......@@ -124,16 +124,17 @@ def test_sendrecv():
if __name__ == '__main__':
# Self-test code
if '--test' in sys.argv:
test = test.Test()
test.add('testserver/sendrecv', test_sendrecv)
sys.exit(test.run())
test = test.Test()
test.add('testserver/sendrecv', test_sendrecv)
if test.run() != 0:
sys.exit(1)
# Mirror server
server = TestServer(None, socket.AF_INET, '127.0.0.1')
print('mirror server running at %s' % str(server.address()))
print('[==========] Mirror server running at %s' % str(server.address()))
try:
server.run()
except KeyboardInterrupt:
pass
print('[==========] Shutdown.')
pass
server.stop()
......@@ -150,16 +150,15 @@ def test_ipc(*args):
if __name__ == '__main__':
# Self-tests first
test = test.Test()
# Self-test code
if '--test' in sys.argv:
test.add('integration/ipc', test_ipc)
test.add('integration/ipc', test_ipc)
if test.run() != 0:
sys.exit(1)
else:
# Scan for scenarios
for arg in sys.argv[1:]:
objects = find_objects(arg)
for path in objects:
test.add(path, play_object, path)
sys.exit(test.run())
sys.exit(test.run())
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment