Pass the tests only if we find an expected positive output (rather than checking for negative output to fail the tests).

This commit is contained in:
Kevin Brothaler 2017-01-16 19:07:18 -04:00 committed by Digipom Inc
parent a6f50bb61a
commit fdee442356
1 changed files with 4 additions and 4 deletions

View File

@ -80,15 +80,15 @@ def run_app_on_simulator():
print 'Running app'
try:
test_run = subprocess.Popen(['xcrun', 'simctl', 'launch', '--console', 'booted', 'com.rust.unittests'], stdout=subprocess.PIPE, bufsize=1, universal_newlines=True)
test_run_failed = False
test_run_passed = False
for line in test_run.stdout:
sys.stdout.write(line)
if test_run_failed == False:
if test_run_passed == False:
# Based on all.rs test output
test_run_failed = 'some tests failed' in line
test_run_passed = 'PASSED' in line and 'tests' in line
sys.stdout.flush()
if test_run_failed == True:
if test_run_passed == False:
raise Exception('Some tests failed')
finally:
print 'Shutting down simulator'