-
Notifications
You must be signed in to change notification settings - Fork 26
Added UFS functional tests #220
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
base: main
Are you sure you want to change the base?
Added UFS functional tests #220
Conversation
c1f2b5b to
68e6860
Compare
|
Please add commit messages |
|
Ensure the script has execute permissions |
76dc353 to
ce6cfca
Compare
|
Squash to single commit |
| - $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/Baseport/smmu/smmu.res || true | ||
| - $PWD/suites/Kernel/Baseport/Storage/UFS_Validation/run.sh || true | ||
| - $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/Baseport/Storage/UFS_Validation/UFS_Validation.res || true | ||
| - $PWD/suites/Kernel/Baseport/Storage/ufs_gear_lane/run.sh || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these tests validated on qcom-next?
smuppand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments apply to the other tests as well. Please also take care of the https://github.com/qualcomm-linux/qcom-linux-testkit/actions/runs/19762511972/job/56772745461.
| - $PWD/suites/Kernel/Baseport/Storage/ufs_runtime_suspend_resume/run.sh || true | ||
| - $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/Baseport/Storage/ufs_runtime_suspend_resume/ufs_runtime_suspend_resume.res || true | ||
| - $PWD/suites/Kernel/Baseport/Storage/ufs_write_booster/run.sh || true | ||
| - $PWD/utils/send-to-lava.sh $PWD/suites/Kernel/Baseport/Storage/ufs_write_booster/ufs_write_booster.res || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest enabling these tests in qcom-next instead of meta-qcom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabled the tests on qcom-next by adding the .yaml files for each test case.
| # Only source if not already loaded | ||
| if [ -z "$__INIT_ENV_LOADED" ]; then | ||
| # shellcheck disable=SC1090 | ||
| . "$INIT_ENV" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you never set __INIT_ENV_LOADED, so this guard is effectively useless if this script is ever sourced again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exporting the __INIT_ENV_LOADED variable after setting it to 1 once the source is loaded.
| log_info "--------------------------------------------------" | ||
| log_info "------------- Starting $TESTNAME Test ------------" | ||
|
|
||
| check_dependencies dd grep cut head tail udevadm sleep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cut, head, tail, udevadm are not used anywhere in this script. You do use findmnt and awk, and rely on readlink (though that's almost always present)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed unused dependencies and checking only the required dependencies.
| OPTIONAL_CONFIGS="CONFIG_SCSI_UFSHCD_PLATFORM CONFIG_SCSI_UFSHCD_PCI CONFIG_SCSI_UFS_CDNS_PLATFORM CONFIG_SCSI_UFS_HISI CONFIG_SCSI_UFS_EXYNOS CONFIG_SCSI_UFS_ROCKCHIP CONFIG_SCSI_UFS_BSG" | ||
|
|
||
| log_info "Checking mandatory kernel configs for UFS..." | ||
| if ! check_kernel_config "$MANDATORY_CONFIGS" 2>/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"$MANDATORY_CONFIGS" is one arugment with a space inside, not two config names. That'll fail.
| [ -n "$missing_optional" ] && log_info "Optional configs not present but continuing:$missing_optional" | ||
|
|
||
| check_dt_nodes "/sys/bus/platform/devices/*ufs*" || { | ||
| echo "$TESTNAME SKIP" > "$res_file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include log_skip so it is visible to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added log_skip when UFS dt_nodes are missing.
| log_pass "UFS Gear and Lane validation passed" | ||
| log_info "Gear: $CURRENT_GEAR (Expected: HS_GEAR$EXPECTED_GEAR)" | ||
| log_info "Lane: $CURRENT_LANE (Expected: 2)" | ||
| scan_dmesg_errors "ufs" "$test_path" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Called twice on the PASS path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the PASS criteria and updating to .res file only once all the test steps are successful.
| exit 1 | ||
| fi | ||
|
|
||
| scan_dmesg_errors "ufs" "$test_path" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT
| log_info "Gear: $CURRENT_GEAR (Expected: HS_GEAR$EXPECTED_GEAR)" | ||
| log_info "Lane: $CURRENT_LANE (Expected: 2)" | ||
| scan_dmesg_errors "ufs" "$test_path" | ||
| echo "$TESTNAME PASS" > "$res_file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.res file is written PASS twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the PASS criteria and updating to .res file only once all the test steps are successful.
|
|
||
| scan_dmesg_errors "ufs" "$test_path" | ||
| log_pass "$TESTNAME completed successfully" | ||
| echo "$TESTNAME PASS" > "$res_file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT
| fi | ||
|
|
||
| # Function to get the first matching node path | ||
| get_dt_node_path() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use already available functions from functestlib.sh
ce6cfca to
4650502
Compare
| if [ "$UFS_CLOCK_SCALED" -ne 1 ] && [ "$UFS_CLOCK_GATED" -ne 1 ]; then | ||
| log_fail "UFS clock scaling & gating test failed" | ||
| echo "$TESTNAME FAIL" > "$res_file" | ||
| exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Lava: keep in mind that if one of them fails and exits with non-zero status, the whole job terminates. So update all scripts to exit 0 for PASS/ FAIL/ SKIP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed all the exit codes to zero irrespective of test result.
4650502 to
a499f84
Compare
- UFS Read/Writes - Verifies the UFS read/writes in the user partition - UFS Runtime Suspend/Resume - Ensure proper link_state transitions during load and no-load - UFS Clock Scaling/Gating - Ensures UFS clock is scaled and gated based on load and requirement - UFS Hibern8 - Validate active/hibern8 entry exit on-demand - UFS Write Booster - Check whether UFS Write Booster is enabled on write - UFS Gear Validation - Check gear switching on load - Fixed Review Comments Impact: These tests improve the functional coverage for UFS Signed-off-by: Jeevanandan Sandan <sandanka@qti.qualcomm.com>
a499f84 to
c0e80ff
Compare
smuppand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Centralize common UFS pre-checks
Every script repeats:
- mandatory/optional config checks
- DT node check
- detect_ufs_partition_block
This should be a reusable helper in functestlib.sh, e.g.:
ufs_common_precheck that returns SKIP reason and exports UFS_BLOCK_DEV / UFS_SYSFS_BASE.
Less duplication = fewer inconsistencies.
|
|
||
| attempt=1 | ||
|
|
||
| echo "Checking status of node '$node_name', expecting: '$expected_status'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use log_info/log_warn/log_fail from functestlib (or keep it silent and let caller log).
| attempt=1 | ||
|
|
||
| echo "Checking status of node '$node_name', expecting: '$expected_status'" | ||
| echo "Will retry up to $retries times with $delay second(s) delay between attempts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same here as well.
| echo "Will retry up to $retries times with $delay second(s) delay between attempts" | ||
|
|
||
| while [ "$attempt" -le "$retries" ]; do | ||
| echo "Attempt $attempt of $retries..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same here as well.
| status=$(cat "$node_name") | ||
|
|
||
| if [ "$status" = "$expected_status" ]; then | ||
| echo "Success! Node '$node_name' has status: '$status'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same here as well.
| echo "Success! Node '$node_name' has status: '$status'" | ||
| return 0 | ||
| else | ||
| echo "Current status: '$status', waiting for: '$expected_status'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same here as well.
| # wait for 60 seconds for UFS driver to go to idle state | ||
| log_info "Waiting for 60 seconds for UFS clock to gate" | ||
| sync | ||
| sleep 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait times: 60s/180s hardcoded, will be flaky across boards.
Provide env overrides:
LOAD_MB=${LOAD_MB:-128}
IDLE_WAIT_SEC=${IDLE_WAIT_SEC:-60}
| UFS_MAX_FREQ=$(cat "$UFS_MAX_FREQ_NODE" 2>/dev/null) | ||
| if [ -z "$UFS_MAX_FREQ" ]; then | ||
| log_skip "Failed to read max frequency from $UFS_MAX_FREQ_NODE" | ||
| echo "$TESTNAME FAIL" > "$res_file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing to read max_freq currently leads to FAIL (good), but elsewhere similar read failures are treated as SKIP. Rule of thumb:
“Feature/sysfs node not present” → SKIP
“Node present but unreadable / invalid value” → FAIL (because kernel/userspace is broken)
|
|
||
| # Check for UFS clock max freq node and assign to variable | ||
| log_info "Checking for UFS max clock freq node..." | ||
| if ! check_dt_nodes "/sys/devices/platform/soc@0/*ufs*/devfreq/*ufs*/max_freq"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is too broad. Might match unreleated nodes or multiple controllers. Detect actual UFS dir once and reuse.
e.g., locate .../ufshcd* / .../ufs base and store as UFS_SYSFS.
| fi | ||
|
|
||
| # Clean up temp file | ||
| rm -f "$tmpfile" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For every test using temp files:
tmpfile=$(mktemp "$test_path/${TESTNAME}.XXXXXX") (fallback if mktemp not available)
trap 'rm -f "$tmpfile"' EXIT INT TERM
This avoids stale files and collisions.
| if command -v stat >/dev/null 2>&1; then | ||
| stat --format="[INFO] Size: %s bytes File: %n" "$tmpfile" | ||
| else | ||
| find "$tmpfile" -printf "[INFO] Size: %s bytes File: %p\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find -printf is not POSIX and absent in busybox builds sometimes.
If stat isn’t available, just ls -l "$tmpfile" or wc -c < "$tmpfile".
No description provided.