Changeset 513

Show
Ignore:
Timestamp:
Mon Aug 4 11:59:54 2008
Author:
htgoebel
Message:

Allow passing testnames as arguments.

Files:

Legend:

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

    r507 r513  
    93 93     path = os.environ["PATH"]  
    94 94     counter = dict(passed=[],failed=[])  
    95       for src in tests:  
    96           _msg("BUILDING TEST", src)  
    97           test = os.path.splitext(os.path.basename(src))[0]  
      95     for test in tests:  
      96         test = os.path.splitext(os.path.basename(test))[0]  
      97         _msg("BUILDING TEST", test)  
    98 98         res = os.system(string.join([PYTHON, os.path.join(HOME, 'Build.py'),  
    99 99                                      OPTS, test+".spec"],  
    100 100                                     ' '))  
    101 101         if run_executable:  
    102               _msg("EXECUTING TEST", src)  
      102             _msg("EXECUTING TEST", test)  
    102 102             # Run the test in a clean environment to make sure they're  
    103 103             # really self-contained  
     
    108 108  
    109 109         if res == 0:  
    110               _msg("FINISHING TEST", src, short=1)  
    111               counter["passed"].append(src)  
      110             _msg("FINISHING TEST", test, short=1)  
      111             counter["passed"].append(test)  
    112 112         else:  
    113               _msg("TEST", src, "FAILED", short=1)  
    114               counter["failed"].append(src)  
      113             _msg("TEST", test, "FAILED", short=1)  
      114             counter["failed"].append(test)  
    115 115     print counter  
    116 116  
     
    121 121  
    122 122     from optparse import OptionParser  
    123       parser = OptionParser(usage="%prog [options]")  
      123     parser = OptionParser(usage="%prog [options] [TEST-NAME ...]",  
      124                           epilog="TEST-NAME can be the name of the .py-file, the .spec-file or only the basename.")  
    124 125     parser.add_option('-c', '--clean', action='store_true',  
    125 126                       help='Clean up generated files')  
     
    134 135  
    135 136     opts, args = parser.parse_args()  
    136       if args:  
    137           parser.error('Does not expect any arguments')  
    138 137  
    139 138     if opts.clean:  
     
    142 141         raise SystemExit()  
    143 142  
    144       if opts.interactive_tests:  
      143     if args:  
      144         if opts.interactive_tests:  
      145             parser.error('Must not specify -i/--interactive-tests when passing test names.')  
      146         tests = args  
      147     elif opts.interactive_tests:  
    145 148         print "Running interactive tests"  
    146 149         tests = interactive_tests