Changeset 52c97dd for src/tests


Ignore:
Timestamp:
Jul 15, 2016, 4:10:11 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b8303f44
Parents:
911348cd
Message:

fixed make flags for nested make levels in tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r911348cd r52c97dd  
    181181        for t in tests:
    182182                # print formated name
    183                 print("%20s  " % t.name, end="")
    184                 sys.stdout.flush()
     183                name_txt = "%20s  " % t.name
    185184
    186185                #run the test instance and collect the result
     
    199198
    200199                #print result with error if needed
    201                 print(failed_txt if test_failed else success_txt)
     200                text = name_txt + (failed_txt if test_failed else success_txt)
     201                out = sys.stdout
    202202                if error :
    203                         print(error, file=sys.stderr)
     203                        text = text + "\n" + error
     204                        out = sys.stderr
     205
     206                print(text, file = out);
    204207
    205208        #clean the workspace
     
    217220parser.add_argument('--all', help='Run all test available', action='store_true')
    218221parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
    219 parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int, default='1')
     222parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int, default='8')
    220223parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run')
    221224
     
    266269# check if the user already passed in a number of jobs for multi-threading
    267270make_flags = environ.get('MAKEFLAGS')
    268 make_has_max_jobs = make_flags and "-j" in make_flags
    269 make_max_jobs = re.search("(-j|--jobs)\s*([0-9]+)", make_flags).group(2) if make_has_max_jobs else None
    270 make_cmd = "make" if make_has_max_jobs else "make -j8"
     271make_has_max_jobs = re.search("(-j|--jobs)\s*([0-9]+)", make_flags) if make_flags else None
     272make_max_jobs = make_has_max_jobs.group(2) if make_has_max_jobs else None
     273make_cmd = "make" if make_flags and "-j" in make_flags else "make -j8"
    271274
    272275# make sure we have a valid number of jobs that corresponds to user input
     
    276279        sys.exit(1)
    277280
    278 
    279281# users may want to simply list the tests
    280282if options.list :
     
    283285else :
    284286        # otherwise run all tests and make sure to return the correct error code
    285         sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run) )
     287        sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run, options.jobs) )
Note: See TracChangeset for help on using the changeset viewer.