Changeset cdbab55 for tests/test.py


Ignore:
Timestamp:
Aug 21, 2018, 2:24:29 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
2a6292d
Parents:
2b79a70 (diff), efa8b6a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/test.py

    r2b79a70 rcdbab55  
    8585        # create a parser with the arguments for the tests script
    8686        parser = argparse.ArgumentParser(description='Script which runs cforall tests')
    87         parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no')
     87        parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='yes')
     88        parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=yes_no, default='no')
    8889        parser.add_argument('--arch', help='Test for specific architecture', type=str, default='')
     90        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60)
     91        parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
    8992        parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
    9093        parser.add_argument('--list', help='List all test available', action='store_true')
     
    97100        parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run')
    98101
    99         options =  parser.parse_args()
     102        try:
     103                options =  parser.parse_args()
     104        except:
     105                print('ERROR: invalid arguments', file=sys.stderr)
     106                parser.print_help(sys.stderr)
     107                sys.exit(1)
    100108
    101109        # script must have at least some tests to run or be listing
     
    154162                if settings.dry_run or fileIsExecutable(exe_file) :
    155163                        # run test
    156                         retcode, _ = sh("timeout 60 %s > %s 2>&1" % (exe_file, out_file), input = in_file)
     164                        retcode, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe_file, out_file), input = in_file)
    157165                else :
    158166                        # simply cat the result into the output
     
    166174
    167175        if retcode == 0:
     176                # fixoutput(out_file)
    168177                if settings.generating :
    169178                        # if we are ounly generating the output we still need to check that the test actually exists
     
    176185                else :
    177186                        # fetch return code and error from the diff command
    178                         fixoutput(out_file)
    179187                        retcode, error = diff(cmp_file, out_file)
    180188
     
    228236                        tests,
    229237                        chunksize = 1
    230                 ).get(7200)
     238                ).get(settings.timeout.total)
    231239        except KeyboardInterrupt:
    232240                pool.terminate()
     
    277285        # users may want to simply list the tests
    278286        if options.list_comp :
    279                 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected -j --jobs ", end='')
     287                print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='')
    280288                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    281289
     
    285293
    286294        else :
     295                # check the build configuration works
     296                settings.validate()
     297
    287298                options.jobs, forceJobs = jobCount( options, tests )
    288299                settings.updateMakeCmd(forceJobs, options.jobs)
Note: See TracChangeset for help on using the changeset viewer.