Changeset 7030dab for tests/pybin
- Timestamp:
- Apr 6, 2020, 4:46:28 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- e3bc51c
- Parents:
- 71d6bd8 (diff), 057298e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- tests/pybin
- Files:
-
- 2 edited
-
settings.py (modified) (4 diffs)
-
tools.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/settings.py
r71d6bd8 r7030dab 77 77 print("updated to %s" % self.target) 78 78 79 def match(self, arch): 79 def filter(self, tests): 80 return [test for test in tests if not test.arch or self.target == test.arch] 80 81 return True if not arch else self.target == arch 81 82 … … 113 114 114 115 def init( options ): 116 global all_arch 117 global all_debug 118 global all_install 115 119 global arch 116 120 global archive 121 global continue_ 117 122 global debug 118 global distcc119 123 global dry_run 120 124 global generating … … 123 127 global output_width 124 128 global timeout 129 global timeout2gdb 125 130 126 arch = Architecture(options.arch) 131 all_arch = [Architecture(o) for o in list(dict.fromkeys(options.arch ))] 132 all_debug = [Debug(o) for o in list(dict.fromkeys(options.debug ))] 133 all_install = [Install(o) for o in list(dict.fromkeys(options.install))] 127 134 archive = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None 128 debug = Debug(options.debug)135 continue_ = options.continue_ 129 136 dry_run = options.dry_run # must be called before tools.config_hash() 130 distcc = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()131 137 generating = options.regenerate_expected 132 install = Install(options.install)133 138 make = ['make'] 134 139 output_width = 24 135 140 timeout = Timeouts(options.timeout, options.global_timeout) 141 timeout2gdb = options.timeout_with_gdb 136 142 137 143 # if we distribute, distcc errors will fail tests, use log file for distcc … … 146 152 147 153 def validate(): 154 """Validate the current configuration and update globals""" 155 156 global distcc 157 distcc = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash() 148 158 errf = os.path.join(BUILDDIR, ".validate.err") 149 159 make_ret, out = tools.make( ".validate", error_file = errf, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL ) -
tests/pybin/tools.py
r71d6bd8 r7030dab 75 75 return proc.returncode, out.decode("utf-8") if out else None 76 76 except subprocess.TimeoutExpired: 77 proc.send_signal(signal.SIGABRT) 78 proc.communicate() 79 return 124, str(None) 77 if settings.timeout2gdb: 78 print("Process {} timeout".format(proc.pid)) 79 proc.communicate() 80 return 124, str(None) 81 else: 82 proc.send_signal(signal.SIGABRT) 83 proc.communicate() 84 return 124, str(None) 80 85 81 86 except Exception as ex: … … 175 180 176 181 def which(program): 177 fpath, fname = os.path.split(program) 178 if fpath: 179 if is_exe(program): 180 return program 181 else: 182 for path in os.environ["PATH"].split(os.pathsep): 183 exe_file = os.path.join(path, program) 184 if is_exe(exe_file): 185 return exe_file 186 187 return None 182 fpath, fname = os.path.split(program) 183 if fpath: 184 if is_exe(program): 185 return program 186 else: 187 for path in os.environ["PATH"].split(os.pathsep): 188 exe_file = os.path.join(path, program) 189 if is_exe(exe_file): 190 return exe_file 191 return None 188 192 189 193 @contextlib.contextmanager … … 323 327 raise argparse.ArgumentTypeError(msg) 324 328 329 # Convert a function that converts a string to one that converts comma separated string. 330 def comma_separated(elements): 331 return lambda string: [elements(part) for part in string.split(',')] 332 325 333 def fancy_print(text): 326 334 column = which('column') … … 365 373 366 374 class Timed: 367 def __enter__(self):368 self.start = time.time()369 return self370 371 def __exit__(self, *args):372 self.end = time.time()373 self.duration = self.end - self.start375 def __enter__(self): 376 self.start = time.time() 377 return self 378 379 def __exit__(self, *args): 380 self.end = time.time() 381 self.duration = self.end - self.start 374 382 375 383 def timed(src, timeout): 376 384 expire = time.time() + timeout 377 385 i = iter(src) 378 while True: 379 yield i.next(max(expire - time.time(), 0)) 386 with contextlib.suppress(StopIteration): 387 while True: 388 yield i.next(max(expire - time.time(), 0))
Note:
See TracChangeset
for help on using the changeset viewer.