Changes in / [bee653c:8a25be9]
- Files:
-
- 14 added
- 14 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
rbee653c r8a25be9 16738 16738 16739 16739 #============================================================================== 16740 ac_config_files="$ac_config_files Makefile driver/Makefile src/Makefile benchmark/Makefile tests/Makefile longrun_tests/Makefile tools/Makefile tools/prettyprinter/Makefile"16740 ac_config_files="$ac_config_files Makefile driver/Makefile src/Makefile benchmark/Makefile tests/Makefile tests/preempt_longrun/Makefile tools/Makefile tools/prettyprinter/Makefile" 16741 16741 16742 16742 … … 17876 17876 "benchmark/Makefile") CONFIG_FILES="$CONFIG_FILES benchmark/Makefile" ;; 17877 17877 "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; 17878 " longrun_tests/Makefile") CONFIG_FILES="$CONFIG_FILES longrun_tests/Makefile" ;;17878 "tests/preempt_longrun/Makefile") CONFIG_FILES="$CONFIG_FILES tests/preempt_longrun/Makefile" ;; 17879 17879 "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; 17880 17880 "tools/prettyprinter/Makefile") CONFIG_FILES="$CONFIG_FILES tools/prettyprinter/Makefile" ;; -
configure.ac
rbee653c r8a25be9 211 211 benchmark/Makefile 212 212 tests/Makefile 213 longrun_tests/Makefile213 tests/preempt_longrun/Makefile 214 214 tools/Makefile 215 215 tools/prettyprinter/Makefile -
tests/Makefile.am
rbee653c r8a25be9 36 36 -Wno-unused-function \ 37 37 -quiet @CFA_FLAGS@ \ 38 -DIN_DIR="${ abs_srcdir}/.in/"38 -DIN_DIR="${srcdir}/.in/" 39 39 40 40 AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS} -
tests/Makefile.in
rbee653c r8a25be9 382 382 # applies to both programs 383 383 AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \ 384 -quiet @CFA_FLAGS@ -DIN_DIR="${ abs_srcdir}/.in/"\385 ${ DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}384 -quiet @CFA_FLAGS@ -DIN_DIR="${srcdir}/.in/" ${DEBUG_FLAGS} \ 385 ${INSTALL_FLAGS} ${ARCH_FLAGS} 386 386 PRETTY_PATH = cd ${srcdir} && 387 387 avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa -
tests/pybin/tools.py
rbee653c r8a25be9 11 11 import subprocess 12 12 import sys 13 import tempfile14 13 import time 15 14 import types 16 15 17 16 from pybin import settings 17 from subprocess import Popen, PIPE, STDOUT 18 18 19 19 ################################################################################ … … 27 27 # if this is a dry_run, only print the commands that would be ran 28 28 if settings.dry_run : 29 cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd)) 30 if output and not isinstance(output, int): 31 cmd += " > " 32 cmd += output 33 34 if error and not isinstance(error, int): 35 cmd += " 2> " 36 cmd += error 37 38 if input and not isinstance(input, int) and os.path.isfile(input): 39 cmd += " < " 40 cmd += input 41 42 print(cmd) 29 print("cmd: %s" % ' '.join(cmd)) 43 30 return 0, None 44 31 45 32 with contextlib.ExitStack() as onexit: 46 33 # add input redirection if needed 47 input = openfd(input, 'r', onexit, True) 34 if input and input != subprocess.DEVNULL: 35 if os.path.isfile(input): 36 input = open(input) 37 onexit.push(input) 38 else: 39 input = None 48 40 49 41 # add output redirection if needed 50 output = openfd(output, 'w', onexit, False) 51 52 # add error redirection if needed 53 error = openfd(error, 'w', onexit, False) 42 if output and output != subprocess.DEVNULL and output != subprocess.PIPE: 43 output = open(output, 'w') 44 onexit.push(output) 54 45 55 46 # run the desired command … … 59 50 stdin =input, 60 51 stdout=output, 61 stderr= error,52 stderr=STDOUT, 62 53 timeout=settings.timeout.single if timeout else None 63 54 ) … … 87 78 def is_exe(fname): 88 79 return os.path.isfile(fname) and os.access(fname, os.X_OK) 89 90 def openfd(file, mode, exitstack, checkfile):91 if not file:92 return file93 94 if isinstance(file, int):95 return file96 97 if checkfile and not os.path.isfile(file):98 return None99 100 file = open(file, mode)101 exitstack.push(file)102 return file103 80 104 81 # Remove 1 or more files silently … … 169 146 return None 170 147 171 @contextlib.contextmanager172 def tempdir():173 cwd = os.getcwd()174 with tempfile.TemporaryDirectory() as temp:175 os.chdir(temp)176 try:177 yield temp178 finally:179 os.chdir(cwd)180 181 148 ################################################################################ 182 149 # file handling … … 279 246 280 247 def core_info(path): 281 if not os.path.isfile(path):282 return 1, "ERR Executable path is wrong"283 284 248 cmd = os.path.join(settings.SRCDIR, "pybin/print-core.gdb") 285 249 if not os.path.isfile(cmd): 286 250 return 1, "ERR Printing format for core dumps not found" 287 251 288 core = os.path.join(os.getcwd(), "core" ) 252 dname = os.path.dirname(path) 253 core = os.path.join(dname, "core" ) 254 if not os.path.isfile(path): 255 return 1, "ERR Executable path is wrong" 289 256 290 257 if not os.path.isfile(core): -
tests/test.py
rbee653c r8a25be9 8 8 import re 9 9 import sys 10 import tempfile11 10 import time 12 11 … … 144 143 make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file ) 145 144 145 # if the make command succeds continue otherwise skip to diff 146 146 run_dur = None 147 # run everything in a temp directory to make sure core file are handled properly 148 with tempdir(): 149 # if the make command succeds continue otherwise skip to diff 150 if success(make_ret): 151 with Timed() as run_dur: 152 if settings.dry_run or is_exe(exe_file): 153 # run test 154 retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True) 155 else : 156 # simply cat the result into the output 157 retcode = cat(exe_file, out_file) 158 else: 159 retcode = mv(err_file, out_file) 160 161 if success(retcode): 162 if settings.generating : 163 # if we are ounly generating the output we still need to check that the test actually exists 164 if no_rule(out_file, test.target()) : 165 retcode = 1 166 error = "\t\tNo make target for test %s!" % test.target() 167 rm(out_file) 168 else: 169 error = None 147 if success(make_ret): 148 with Timed() as run_dur: 149 if settings.dry_run or is_exe(exe_file): 150 # run test 151 retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True) 170 152 else : 171 # fetch return code and error from the diff command 172 retcode, error = diff(cmp_file, out_file) 173 174 else: 175 with open (out_file, "r") as myfile: 176 error = myfile.read() 177 178 ret, info = core_info(exe_file) 179 error = error + info if error else info 153 # simply cat the result into the output 154 retcode = cat(exe_file, out_file) 155 else: 156 retcode = mv(err_file, out_file) 157 158 if success(retcode): 159 if settings.generating : 160 # if we are ounly generating the output we still need to check that the test actually exists 161 if no_rule(out_file, test.target()) : 162 retcode = 1 163 error = "\t\tNo make target for test %s!" % test.target() 164 rm(out_file) 165 else: 166 error = None 167 else : 168 # fetch return code and error from the diff command 169 retcode, error = diff(cmp_file, out_file) 170 171 else: 172 with open (out_file, "r") as myfile: 173 error = myfile.read() 174 175 ret, info = core_info(exe_file) 176 error = error + info if error else info 180 177 181 178
Note: See TracChangeset
for help on using the changeset viewer.