Changeset 4e9151f for src/tests/test.py


Ignore:
Timestamp:
Apr 24, 2017, 12:55:22 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
00303d50
Parents:
b3d70eba
Message:
  • Fixed tests to no longer use make errors, pipeing CC errors directly instead
  • Tests now use the number of cores as the number of jobs if jobserver is not defined
  • Tests now support both jobserver-fds and and jobserver-auth as the file descriptor variables
  • Tests now limit the number of concurrent jobs to the total number of tests
  • Tests now ignore whitespaces and blank lines when comparing diffs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    rb3d70eba r4e9151f  
    1313import stat
    1414import sys
     15import multiprocessing
    1516
    1617################################################################################
     
    115116        # find the output file based on the test name and options flag
    116117        out_file = (".out/%s.log" % test.name) if not generate else (".expect/%s.txt" % test.path)
     118        err_file = ".err/%s.log" % test.name
    117119
    118120        # remove any outputs from the previous tests to prevent side effects
     
    137139                        sh("cat %s > %s" % (test.name, out_file), dry_run)
    138140
     141        else :
     142                # command failed save the log to less temporary file
     143                sh("mv %s %s" % (err_file, out_file), dry_run)
     144
    139145        retcode = 0
    140146        error = None
    141147
    142         # fix output to prevent make depth to cause issues
    143         fix_MakeLevel(out_file)
     148        # # fix output to prevent make depth to cause issues
     149        # fix_MakeLevel(out_file)
    144150
    145151        if generate :
     
    152158        else :
    153159                # diff the output of the files
    154                 diff_cmd = ("diff --old-group-format='\t\tmissing lines :\n"
     160                diff_cmd = ("diff --ignore-all-space "
     161                                        "--ignore-blank-lines "
     162                                        "--old-group-format='\t\tmissing lines :\n"
    155163                                        "%%<' \\\n"
    156164                                        "--new-group-format='\t\tnew lines :\n"
     
    212220
    213221        #make sure the required folder are present
    214         sh('mkdir -p .out .expect', dry_run)
     222        sh('mkdir -p .out .expect .err', dry_run)
    215223
    216224        if generate :
     
    309317# check if the user already passed in a number of jobs for multi-threading
    310318make_flags = environ.get('MAKEFLAGS')
    311 make_jobs_fds = re.search("--jobserver-fds=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
     319make_jobs_fds = re.search("--jobserver-(auth|fds)=\s*([0-9]+),([0-9]+)", make_flags) if make_flags else None
    312320if make_jobs_fds :
    313         tokens = os.read(int(make_jobs_fds.group(1)), 1024)
     321        tokens = os.read(int(make_jobs_fds.group(2)), 1024)
    314322        options.jobs = len(tokens)
    315         os.write(int(make_jobs_fds.group(2)), tokens)
     323        os.write(int(make_jobs_fds.group(3)), tokens)
     324else :
     325        options.jobs = multiprocessing.cpu_count()
    316326
    317327# make sure we have a valid number of jobs that corresponds to user input
     
    320330        sys.exit(1)
    321331
     332options.jobs = min( options.jobs, len(tests) )
     333
    322334print('Running (%s) on %i cores' % ("debug" if options.debug else "no debug", options.jobs))
    323335make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
Note: See TracChangeset for help on using the changeset viewer.