Changeset 506

Show
Ignore:
Timestamp:
Mon Jul 28 13:45:00 2008
Author:
htgoebel
Message:

Switched to optparse/optik.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/buildtests/runtests.py

    r504 r506  
    110 110     normal_tests = glob.glob('test*[0-9].py')  
    111 111     interactive_tests = glob.glob('test*[0-9]i.py')  
    112       args = sys.argv[1:]  
    113 112  
    114       run_executable = 1  
    115       if "-n" in args:  
    116           # Do not run the built executables. Useful for cross builds.  
    117           run_executable = 0  
    118       if "-c" in args:  
      113     from optparse import OptionParser  
      114     parser = OptionParser(usage="%prog [options]")  
      115     parser.add_option('-c', '--clean', action='store_true',  
      116                       help='Clean up generated files')  
      117     parser.add_option('-i', '--interactive-tests', action='store_true',  
      118                       help='Run interactive tests (default: run normal tests)')  
      119     parser.add_option('-n', '--no-run', action='store_true',  
      120                       help='Do not run the built executables. '  
      121                            'Useful for cross builds.')  
      122  
      123     opts, args = parser.parse_args()  
      124     if args:  
      125         parser.error('Does not expect any arguments')  
      126  
      127     if opts.clean:  
    119 128         # only clean up  
    120           tests = []  
    121       elif "-i" in args:  
      129         clean()  
      130         raise SystemExit()  
      131  
      132     if opts.interactive_tests:  
    122 133         print "Running interactive tests"  
    123 134         tests = interactive_tests  
    124 135     else:  
    125           print "Running normal tests (-i for interactive tests)"  
    126 136         tests = normal_tests  
      137         print "Running normal tests (-i for interactive tests)"  
    127 138  
    128 139     clean()  
    129       if tests:  
    130           runtests(tests, run_executable=run_executable)  
      140     runtests(tests, run_executable=not opts.no_run)