diff --git a/lib/test_suite.py b/lib/test_suite.py index 98ae4abf..700bfa18 100644 --- a/lib/test_suite.py +++ b/lib/test_suite.py @@ -94,6 +94,7 @@ def __init__(self, suite_path, args): self.ini = {} self.suite_path = suite_path self.ini["core"] = "tarantool" + self.ini["fragile_is_json"] = False if not os.access(suite_path, os.F_OK): raise RuntimeError("Suite %s doesn't exist" % repr(suite_path)) @@ -121,6 +122,14 @@ def __init__(self, suite_path, args): lambda x: os.path.join(suite_path, x), dict.fromkeys(self.ini[i].split()) if i in self.ini else dict()) + for item in config.items("default"): + if item[0] == "fragile": + try: + self.ini['fragile'] = json.loads(item[1]) + self.ini['fragile_is_json'] = True + except ValueError: + print "WARNING: suite '{}' uses old fragile format" . format(suite_path) + pass self.parse_bool_opt('pretest_clean', False) self.parse_bool_opt('use_unix_sockets', False) @@ -167,11 +176,17 @@ def collect_tests(self): self.tests_are_collected = True return self.tests + def get_fragile_list(self): + if self.ini['fragile_is_json']: + return self.ini['fragile']['tests'].keys() + else: + return self.ini['fragile'].keys() + def stable_tests(self): self.collect_tests() res = [] for test in self.tests: - if os.path.basename(test.name) not in self.ini['fragile']: + if os.path.basename(test.name) not in self.get_fragile_list(): res.append(test) return res @@ -179,17 +194,25 @@ def fragile_tests(self): self.collect_tests() res = [] for test in self.tests: - if os.path.basename(test.name) in self.ini['fragile']: + if os.path.basename(test.name) in self.get_fragile_list(): res.append(test) return res - def fragile_checksums(self): - res = [] - for fragile in self.ini['fragile']: - checksum = re.split(r'md5sum:', fragile) - if not checksum[0]: - res.append(checksum[1]) - return res + def get_fragile_checksums(self): + checksums = [] + if self.ini['fragile_is_json']: + for test in self.get_fragile_list(): + try: + for checksum in self.ini['fragile']['tests'][test]['checksums']: + checksums.append(checksum) + except Exception: + pass + else: + for fragile in self.ini['fragile']: + checksum = re.split(r'md5sum:', fragile) + if not checksum[0]: + checksums.append(checksum[1]) + return checksums def gen_server(self): try: @@ -272,6 +295,12 @@ def is_parallel(self): return self.ini['is_parallel'] def fragile_retries(self): + if self.ini['fragile_is_json']: + try: + return self.ini['fragile']['retries'] + except Exception: + pass + return self.ini['fragile_retries'] def show_reproduce_content(self): diff --git a/lib/worker.py b/lib/worker.py index 2401ac79..fb69b1e0 100644 --- a/lib/worker.py +++ b/lib/worker.py @@ -317,7 +317,7 @@ def run_task(self, task_id): return short_status def run_loop(self, task_queue, result_queue, is_fragile): - fragile_checksums = self.suite.fragile_checksums() + fragile_checksums = self.suite.get_fragile_checksums() """ called from 'run_all' """ while True: task_id = self.task_get(task_queue)