Changeset d142ec5


Ignore:
Timestamp:
May 18, 2018, 3:59:52 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
2472a19, ccdab45
Parents:
c7d8100c
Message:

Fixed handling of jobs parameter in test.py

Location:
src/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/pybin/tools.py

    rc7d8100c rd142ec5  
    168168def jobCount( options, tests ):
    169169        # check if the user already passed in a number of jobs for multi-threading
    170         make_flags = os.environ.get('MAKEFLAGS')
    171         make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
    172         if make_jobs_fds :
    173                 tokens = os.read(int(make_jobs_fds.group(2)), 1024)
    174                 options.jobs = len(tokens)
    175                 os.write(int(make_jobs_fds.group(3)), tokens)
     170        if not options.jobs:
     171                make_flags = os.environ.get('MAKEFLAGS')
     172                force = bool(make_flags)
     173                make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
     174                if make_jobs_fds :
     175                        tokens = os.read(int(make_jobs_fds.group(2)), 1024)
     176                        options.jobs = len(tokens)
     177                        os.write(int(make_jobs_fds.group(3)), tokens)
     178                else :
     179                        options.jobs = multiprocessing.cpu_count()
    176180        else :
    177                 options.jobs = multiprocessing.cpu_count()
     181                force = True
    178182
    179183        # make sure we have a valid number of jobs that corresponds to user input
     
    182186                sys.exit(1)
    183187
    184         return min( options.jobs, len(tests) ), True if make_flags else False
     188        return min( options.jobs, len(tests) ), force
    185189
    186190# setup a proper processor pool with correct signal handling
  • src/tests/test.py

    rc7d8100c rd142ec5  
    9696        parser.add_argument('--all', help='Run all test available', action='store_true')
    9797        parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
    98         parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int, default='8')
     98        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
    9999        parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
    100100        parser.add_argument('-I','--include', help='Directory of test to include, can be used multiple time, All  if omitted', action='append')
Note: See TracChangeset for help on using the changeset viewer.