Uh oh!
There was an error while loading. Please reload this page.
test: add compressed audio socwatch test - #1345
Conversation
8a46815 to
70150f4Comparec9edb0c to
f1455fbCompareb3ad6c8 to
a5626acCompare0bcbd9a to
7883e5cCompare028929a to
d2d4f57Compare| print(f"Incorrect value: {pc_state} time % was {value}, expected {expected_value}") | ||
| failures += 1 | ||
| return 0 if failures == 0 else 1 |
There was a problem hiding this comment.
It's cool but I think keeping it easier to read would be better.
| return0iffailures==0else1 | |
| iffailures==0: | |
| return0 | |
| return1 |
cc6155f to
6154da5Compare
marc-hb
left a comment
There was a problem hiding this comment.
Very clean and easy to read! Minor suggestions below
| with open(pc_states_file, encoding="utf-8") as file: | ||
| for line in file: | ||
| m = pattern.match(line) | ||
| if m: |
There was a problem hiding this comment.
"early return" pattern
| ifm: | |
| ifnotm: | |
| continue |
Same as you already did below but saves a lot more indentation (and mental load).
| print(f"Incorrect value: {pc_state} time % was {value}, expected {expected_value}") | ||
| failures += 1 | ||
| if failures: |
There was a problem hiding this comment.
| iffailures: | |
| returnfailures |
Then you may not want the main script to exit the number of failures too because some values may have special meaning - but for sure this function has nothing better to return than the number of failures.
There was a problem hiding this comment.
This func returns the result of the analysis - which is true or false.
| pattern = re.compile(r'^PC(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*$') | ||
| failures = 0 | ||
| with open(pc_states_file, encoding="utf-8") as file: |
There was a problem hiding this comment.
You could move the with open() to the caller and save even more indentation.
| def analyze_pc_states(pc_states_file, expected_results): | ||
| pattern = re.compile(r'^PC(\d+)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*$') |
There was a problem hiding this comment.
Regexps are notoriously cryptic. What really helps in such cases is to give a few input examples in a comment.
| check_cplay_command() | ||
| { | ||
| dlogi "${play_command[@]}" | ||
| if ! "${play_command[@]}"; then |
There was a problem hiding this comment.
Style nit:
| if!"${play_command[@]}";then | |
| "${play_command[@]}"|| | |
| die ... |
| expected_results="{\"PC10.2\":$pc10_threshold}" | ||
| # Analyze if the % of the time spent in given PC state was as expected | ||
| if python3 "$SCRIPT_HOME"/tools/analyze-pc-states.py "$pc_states_file" "$expected_results"; then |
There was a problem hiding this comment.
chmod a+x analyze-pc-states.py
I'm afraid sof-test is not going to work on Windows anytime soon!
| ifpython3 "$SCRIPT_HOME"/tools/analyze-pc-states.py "$pc_states_file""$expected_results";then | |
| if"$SCRIPT_HOME"/tools/analyze-pc-states.py "$pc_states_file""$expected_results";then |
405be8b to
d38b647CompareSigned-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
Add test that plays mp3 audio using cplay, and check PC states with Socwatch Signed-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
d38b647 to
2a9d625CompareUh oh!
There was an error while loading. Please reload this page.
Add test that plays MP3 sound and performs Socwatch analysis to check if dut enters and stays in PC10 state for the expected % of time (default expected value: 80% in PC10.2 state)
Note: this test will only pass when: