Skip to content

Commit 4972ab4

Browse files
committed
add test
1 parent 13baaec commit 4972ab4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/scripts/extract_benchmark_results.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ def generateGitJobLevelFailureRecord(git_job_name: str, app: str) -> Any:
559559
"""
560560
level = "GIT_JOB"
561561
app_type = getAppType(app)
562-
device_os = getDeviceOsType(app)
562+
device_prefix = getDeviceOsType(app)
563+
563564
model_infos = get_model_info(git_job_name)
564565
model_name = "UNKNOWN"
565566
model_backend = "UNKNOWN"
@@ -575,7 +576,7 @@ def generateGitJobLevelFailureRecord(git_job_name: str, app: str) -> Any:
575576
model_name,
576577
model_backend,
577578
device_pool_name,
578-
device_os,
579+
device_prefix,
579580
"FAILURE",
580581
)
581582

@@ -591,8 +592,12 @@ def generateDeviceLevelFailureRecord(
591592
model_name = "UNKNOWN"
592593
model_backend = "UNKNOWN"
593594
osPrefix = getDeviceOsType(app)
594-
version = job_report["os"]
595-
device_os = f"{osPrefix} {version}"
595+
job_report_os = job_report["os"]
596+
597+
device_os = job_report_os
598+
if not job_report_os.startswith(osPrefix):
599+
device_os = f"{osPrefix} {job_report_os}"
600+
596601
if model_infos:
597602
model_name = model_infos["model_name"]
598603
model_backend = model_infos["model_backend"]

.github/scripts/test_extract_benchmarl_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,13 @@ def test_processBenchmarkResults_when_IOS_git_job_fails_then_returnBenchmarkReco
266266
},
267267
},
268268
)
269-
270269
self.assertEqual(result[0]["runners"][0]["name"], "apple_iphone_15")
271270
self.assertEqual(result[0]["runners"][0]["type"], "iOS")
272271
self.assertEqual(result[0]["metric"]["name"], "FAILURE_REPORT")
273272

274273
@mock.patch("extract_benchmark_results.extract_ios_benchmark_results")
275274
@mock.patch("extract_benchmark_results.read_benchmark_config")
276-
def test_processBenchmarkResults_when_one_mobile_job_fails_then_returnBenchmarkRecordWithFailure(
275+
def test_processBenchmarkResults_when_one_IOS_mobile_job_fails_then_returnBenchmarkRecordWithFailure(
277276
self, read_benchmark_config_mock, extract_ios_mock
278277
):
279278
# setup mocks
@@ -301,6 +300,7 @@ def test_processBenchmarkResults_when_one_mobile_job_fails_then_returnBenchmarkR
301300
},
302301
)
303302
self.assertEqual(result[0]["metric"]["name"], "FAILURE_REPORT")
303+
304304
self.assertNotEqual(result[1]["metric"]["name"], "FAILURE_REPORT")
305305

306306

0 commit comments

Comments
 (0)