Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 795516b

Browse files
PrzemekWirkuseverton1984
authored andcommitted
[wperf-scripts] WPERF-952: skip whole CPython SPE record tests if SPE not supported
See merge request Linaro/WindowsPerf/windowsperf!683 === ChangeLog === * wperf-scripts: trailing whitespaces * wperf-scripts: fix W0612: Unused variable 'test_path' (unused-variable) * wperf-scripts: skip whole CPython SPE record teest if SPE not supported
1 parent 63b5d45 commit 795516b

File tree

1 file changed

+18
-72
lines changed

1 file changed

+18
-72
lines changed

wperf-scripts/tests/wperf_cli_cpython_dep_record_spe_test.py

Lines changed: 18 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@
4141
from common import get_spe_version, wperf_event_is_available
4242
from common_cpython import CPYTHON_EXE_DIR
4343

44+
#
45+
# Skip whole module if SPE is not supported in this configuration
46+
#
47+
48+
# Skip whole module if ustress is not supported by this CPU
49+
spe_device = get_spe_version()
50+
assert spe_device is not None
51+
if not spe_device.startswith("FEAT_SPE"):
52+
pytest.skip(f"unsupported configuration: no SPE support in HW, see spe_device.version_name={spe_device}",
53+
allow_module_level=True)
54+
55+
## Is SPE enabled in `wperf` CLI?
56+
if not wperf_event_is_available("arm_spe_0//"):
57+
pytest.skip(f"unsupported configuration: no SPE support in `wperf`, see spe_device.version_name={spe_device}",
58+
allow_module_level=True)
59+
4460
### Test cases
4561

4662
@pytest.mark.parametrize("SPE_FILTERS",
@@ -72,15 +88,6 @@ def test_cpython_bench_spe_cli_incorrect_filter(SPE_FILTERS):
7288
"incorrect SPE filter: '<SPE_FILTERS>' in <SPE_FILTERS>"
7389
7490
"""
75-
spe_device = get_spe_version()
76-
assert spe_device is not None
77-
if not spe_device.startswith("FEAT_SPE"):
78-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
79-
80-
## Is SPE enabled in `wperf` CLI?
81-
if not wperf_event_is_available("arm_spe_0//"):
82-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
83-
8491
#
8592
# Run for CPython payload but we should fail when we hit CLI parser errors
8693
#
@@ -105,15 +112,6 @@ def test_cpython_bench_spe_cli_incorrect_filter_name(SPE_FILTERS):
105112
106113
This error is for "empty" filter name.
107114
"""
108-
spe_device = get_spe_version()
109-
assert spe_device is not None
110-
if not spe_device.startswith("FEAT_SPE"):
111-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
112-
113-
## Is SPE enabled in `wperf` CLI?
114-
if not wperf_event_is_available("arm_spe_0//"):
115-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
116-
117115
#
118116
# Run for CPython payload but we should fail when we hit CLI parser errors
119117
#
@@ -150,15 +148,6 @@ def test_cpython_bench_spe_cli_incorrect_filter_value(SPE_FILTERS):
150148
151149
"incorrect SPE filter value: '<SPE_FILTERS>' in <SPE_FILTERS>"
152150
"""
153-
spe_device = get_spe_version()
154-
assert spe_device is not None
155-
if not spe_device.startswith("FEAT_SPE"):
156-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
157-
158-
## Is SPE enabled in `wperf` CLI?
159-
if not wperf_event_is_available("arm_spe_0//"):
160-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
161-
162151
#
163152
# Run for CPython payload but we should fail when we hit CLI parser errors
164153
#
@@ -177,17 +166,6 @@ def test_cpython_bench_spe_hotspot(EVENT,SPE_FILTERS,HOT_SYMBOL,HOT_MINIMUM,PYTH
177166
""" Test `wperf record` for python_d.exe call for example `Googolplex` calculation.
178167
We will sample with SPE for one event + filters and we expect one hottest symbol
179168
with some minimum sampling %."""
180-
181-
## Do we have FEAT_SPE
182-
spe_device = get_spe_version()
183-
assert spe_device is not None
184-
if not spe_device.startswith("FEAT_SPE"):
185-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
186-
187-
## Is SPE enabled in `wperf` CLI?
188-
if not wperf_event_is_available("arm_spe_0//"):
189-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
190-
191169
## Execute benchmark
192170
pyhton_d_exe_path = os.path.join(CPYTHON_EXE_DIR, "python_d.exe")
193171

@@ -253,16 +231,6 @@ def test_cpython_bench_spe_hotspot(EVENT,SPE_FILTERS,HOT_SYMBOL,HOT_MINIMUM,PYTH
253231
)
254232
def test_cpython_bench_spe_json_schema(request, tmp_path, EVENT,SPE_FILTERS,PYTHON_ARG):
255233
""" Test SPE JSON output against scheme """
256-
## Do we have FEAT_SPE
257-
spe_device = get_spe_version()
258-
assert spe_device is not None
259-
if not spe_device.startswith("FEAT_SPE"):
260-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
261-
262-
## Is SPE enabled in `wperf` CLI?
263-
if not wperf_event_is_available("arm_spe_0//"):
264-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
265-
266234
## Execute benchmark
267235
pyhton_d_exe_path = os.path.join(CPYTHON_EXE_DIR, "python_d.exe")
268236

@@ -292,16 +260,6 @@ def test_cpython_bench_spe_json_schema(request, tmp_path, EVENT,SPE_FILTERS,PYTH
292260
)
293261
def test_cpython_bench_spe_json_stdout_schema(request, tmp_path, EVENT,SPE_FILTERS,PYTHON_ARG):
294262
""" Test SPE JSON output against stdout scheme """
295-
## Do we have FEAT_SPE
296-
spe_device = get_spe_version()
297-
assert spe_device is not None
298-
if not spe_device.startswith("FEAT_SPE"):
299-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
300-
301-
## Is SPE enabled in `wperf` CLI?
302-
if not wperf_event_is_available("arm_spe_0//"):
303-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
304-
305263
## Execute benchmark
306264
pyhton_d_exe_path = os.path.join(CPYTHON_EXE_DIR, "python_d.exe")
307265

@@ -329,24 +287,12 @@ def test_cpython_bench_spe_json_stdout_schema(request, tmp_path, EVENT,SPE_FILTE
329287
)
330288
def test_cpython_bench_spe_consistency(request, tmp_path, EVENT,SPE_FILTERS,PYTHON_ARG):
331289
""" Test SPE JSON output against stdout scheme """
332-
## Do we have FEAT_SPE
333-
spe_device = get_spe_version()
334-
assert spe_device is not None
335-
if not spe_device.startswith("FEAT_SPE"):
336-
pytest.skip(f"no SPE support in HW, see spe_device.version_name={spe_device}")
337-
338-
## Is SPE enabled in `wperf` CLI?
339-
if not wperf_event_is_available("arm_spe_0//"):
340-
pytest.skip(f"no SPE support in `wperf`, see spe_device.version_name={spe_device}")
341-
342290
## Execute benchmark
343291
pyhton_d_exe_path = os.path.join(CPYTHON_EXE_DIR, "python_d.exe")
344292

345293
if not check_if_file_exists(pyhton_d_exe_path):
346294
pytest.skip(f"Can't locate CPython native executable in {pyhton_d_exe_path}")
347295

348-
test_path = os.path.dirname(request.path)
349-
350296
cmd = f"wperf record -e {EVENT}/{SPE_FILTERS}/ -c 2 --timeout 5 --json -- {pyhton_d_exe_path} -c {PYTHON_ARG}"
351297
stdout, _ = run_command(cmd.split())
352298

@@ -359,10 +305,10 @@ def test_cpython_bench_spe_consistency(request, tmp_path, EVENT,SPE_FILTERS,PYTH
359305
for sample in event["samples"]:
360306
event_hits = event_hits + sample["count"]
361307
total_hits = total_hits + event_hits
362-
308+
363309
total_hits_pmu = 0
364310
for events in json_output["counting"]["core"]["cores"][0]["Performance_counter"]:
365311
if events["event_name"] == "sample_filtrate":
366312
total_hits_pmu = events["counter_value"]
367313

368-
assert total_hits == total_hits_pmu
314+
assert total_hits == total_hits_pmu

0 commit comments

Comments
 (0)