Changeset 1c31f68


Ignore:
Timestamp:
Jun 15, 2016, 4:13:18 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, 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:
a725c99
Parents:
efc15918
Message:

refactored tests to new python script

Location:
src/tests
Files:
2 added
3 edited
5 moved

Legend:

Unmodified
Added
Removed
  • src/tests/Makefile.am

    refc15918 r1c31f68  
    2121noinst_PROGRAMS = fstream_test vector_test avl_test # build but do not install
    2222fstream_test_SOURCES = fstream_test.c
    23 vector_test_SOURCES = vector_int.c array.c vector_test.c
     23vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
    2424avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
  • src/tests/runTests.sh

    refc15918 r1c31f68  
    2626# current directory named the same; should also be an input file
    2727# tests/$test.in.txt and expected output tests/$test.out.txt
     28# tests="vector_test avl_test"
     29#
     30# # log file for test output;
     31# # reset at the beginning of each run
     32# logfile=tests/log.txt
     33# touch $logfile && rm $logfile
     34#
     35# # clean existing build artifacts before run
     36# make clean > /dev/null 2>&1
     37#
     38# ret_val=0
     39#
     40# for test in $tests; do
     41#       echo -n "    $test" | tee -a $logfile
     42#
     43#       # build, skipping to next test on error
     44#       if ! make -j 8 $test > tests/$test.make.txt 2>&1; then
     45#               ret_val=1
     46#               echo -e "\tFAILED with build error:" | tee -a $logfile
     47#               cat tests/$test.make.txt | tee -a $logfile
     48#               continue
     49#       fi
     50#       rm tests/$test.make.txt
     51#
     52#       # run, testing against expected output
     53#       ./$test < tests/$test.in.txt > tests/$test.run.txt 2>&1
     54#       if ! diff tests/$test.out.txt tests/$test.run.txt > tests/$test.diff.txt; then
     55#               ret_val=1
     56#               echo -e "\tFAILED with output mismatch:" | tee -a $logfile
     57#               cat tests/$test.diff.txt | tee -a $logfile
     58#               continue
     59#       fi
     60#       rm tests/$test.run.txt tests/$test.diff.txt ./$test
     61#
     62#       echo -e "\tPASSED" | tee -a $logfile
     63# done
     64#
     65# exit $((ret_val))
     66
    2867tests="vector_test avl_test"
    2968
    30 # log file for test output;
    31 # reset at the beginning of each run
    32 logfile=tests/log.txt
    33 touch $logfile && rm $logfile
    34 
    35 # clean existing build artifacts before run
    36 make clean > /dev/null 2>&1
     69python test.py ${tests}
    3770
    3871ret_val=0
    39 
    40 for test in $tests; do
    41         echo -n "    $test" | tee -a $logfile
    42 
    43         # build, skipping to next test on error
    44         if ! make -j 8 $test > tests/$test.make.txt 2>&1; then
    45                 ret_val=1
    46                 echo -e "\tFAILED with build error:" | tee -a $logfile
    47                 cat tests/$test.make.txt | tee -a $logfile
    48                 continue
    49         fi
    50         rm tests/$test.make.txt
    51 
    52         # run, testing against expected output
    53         ./$test < tests/$test.in.txt > tests/$test.run.txt 2>&1
    54         if ! diff tests/$test.out.txt tests/$test.run.txt > tests/$test.diff.txt; then
    55                 ret_val=1
    56                 echo -e "\tFAILED with output mismatch:" | tee -a $logfile
    57                 cat tests/$test.diff.txt | tee -a $logfile
    58                 continue
    59         fi
    60         rm tests/$test.run.txt tests/$test.diff.txt ./$test
    61 
    62         echo -e "\tPASSED" | tee -a $logfile
    63 done
    64 
    6572exit $((ret_val))
  • src/tests/test.py

    refc15918 r1c31f68  
    133133                sys.exit(1)
    134134
    135         unkownTests = False
    136         for test in options.tests :
    137                 if not (test in tests) :
    138                         print("ERROR: unkown test %s" % test)
    139                         unkownTests = true
    140 
    141         if unkownTests :
    142                 sys.exit(1)
    143 
    144135        if options.generate_expected :
    145136                generate_expect( options.tests )
Note: See TracChangeset for help on using the changeset viewer.