Ticket #9243: trac_9243.patch

File trac_9243.patch, 3.8 KB (added by Dan Drake, 13 years ago)

apply to scripts repo

  • sage-doctest

    # HG changeset patch
    # User Dan Drake <drake@kaist.edu>
    # Date 1276663712 -32400
    # Node ID 219d464b7b26bdc58f2b17a1e865254be06bf841
    # Parent  0ccdd7fa8f576a961f4dc3ef904429fada914238
    trac 9243: sage-doctest should use powers of 2 for return codes
    
    diff --git a/sage-doctest b/sage-doctest
    a b  
    1010# 0: all tests passed
    1111# 1: file not found
    1212# 2: KeyboardInterrupt
    13 # 3: doctest process was terminated by a signal
    14 # 4: the doctesting framework raised an exception
    15 # 100: failed doctests
     13# 4: doctest process was terminated by a signal
     14# 8: the doctesting framework raised an exception
     15# 16: script called with bad options
     16# 128: failed doctests
    1617####################################################################
    1718
    1819# System imports
     
    665666                out = outf.read()
    666667                e = proc.poll()
    667668        except KeyboardInterrupt:
    668             print "KeyboardInterrupt -- interrupted after %s seconds!" % (time.time()-tm)
     669            print "KeyboardInterrupt -- interrupted after %.1f seconds!" % (time.time()-tm)
    669670            sys.exit(2)
    670671        if not verbose and 'raise KeyboardInterrupt' in err:
    671672            print "*"*80 + "Control-C pressed -- interrupting doctests." + "*"*80
     
    682683            # The doctesting code raised an exception
    683684            if not verbose:
    684685                print "Exception raised by doctesting framework. Use -verbose for details."
    685             sys.exit(4)
     686            sys.exit(8)
    686687
    687688        if numfail == 0 and e > 0:
    688689            numfail = e
    689690        if numfail > 0:
    690691            if not (verbose or gdb or memcheck or massif or cachegrind):
    691692                print s
    692             sys.exit(100)
     693            sys.exit(128)
    693694        elif e < 0:
    694695            if not verbose:
    695696                print "The doctested process was killed by signal %s" % (-e)
    696             sys.exit(3)
     697            sys.exit(4)
    697698        else:
    698699            delete_tmpfiles()
    699700            sys.exit(0)
     
    756757
    757758def usage():
    758759    print "\n\nUsage: sage-doctest [same options as sage -t] filenames"
    759     sys.exit(1)
     760    sys.exit(16)
    760761       
    761762if __name__ ==  '__main__':
    762763    import os, sys
  • sage-ptest

    diff --git a/sage-ptest b/sage-ptest
    a b  
    136136    ol = result[3]
    137137    err = err | ret
    138138    if ret != 0:
    139         if ret == 100:
     139        if ret == 128:
    140140            numfail = ol.count('Expected:') + ol.count('Expected nothing') + ol.count('Exception raised:')
    141141            failed.append(abs(F)+(" # %s doctests failed" % numfail))
    142142            ret = numfail
     143        elif ret == 8:
     144            failed.append(abs(F)+" # Exception from doctest framework")
    143145        elif ret == 4:
    144             failed.append(abs(F)+" # Exception from doctest framework")
    145         elif ret == 3:
    146146            failed.append(abs(F)+" # Killed/crashed")
    147147        elif ret == 2:
    148148            failed.append(abs(F)+" # KeyboardInterrupt")
  • sage-test

    diff --git a/sage-test b/sage-test
    a b  
    9090    elif err == 2: # process exit code 2: KeyboardInterrupt
    9191        failed.append(sage_test_command(F)+" # KeyboardInterrupt")
    9292        raise KeyboardInterrupt
    93     elif err == 3: # process exit code 3: Terminated by signal
     93    elif err == 4: # process exit code 4: Terminated by signal
    9494        failed.append(sage_test_command(F)+" # Killed/crashed")
    95     elif err == 4: # process exit code 4: Unhandled doctest exception
     95    elif err == 8: # process exit code 8: Unhandled doctest exception
    9696        failed.append(sage_test_command(F)+" # Exception from doctest framework")
    97     elif err == 100: # process exit code 100: Regular doctest failures
     97    elif err == 128: # process exit code 128: Regular doctest failures
    9898        failed.append(sage_test_command(F))
    9999    elif err != 0:
    100100        failed.append(sage_test_command(F))