Changeset 6a1bdfd


Ignore:
Timestamp:
Dec 13, 2016, 5:42:53 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, with_gc
Children:
cc640aad
Parents:
37efaf56
Message:

Python test script now supports both debug and no debug tests

Location:
src/tests
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/castError.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: Can't choose between alternatives for expression Cast of:
    32  Name: f
  • src/tests/.expect/constant0-1DP.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: duplicate object definition for 0: signed int
    32Error: duplicate object definition for 0: const signed int
  • src/tests/.expect/constant0-1NDDP.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: duplicate object definition for 0: signed int
    32Error: duplicate object definition for 0: const signed int
  • src/tests/.expect/declarationErrors.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: duplicate static in declaration of x1: static const volatile short int
    32
  • src/tests/.expect/dtor-early-exit-ERR1.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: jump to label 'L1' crosses initialization of y Branch (Goto)
    32
  • src/tests/.expect/dtor-early-exit-ERR2.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: jump to label 'L2' crosses initialization of y Branch (Goto)
    32
  • src/tests/.expect/memberCtors-ERR1.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: in void ?{}(struct B *b), field a2 used before being constructed
    32make: *** [memberCtors-ERR1] Error 1
  • src/tests/.expect/scopeErrors.txt

    r37efaf56 r6a1bdfd  
    1 CFA Version 1.0.0 (debug)
    21Error: duplicate object definition for thisIsAnError: signed int
    32Error: duplicate function definition for butThisIsAnError: function
  • src/tests/Makefile.am

    r37efaf56 r6a1bdfd  
    5454
    5555declarationSpecifier: declarationSpecifier.c
    56         ${CC} ${CFALGS} -CFA -XCFA -p ${<} -o ${@}
     56        ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    5757
    5858gccExtensions : gccExtensions.c
     
    6363
    6464memberCtors-ERR1: memberCtors.c
    65         ${CC} ${CFALGS} -DERR1 ${<} -o ${@}
     65        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    6666
  • src/tests/Makefile.in

    r37efaf56 r6a1bdfd  
    676676
    677677declarationSpecifier: declarationSpecifier.c
    678         ${CC} ${CFALGS} -CFA -XCFA -p ${<} -o ${@}
     678        ${CC} ${CFLAGS} -CFA -XCFA -p ${<} -o ${@}
    679679
    680680gccExtensions : gccExtensions.c
     
    685685
    686686memberCtors-ERR1: memberCtors.c
    687         ${CC} ${CFALGS} -DERR1 ${<} -o ${@}
     687        ${CC} ${CFLAGS} -DERR1 ${<} -o ${@}
    688688
    689689# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/test.py

    r37efaf56 r6a1bdfd  
    104104#               running test functions
    105105################################################################################
    106 def run_single_test(test, generate, dry_run):
     106def run_single_test(test, generate, dry_run, debug):
    107107
    108108        # find the output file based on the test name and options flag
     
    113113        sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
    114114
     115        options = "-debug" if debug else "-nodebug";
     116
    115117        # 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)
    117119
    118120        # if the make command succeds continue otherwise skip to diff
     
    165167        return retcode, error
    166168
    167 def run_test_instance(t, generate, dry_run) :
     169def run_test_instance(t, generate, dry_run, debug) :
    168170        # print formated name
    169171        name_txt = "%20s  " % t.name
    170172
    171173        #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)
    173175
    174176        # update output based on current action
     
    194196
    195197# run the given list of tests with the given parameters
    196 def run_tests(tests, generate, dry_run, jobs) :
     198def run_tests(tests, generate, dry_run, jobs, debug) :
    197199        # clean the sandbox from previous commands
    198200        sh("%s clean > /dev/null 2>&1" % make_cmd, dry_run)
     
    207209        pool = Pool(jobs)
    208210        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)
    210212        except KeyboardInterrupt:
    211213                pool.terminate()
     
    222224        return 0
    223225
     226def 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
    224235################################################################################
    225236#               main loop
     
    227238# create a parser with the arguments for the tests script
    228239parser = argparse.ArgumentParser(description='Script which runs cforall tests')
     240parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no')
    229241parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
    230242parser.add_argument('--list', help='List all test available', action='store_true')
     
    296308        sys.exit(1)
    297309
    298 print('Running on %i cores' % options.jobs)
     310print('Running (%s) on %i cores' % ("debug" if options.debug else "no debug", options.jobs))
    299311make_cmd = "make" if make_flags else ("make -j%i" % options.jobs)
    300312
     
    305317else :
    306318        # 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.