Changeset 6a1bdfd for src/tests/test.py
- Timestamp:
- Dec 13, 2016, 5:42:53 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- cc640aad
- Parents:
- 37efaf56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/test.py
r37efaf56 r6a1bdfd 104 104 # running test functions 105 105 ################################################################################ 106 def run_single_test(test, generate, dry_run ):106 def run_single_test(test, generate, dry_run, debug): 107 107 108 108 # find the output file based on the test name and options flag … … 113 113 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run) 114 114 115 options = "-debug" if debug else "-nodebug"; 116 115 117 # build, skipping to next test on error 116 make_ret, _ = sh(" %s %s 2> %s 1> /dev/null" % (make_cmd, test.name, out_file), dry_run)118 make_ret, _ = sh("""%s CFLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 117 119 118 120 # if the make command succeds continue otherwise skip to diff … … 165 167 return retcode, error 166 168 167 def run_test_instance(t, generate, dry_run ) :169 def run_test_instance(t, generate, dry_run, debug) : 168 170 # print formated name 169 171 name_txt = "%20s " % t.name 170 172 171 173 #run the test instance and collect the result 172 test_failed, error = run_single_test(t, generate, dry_run )174 test_failed, error = run_single_test(t, generate, dry_run, debug) 173 175 174 176 # update output based on current action … … 194 196 195 197 # run the given list of tests with the given parameters 196 def run_tests(tests, generate, dry_run, jobs ) :198 def run_tests(tests, generate, dry_run, jobs, debug) : 197 199 # clean the sandbox from previous commands 198 200 sh("%s clean > /dev/null 2>&1" % make_cmd, dry_run) … … 207 209 pool = Pool(jobs) 208 210 try : 209 results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run ), tests ).get(99999999)211 results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(99999999) 210 212 except KeyboardInterrupt: 211 213 pool.terminate() … … 222 224 return 0 223 225 226 def yes_no(string): 227 if string == "yes" : 228 return True 229 if string == "no" : 230 return False 231 raise argparse.ArgumentTypeError(msg) 232 return False 233 234 224 235 ################################################################################ 225 236 # main loop … … 227 238 # create a parser with the arguments for the tests script 228 239 parser = argparse.ArgumentParser(description='Script which runs cforall tests') 240 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no') 229 241 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true') 230 242 parser.add_argument('--list', help='List all test available', action='store_true') … … 296 308 sys.exit(1) 297 309 298 print('Running on %i cores' % options.jobs)310 print('Running (%s) on %i cores' % ("debug" if options.debug else "no debug", options.jobs)) 299 311 make_cmd = "make" if make_flags else ("make -j%i" % options.jobs) 300 312 … … 305 317 else : 306 318 # otherwise run all tests and make sure to return the correct error code 307 sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run, options.jobs ) )319 sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run, options.jobs, options.debug) )
Note: See TracChangeset
for help on using the changeset viewer.