Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: fix perf tests to support generic compat pmu #2913

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

disgoel
Copy link
Contributor

@disgoel disgoel commented Nov 4, 2024

perf_c2c, perf_mem tests give error incase perf mem command fails when events are not available. Fix it by adding ignore_status check so test cancels.

Before fix:
ERROR: Command 'perf mem record -e list' failed.\nstdout: b''\nstderr: b'failed: memory events not supported\n'\nadditional_info: None
After fix:
CANCEL: perf c2c is not available
CANCEL: perf mem is not available

Added event raw codes for generic compat pmu for perf_genericevents test.

Before fix:
FAIL: Failed to verify generic PMU event codes
After fix:
JOB ID     : a2cf174c0134ef38b143831c6bdddbfd85946ee2
JOB LOG    : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-04T21.23-a2cf174/job.log
 (1/1) perf_genericevents.py:test_generic_events.test: STARTED
 (1/1) perf_genericevents.py:test_generic_events.test: PASS (0.05 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-04T21.23-a2cf174/results.html
JOB TIME   : 6.65 s

perf_json test results in false positive when pmu events are not present in case of generic compat pmu. Modify the code to cancel when events are not present. Also moved kernel building part after perf list check to avoid kernel build when not required.

Before fix:
JOB ID     : 0e1be5a1d5184c1504c80e99ff091a3cf97ae054
JOB LOG    : /home/OpTest/avocado-fvt-wrapper/results/job-2024-10-11T21.53-0e1be5a/job.log
 (1/2) /home/OpTest/avocado-fvt-wrapper/tests/avocado-misc-tests/perf/perf_json.py:perf_json.test_pmu_events: STARTED
 (1/2) /home/OpTest/avocado-fvt-wrapper/tests/avocado-misc-tests/perf/perf_json.py:perf_json.test_pmu_events:  PASS (913.64 s)
 (2/2) /home/OpTest/avocado-fvt-wrapper/tests/avocado-misc-tests/perf/perf_json.py:perf_json.test_compare: STARTED
 (2/2) /home/OpTest/avocado-fvt-wrapper/tests/avocado-misc-tests/perf/perf_json.py:perf_json.test_compare:  FAIL: mismatch in event list between perf list and json files (916.98 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /home/OpTest/avocado-fvt-wrapper/results/job-2024-10-11T21.53-0e1be5a/results.html
JOB TIME   : 1886.96 s
After fix:
JOB ID     : 80f213407807e482d07b04d99317beadfa7b2c1b
JOB LOG    : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-05T00.50-80f2134/job.log
 (1/2) perf_json.py:perf_json.test_pmu_events: STARTED
 (1/2) perf_json.py:perf_json.test_pmu_events: CANCEL: No PMU events found. Skipping the test. (0.05 s)
 (2/2) perf_json.py:perf_json.test_compare: STARTED
 (2/2) perf_json.py:perf_json.test_compare: CANCEL: No PMU events found. Skipping the test. (0.04 s)
RESULTS    : PASS 0 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 2
JOB HTML   : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-05T00.50-80f2134/results.html
JOB TIME   : 63.69 s

Modified perf_pmu:test_cpu_event_count by removing hardcoded number, instead just check for presence of events.

Before fix:
FAIL: cpu events folder contains less than 21 entries (0.04 s)
After fix:
 (03/10) perf_pmu.py:PerfBasic.test_cpu_event_count: STARTED
 (03/10) perf_pmu.py:PerfBasic.test_cpu_event_count: PASS (0.22 s)

perf_pmu:test_caps_feat fails on older distros where caps file is not present. Modified the code to check for caps file presence instead of checking for P10/P11.

Before fix:
ERROR: Command 'cat /sys/bus/event_source/devices/cpu/caps/pmu_name' failed
After fix:
CANCEL: Caps file not found, skipping test

Add a check to find pmu events presence before running perf_rawevents test.

Before fix:
FAIL: perf_raw_events: refer log file for failed events
After fix:
JOB ID     : d9169c7dfde5aae4c756a372839687a071a97031
JOB LOG    : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-04T19.28-d9169c7/job.log
 (1/2) perf_rawevents.py:PerfRawevents.test_raw_code: STARTED
 (1/2) perf_rawevents.py:PerfRawevents.test_raw_code: CANCEL: No PMU events found. Skipping the test. (1.42 s)
 (2/2) perf_rawevents.py:PerfRawevents.test_name_event: STARTED
 (2/2) perf_rawevents.py:PerfRawevents.test_name_event: CANCEL: No PMU events found. Skipping the test. (1.42 s)
RESULTS    : PASS 0 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 2
JOB HTML   : /home/OpTest/avocado-fvt-wrapper/results/job-2024-11-04T19.28-d9169c7/results.html
JOB TIME   : 10.05 s

perf_c2c, perf_mem tests give error incase perf mem command
fails when events are not available. Fix it by adding ignore_status
check so test cancels.

Similarly perf_json test gives error when pmu events are not present
when generic compat pmu is registered. Modify the code to cancel
when events are not present. Also moved kernel building part after
perf list check to avoid kernel build when not required.

Added event raw codes for generic compat pmu for perf_genericevents test.

Modified perf_pmu:test_cpu_event_count by removing hardcoded number,
instead just check for presence of events.

perf_pmu:test_caps_feat fails on older distros where file is not present.
Modified the code to check for caps file presence instead of checking
for P10/P11.

Add a check to find pmu events presence before running perf_rawevents test.

Signed-off-by: Disha Goel <[email protected]>
@PraveenPenguin PraveenPenguin merged commit ebe0678 into avocado-framework-tests:master Nov 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants