Skip to content

Commit 8736b31

Browse files
authored
Optimize tests-syncer crashtest query (#4267)
This limits the crashtest list already when executing the query instead of fetching all and pruning later. This also sorts the tests newest first, so that we rather archive newer tests if the cap is reached. Context: http://b/365801496
1 parent 044ec08 commit 8736b31

File tree

1 file changed

+14
-18
lines changed
  • src/python/other-bots/chromium-tests-syncer

1 file changed

+14
-18
lines changed

Diff for: src/python/other-bots/chromium-tests-syncer/run.py

+14-18
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@
4848
def unpack_crash_testcases(crash_testcases_directory):
4949
"""Unpacks the old crash testcases in the provided directory."""
5050
count = 0
51-
for testcase in ndb_utils.get_all_from_model(data_types.Testcase):
51+
# Make sure that it is a unique crash testcase. Ignore duplicates,
52+
# uploaded repros. Check if the testcase is fixed. If not, skip.
53+
# Only use testcases that have bugs associated with them.
54+
# Sort latest first.
55+
testcases = data_types.Testcase.query(
56+
data_types.Testcase.status == 'Processed',
57+
ndb_utils.is_false(data_types.Testcase.open),
58+
data_types.Testcase.bug_information !=
59+
'').order(-data_types.Testcase.timestamp)
60+
for testcase in testcases:
5261
count += 1
5362
if count >= MAX_TESTCASES:
5463
logs.info(f'{MAX_TESTCASES} testcases reached.')
@@ -62,33 +71,20 @@ def unpack_crash_testcases(crash_testcases_directory):
6271
if testcase_id in STORED_TESTCASES_LIST:
6372
continue
6473

65-
# 2. Make sure that it is a unique crash testcase. Ignore duplicates,
66-
# uploaded repros.
67-
if testcase.status != 'Processed':
68-
continue
69-
70-
# 3. Check if the testcase is fixed. If not, skip.
71-
if testcase.open:
72-
continue
73-
74-
# 4. Check if the testcase has a minimized repro. If not, skip.
74+
# 2. Check if the testcase has a minimized repro. If not, skip.
7575
if not testcase.minimized_keys or testcase.minimized_keys == 'NA':
7676
continue
7777

78-
# 5. Only use testcases that have bugs associated with them.
79-
if not testcase.bug_information:
80-
continue
81-
82-
# 6. Existing IPC testcases are un-interesting and unused in further
78+
# 3. Existing IPC testcases are un-interesting and unused in further
8379
# mutations. Due to size bloat, ignoring these for now.
8480
if testcase.absolute_path.endswith(testcase_manager.IPCDUMP_EXTENSION):
8581
continue
8682

87-
# 7. Ignore testcases that are archives (e.g. Langfuzz fuzzer tests).
83+
# 4. Ignore testcases that are archives (e.g. Langfuzz fuzzer tests).
8884
if archive.get_archive_type(testcase.absolute_path):
8985
continue
9086

91-
# 8. Skip in-process fuzzer testcases, since these are only applicable to
87+
# 5. Skip in-process fuzzer testcases, since these are only applicable to
9288
# fuzz targets and don't run with blackbox binaries.
9389
if testcase.fuzzer_name and testcase.fuzzer_name in ENGINE_FUZZER_NAMES:
9490
continue

0 commit comments

Comments
 (0)