Skip to content

Conversation

@jeevanandan-sandan
Copy link

No description provided.

@jeevanandan-sandan jeevanandan-sandan force-pushed the feature/storage_test_automation branch from c1f2b5b to 68e6860 Compare November 28, 2025 11:27
@vnarapar
Copy link
Contributor

vnarapar commented Dec 1, 2025

Please add commit messages

@vnarapar vnarapar requested review from smuppand and vnarapar and removed request for vnarapar December 1, 2025 09:29
@vnarapar
Copy link
Contributor

vnarapar commented Dec 2, 2025

Ensure the script has execute permissions

@jeevanandan-sandan jeevanandan-sandan force-pushed the feature/storage_test_automation branch from 76dc353 to ce6cfca Compare December 2, 2025 09:54
@vnarapar
Copy link
Contributor

vnarapar commented Dec 2, 2025

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
Copy link
Contributor

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?

Copy link
Contributor

@smuppand smuppand left a 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
Copy link
Contributor

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.

Copy link
Author

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"
Copy link
Contributor

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.

Copy link
Author

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
Copy link
Contributor

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)

Copy link
Author

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
Copy link
Contributor

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"
Copy link
Contributor

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.

Copy link
Author

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"
Copy link
Contributor

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

Copy link
Author

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"
Copy link
Contributor

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"
Copy link
Contributor

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

Copy link
Author

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"
Copy link
Contributor

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() {
Copy link
Contributor

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

@jeevanandan-sandan jeevanandan-sandan force-pushed the feature/storage_test_automation branch from ce6cfca to 4650502 Compare January 2, 2026 12:32
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
Copy link
Contributor

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

Copy link
Author

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.

@jeevanandan-sandan jeevanandan-sandan force-pushed the feature/storage_test_automation branch from 4650502 to a499f84 Compare January 5, 2026 06:35
- 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>
@jeevanandan-sandan jeevanandan-sandan force-pushed the feature/storage_test_automation branch from a499f84 to c0e80ff Compare January 5, 2026 11:06
Copy link
Contributor

@smuppand smuppand left a 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'"
Copy link
Contributor

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"
Copy link
Contributor

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..."
Copy link
Contributor

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'"
Copy link
Contributor

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'"
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

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
Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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".

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.

3 participants