Changes in tests/pybin/tools.py [0c13238:202ad72]
- File:
-
- 1 edited
-
tests/pybin/tools.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
r0c13238 r202ad72 3 3 import __main__ 4 4 import argparse 5 import fileinput6 5 import multiprocessing 7 6 import os 8 7 import re 9 import resource10 8 import signal 11 9 import stat 12 10 import sys 13 import time11 import fileinput 14 12 15 13 from pybin import settings … … 81 79 def diff( lhs, rhs ): 82 80 # diff the output of the files 83 diff_cmd = ("diff --text " 84 # "--ignore-all-space " 85 # "--ignore-blank-lines " 81 diff_cmd = ("diff --ignore-all-space --text " 82 "--ignore-blank-lines " 86 83 "--old-group-format='\t\tmissing lines :\n" 87 84 "%%<' \\\n" … … 133 130 134 131 return None 135 136 def run(exe, output, input):137 ret, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe, output), input = input)138 return ret139 140 132 ################################################################################ 141 133 # file handling 142 134 ################################################################################ 143 # move a file144 def mv(source, dest):145 ret, _ = sh("mv %s %s" % (source, dest))146 return ret147 148 # cat one file into the other149 def cat(source, dest):150 ret, _ = sh("cat %s > %s" % (source, dest))151 return ret152 135 153 136 # helper function to replace patterns in a file … … 246 229 signal.signal(signal.SIGINT, signal.SIG_IGN) 247 230 248 249 # enable core dumps for all the test children250 resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))251 252 231 ################################################################################ 253 232 # misc … … 267 246 if column: 268 247 cmd = "%s 2> /dev/null" % column 248 print(cmd) 269 249 proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True) 270 proc.communicate(input=text + "\n")250 proc.communicate(input=text) 271 251 else: 272 252 print(text) 273 274 275 def coreInfo(path):276 cmd = os.path.join(settings.SRCDIR, "pybin/print-core.gdb")277 if not os.path.isfile(cmd):278 return 1, "ERR Printing format for core dumps not found"279 280 dname = os.path.dirname(path)281 core = os.path.join(dname, "core" )282 if not os.path.isfile(path):283 return 1, "ERR Executable path is wrong"284 285 if not os.path.isfile(core):286 return 1, "ERR No core dump"287 288 return sh("gdb -n %s %s -batch -x %s" % (path, core, cmd), print2stdout=False)289 290 class Timed:291 def __enter__(self):292 self.start = time.time()293 return self294 295 def __exit__(self, *args):296 self.end = time.time()297 self.duration = self.end - self.start
Note:
See TracChangeset
for help on using the changeset viewer.