Skip to content

Commit a72b6cd

Browse files
committed
Add ability to use fragile list in JSON format
Added ability to use fragile list in JSON format from 'suite.ini' files. For now it is possible to set fragile tests in both formats: 1) list of results files checksums in current text format: fragile = <basename of the test> ; gh-<issue> md5sum:<checksum> 2) list of results files checksums in newly used JSON format: fragile = { "retries": 10, "tests": { "bitset.test.lua": { "issues": [ "gh-4095" ], "checksums": [ "050af3a99561a724013995668a4bc71c", "f34be60193cfe9221d3fe50df657e9d3" ] } }}
1 parent 55a8fca commit a72b6cd

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

lib/test_suite.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def __init__(self, suite_path, args):
9494
self.ini = {}
9595
self.suite_path = suite_path
9696
self.ini["core"] = "tarantool"
97+
self.ini["fragile_is_json"] = False
9798

9899
if not os.access(suite_path, os.F_OK):
99100
raise RuntimeError("Suite %s doesn't exist" % repr(suite_path))
@@ -121,6 +122,13 @@ def __init__(self, suite_path, args):
121122
lambda x: os.path.join(suite_path, x),
122123
dict.fromkeys(self.ini[i].split())
123124
if i in self.ini else dict())
125+
for item in config.items("default"):
126+
if item[0] == "fragile":
127+
try:
128+
self.ini['fragile'] = json.loads(item[1])
129+
self.ini['fragile_is_json'] = True
130+
except ValueError:
131+
pass
124132

125133
self.parse_bool_opt('pretest_clean', False)
126134
self.parse_bool_opt('use_unix_sockets', False)
@@ -167,29 +175,43 @@ def collect_tests(self):
167175
self.tests_are_collected = True
168176
return self.tests
169177

178+
def get_fragile_list(self):
179+
if self.ini['fragile_is_json']:
180+
return self.ini['fragile']['tests']
181+
else:
182+
return self.ini['fragile']
183+
170184
def stable_tests(self):
171185
self.collect_tests()
172186
res = []
173187
for test in self.tests:
174-
if os.path.basename(test.name) not in self.ini['fragile']:
188+
if os.path.basename(test.name) not in self.get_fragile_list():
175189
res.append(test)
176190
return res
177191

178192
def fragile_tests(self):
179193
self.collect_tests()
180194
res = []
181195
for test in self.tests:
182-
if os.path.basename(test.name) in self.ini['fragile']:
196+
if os.path.basename(test.name) in self.get_fragile_list():
183197
res.append(test)
184198
return res
185199

186-
def fragile_checksums(self):
187-
res = []
188-
for fragile in self.ini['fragile']:
189-
checksum = re.split(r'md5sum:', fragile)
190-
if not checksum[0]:
191-
res.append(checksum[1])
192-
return res
200+
def get_fragile_checksums(self):
201+
checksums = []
202+
if self.ini['fragile_is_json']:
203+
for test in self.get_fragile_list():
204+
try:
205+
for checksum in self.ini['fragile']['tests'][test]['checksums']:
206+
checksums.append(checksum)
207+
except Exception:
208+
pass
209+
else:
210+
for fragile in self.ini['fragile']:
211+
checksum = re.split(r'md5sum:', fragile)
212+
if not checksum[0]:
213+
checksums.append(checksum[1])
214+
return checksums
193215

194216
def gen_server(self):
195217
try:
@@ -272,6 +294,12 @@ def is_parallel(self):
272294
return self.ini['is_parallel']
273295

274296
def fragile_retries(self):
297+
if self.ini['fragile_is_json']:
298+
try:
299+
return self.ini['fragile']['retries']
300+
except Exception:
301+
pass
302+
275303
return self.ini['fragile_retries']
276304

277305
def show_reproduce_content(self):

lib/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def run_task(self, task_id):
317317
return short_status
318318

319319
def run_loop(self, task_queue, result_queue, is_fragile):
320-
fragile_checksums = self.suite.fragile_checksums()
320+
fragile_checksums = self.suite.get_fragile_checksums()
321321
""" called from 'run_all' """
322322
while True:
323323
task_id = self.task_get(task_queue)

0 commit comments

Comments
 (0)