Changeset 209383b


Ignore:
Timestamp:
Dec 4, 2017, 6:10:25 PM (4 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, resolv-new, with_gc
Children:
099a40d
Parents:
bacc36c
Message:

Tests: moved debug flags to settings to eliminate parameters and functools

Location:
src/tests
Files:
3 edited

Legend:

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

    rbacc36c r209383b  
    1717        global generating
    1818        global make
     19        global debug
     20        global debugFlag
    1921
    2022        arch       = Architecture(options.arch)
     
    2224        generating = options.regenerate_expected
    2325        make       = './make_command_not_initialized'
     26        debug        = "debug" if options.debug else "no debug"
     27        debugFlag  = """DEBUG_FLAGS="%s" """ % ("-debug" if debug else "-nodebug")
    2428
    2529def updateMakeCmd(force, jobs):
  • src/tests/pybin/tools.py

    rbacc36c r209383b  
    7676                '-s' if silent else '',
    7777                test_param,
     78                settings.debugFlag,
    7879                flags,
    7980                target,
  • src/tests/test.py

    rbacc36c r209383b  
    77
    88import argparse
    9 import functools
    109import re
    1110import sys
     
    1514################################################################################
    1615
    17 def list_expected():
     16def findTests():
    1817        expected = []
    1918
     
    3736
    3837        # tests directly in the .expect folder will always be processed
    39         test_list = list_expected()
     38        test_list = findTests()
    4039
    4140        # if we have a limited number of includes, filter by them
     
    120119################################################################################
    121120# logic to run a single test and return the result (No handling of printing or other test framework logic)
    122 def run_single_test(test, debug):
     121def run_single_test(test):
    123122
    124123        # find the output file based on the test name and options flag
     
    134133        rm( (out_file, err_file, test.target()) )
    135134
    136         options = "-debug" if debug else "-nodebug"
    137 
    138135        # build, skipping to next test on error
    139136        make_ret, _ = make( test.target(),
    140                 flags      = """DEBUG_FLAGS="%s" """ % options,
    141137                redirects  = "2> %s 1> /dev/null" % out_file,
    142138                error_file = err_file
     
    180176
    181177# run a single test and handle the errors, outputs, printing, exception handling, etc.
    182 def run_test_worker(t, debug) :
     178def run_test_worker(t) :
    183179
    184180        with SignalHandling():
     
    186182                name_txt = "%20s  " % t.name
    187183
    188                 retcode, error = run_single_test(t, debug)
     184                retcode, error = run_single_test(t)
    189185
    190186                # update output based on current action
     
    205201
    206202# run the given list of tests with the given parameters
    207 def run_tests(tests, jobs, debug) :
     203def run_tests(tests, jobs) :
    208204        # clean the sandbox from previous commands
    209205        make('clean', redirects = '> /dev/null 2>&1')
     
    215211        try :
    216212                results = pool.map_async(
    217                         functools.partial(run_test_worker, debug=debug),
     213                        run_test_worker,
    218214                        tests,
    219215                        chunksize = 1
     
    267263
    268264        elif options.list :
    269                 print("Listing for %s:%s"% (settings.arch.toString(), "debug" if options.debug else "no debug"))
     265                print("Listing for %s:%s"% (settings.arch.toString(), settings.debug))
    270266                print("\n".join(map(lambda t: "%s" % (t.toString()), tests)))
    271267
     
    277273                        'Regenerate tests' if settings.generating else 'Running',
    278274                        settings.arch.toString(),
    279                         "debug" if options.debug else "no debug",
     275                        settings.debug,
    280276                        options.jobs
    281277                ))
    282278
    283279                # otherwise run all tests and make sure to return the correct error code
    284                 sys.exit( run_tests(tests, options.jobs, options.debug) )
     280                sys.exit( run_tests(tests, options.jobs) )
Note: See TracChangeset for help on using the changeset viewer.