Skip to content

Commit 53dcb85

Browse files
committed
Make reftest analyzer popup in masterMode when there are differences, if --reftest is specified.
1 parent f4e5b2b commit 53dcb85

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

test/test.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -439,26 +439,30 @@ def checkLoad(task, results, browser):
439439

440440
def processResults():
441441
print ''
442-
numErrors, numEqFailures, numEqNoSnapshot, numFBFFailures = State.numErrors, State.numEqFailures, State.numEqNoSnapshot, State.numFBFFailures
443-
numFatalFailures = (numErrors + numFBFFailures)
444-
if 0 == numEqFailures and 0 == numFatalFailures:
442+
numFatalFailures = (State.numErrors + State.numFBFFailures)
443+
if 0 == State.numEqFailures and 0 == numFatalFailures:
445444
print 'All tests passed.'
446445
else:
447446
print 'OHNOES! Some tests failed!'
448-
if 0 < numErrors:
449-
print ' errors:', numErrors
450-
if 0 < numEqFailures:
451-
print ' different ref/snapshot:', numEqFailures
452-
if 0 < numFBFFailures:
453-
print ' different first/second rendering:', numFBFFailures
454-
455-
if State.masterMode and (0 < numEqFailures or 0 < numEqNoSnapshot):
447+
if 0 < State.numErrors:
448+
print ' errors:', State.numErrors
449+
if 0 < State.numEqFailures:
450+
print ' different ref/snapshot:', State.numEqFailures
451+
if 0 < State.numFBFFailures:
452+
print ' different first/second rendering:', State.numFBFFailures
453+
454+
455+
def maybeUpdateRefImages(options, browser):
456+
if options.masterMode and (0 < State.numEqFailures or 0 < State.numEqNoSnapshot):
456457
print "Some eq tests failed or didn't have snapshots."
457458
print 'Checking to see if master references can be updated...'
459+
numFatalFailures = (State.numErrors + State.numFBFFailures)
458460
if 0 < numFatalFailures:
459461
print ' No. Some non-eq tests failed.'
460462
else:
461-
' Yes! The references in tmp/ can be synced with ref/.'
463+
print ' Yes! The references in tmp/ can be synced with ref/.'
464+
if options.reftest:
465+
startReftest(browser)
462466
if not prompt('Would you like to update the master copy in ref/?'):
463467
print ' OK, not updating.'
464468
else:
@@ -507,7 +511,9 @@ def main():
507511
t2 = time.time()
508512
print "Runtime was", int(t2 - t1), "seconds"
509513

510-
if options.reftest and State.numEqFailures > 0:
514+
if options.masterMode:
515+
maybeUpdateRefImages(options, browsers[0])
516+
elif options.reftest and State.numEqFailures > 0:
511517
print "\nStarting reftest harness to examine %d eq test failures." % State.numEqFailures
512518
startReftest(browsers[0])
513519

0 commit comments

Comments
 (0)