tests/run-tests.py
changeset 6383 38485d45f947
parent 6366 07c3cd695b48
child 6681 6a6ef726a2b3
equal deleted inserted replaced
6382:f3c3965fa0ff 6383:38485d45f947
   357 
   357 
   358     if options.timeout > 0:
   358     if options.timeout > 0:
   359         signal.alarm(0)
   359         signal.alarm(0)
   360 
   360 
   361     skipped = (ret == SKIPPED_STATUS)
   361     skipped = (ret == SKIPPED_STATUS)
   362     diffret = 0
       
   363     # If reference output file exists, check test output against it
   362     # If reference output file exists, check test output against it
   364     if os.path.exists(ref):
   363     if os.path.exists(ref):
   365         f = open(ref, "r")
   364         f = open(ref, "r")
   366         ref_out = splitnewlines(f.read())
   365         ref_out = splitnewlines(f.read())
   367         f.close()
   366         f.close()
   368     else:
   367     else:
   369         ref_out = []
   368         ref_out = []
   370     if not skipped and out != ref_out:
       
   371         diffret = 1
       
   372         fail("output changed")
       
   373         show_diff(ref_out, out)
       
   374     if skipped:
   369     if skipped:
   375         missing = extract_missing_features(out)
   370         missing = extract_missing_features(out)
   376         if not missing:
   371         if not missing:
   377             missing = ['irrelevant']
   372             missing = ['irrelevant']
   378         skip(missing[-1])
   373         skip(missing[-1])
       
   374     elif out != ref_out:
       
   375         if ret:
       
   376             fail("output changed and returned error code %d" % ret)
       
   377         else:
       
   378             fail("output changed")
       
   379         show_diff(ref_out, out)
       
   380         ret = 1
   379     elif ret:
   381     elif ret:
   380         fail("returned error code %d" % ret)
   382         fail("returned error code %d" % ret)
   381     elif diffret:
       
   382         ret = diffret
       
   383 
   383 
   384     if not verbose:
   384     if not verbose:
   385         sys.stdout.write(skipped and 's' or '.')
   385         sys.stdout.write(skipped and 's' or '.')
   386         sys.stdout.flush()
   386         sys.stdout.flush()
   387 
   387