Skip to content

Commit 83cac7e

Browse files
authored
Merge pull request #31 from TranslatorSRI/april_updates
Adding additional test_suite output
2 parents f23efa4 + 4e120e2 commit 83cac7e

1 file changed

Lines changed: 64 additions & 5 deletions

File tree

src/translator_testing_model/scripts/generate_suite_for_demo.py

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,49 @@ def create_test_cases_from_test_assets(test_assets, test_case_model):
213213
def create_test_suite_from_test_cases(test_cases, test_suite_model):
214214
test_suite_id = "TestSuite_1"
215215
test_cases_dict = {test_case.id: test_case for test_case in test_cases}
216+
217+
ci_test_case_collection = []
218+
stress_test_case_collection = []
219+
220+
for i in range(len(test_cases)):
221+
if i % 10 == 9: # If the index is a multiple of 10 (accounting for 0-indexing)
222+
ci_test_case_collection.append(test_cases[i])
223+
if i % 2 == 1: # If the index is a multiple of 5 (accounting for 0-indexing)
224+
stress_test_case_collection.append(test_cases[i])
225+
test_cases_dict_ci = {test_case.id: test_case for test_case in ci_test_case_collection}
226+
test_cases_dict_stress = {test_case.id: test_case for test_case in stress_test_case_collection}
227+
print(len(stress_test_case_collection), "number_stress")
228+
print(len(test_cases_dict_ci), "number_ci")
229+
print(len(test_cases_dict), "number_total")
230+
231+
# CI and DELTA have the same
232+
# number: https://docs.google.com/document/d/1UNX7Z4Wjwg0FPA58VBNMYducNCq44LykzQ6_JU7FEEo/edit
233+
print(len(test_cases_dict_ci), "number_delta")
234+
216235
tmd = TestMetadata(id=1,
217236
test_source="SMURF",
218237
test_objective="AcceptanceTest")
219-
return test_suite_model(id=test_suite_id, test_cases=test_cases_dict, test_metadata=tmd)
238+
239+
test_suite_ci_id = "TestSuite_2"
240+
ci_tmd = TestMetadata(id=2,
241+
test_source="SMURF",
242+
test_objective="AcceptanceTest")
243+
244+
245+
test_suite_stress_id = "TestSuite_3"
246+
stress_tmd = TestMetadata(id=3,
247+
test_source="SMURF",
248+
test_objective="AcceptanceTest")
249+
250+
test_suite_delta_id = "TestSuite_4"
251+
delta_tmd = TestMetadata(id=4,
252+
test_source="SMURF",
253+
test_objective="AcceptanceTest")
254+
255+
return (test_suite_model(id=test_suite_id, test_cases=test_cases_dict, test_metadata=tmd),
256+
test_suite_model(id=test_suite_ci_id, test_cases=test_cases_dict_ci, test_metadata=ci_tmd),
257+
test_suite_model(id=test_suite_stress_id, test_cases=test_cases_dict_stress, test_metadata=stress_tmd),
258+
test_suite_model(id=test_suite_delta_id, test_cases=test_cases_dict_ci, test_metadata=delta_tmd))
220259

221260

222261
def create_benchmark_test_case(subset: bool) -> TestCase or list[TestCase]:
@@ -299,12 +338,32 @@ def dump_to_json(file_prefix):
299338
test_cases.append(benchmark_case)
300339

301340
# Assemble into a TestSuite
302-
test_suite = create_test_suite_from_test_cases(test_cases, TestSuite)
341+
(test_suite_all, test_suite_CI, test_suite_STRESS, test_suite_DELTA) = create_test_suite_from_test_cases(test_cases, TestSuite)
303342
#
343+
304344
# Convert to JSON and save to file
305-
test_suite_json = test_suite.json(indent=4)
345+
test_suite_json_all = test_suite_all.json(indent=4)
346+
test_suite_json_CI = test_suite_CI.json(indent=4)
347+
test_suite_json_STRESS = test_suite_STRESS.json(indent=4)
348+
test_suite_json_DELTA = test_suite_DELTA.json(indent=4)
349+
306350

307-
suite_json_output_path = 'pass_fail_test_suite_output.json'
351+
suite_json_output_path = 'semantic_smoke_test_suite_TEST.json'
308352

309353
with open(suite_json_output_path, 'w') as file:
310-
file.write(test_suite_json)
354+
file.write(test_suite_json_all)
355+
356+
sst_ci_json_output_path = 'semantic_smoke_test_suite_CI.json'
357+
358+
with open(sst_ci_json_output_path, 'w') as file:
359+
file.write(test_suite_json_CI)
360+
361+
suite_delta_json_output_path_prod = 'stress_test_PROD.json'
362+
363+
with open(suite_delta_json_output_path_prod, 'w') as file:
364+
file.write(test_suite_json_STRESS)
365+
366+
suite_delta_json_output_path_prod = 'semantic_delta_and_time_profiling_PROD.json'
367+
368+
with open(suite_delta_json_output_path_prod, 'w') as file:
369+
file.write(test_suite_json_DELTA)

0 commit comments

Comments
 (0)