48
48
def unpack_crash_testcases (crash_testcases_directory ):
49
49
"""Unpacks the old crash testcases in the provided directory."""
50
50
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 :
52
61
count += 1
53
62
if count >= MAX_TESTCASES :
54
63
logs .info (f'{ MAX_TESTCASES } testcases reached.' )
@@ -62,33 +71,20 @@ def unpack_crash_testcases(crash_testcases_directory):
62
71
if testcase_id in STORED_TESTCASES_LIST :
63
72
continue
64
73
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.
75
75
if not testcase .minimized_keys or testcase .minimized_keys == 'NA' :
76
76
continue
77
77
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
83
79
# mutations. Due to size bloat, ignoring these for now.
84
80
if testcase .absolute_path .endswith (testcase_manager .IPCDUMP_EXTENSION ):
85
81
continue
86
82
87
- # 7 . Ignore testcases that are archives (e.g. Langfuzz fuzzer tests).
83
+ # 4 . Ignore testcases that are archives (e.g. Langfuzz fuzzer tests).
88
84
if archive .get_archive_type (testcase .absolute_path ):
89
85
continue
90
86
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
92
88
# fuzz targets and don't run with blackbox binaries.
93
89
if testcase .fuzzer_name and testcase .fuzzer_name in ENGINE_FUZZER_NAMES :
94
90
continue
0 commit comments