Skip to content

Commit 327c19f

Browse files
committed
Update: Refine Qualcomm HWRNG test script and docs
Revised script and documentation following review suggestions. Signed-off-by: Naveenkumar Suresh <[email protected]>
1 parent 614fbcf commit 327c19f

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

Runner/suites/Kernel/FunctionalArea/baseport/qcom_hwrng/README_qcom_hwrng.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Ensure the following components are present in the target:
1717
- `rngtest` (Binary Available in /usr/bin) - this test app can be compiled from https://github.com/cernekee/rng-tools/
1818

1919
## Directory Structure
20-
20+
```
2121
Runner/
2222
├── suites/
2323
│ ├── Kernel/
2424
│ │ ├── FunctionalArea/
2525
│ │ │ ├── baseport/
2626
│ │ │ │ ├── qcom_hwrng/
2727
│ │ │ │ │ ├── run.sh
28-
28+
```
2929
## Usage
3030

3131
1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to the /var directory on the target device.
@@ -42,7 +42,7 @@ cd <this-repo>
4242
scp -r common Runner user@target_device_ip:/var
4343
ssh user@target_device_ip
4444
cd /var/Runner && ./run-test.sh qcom_hwrng
45-
```
45+
4646
Sample output:
4747
sh-5.2# ./run-test.sh qcom_hwrng
4848
[Executing test case: /var/Runner/suites/Kernel/FunctionalArea/baseport/qcom_hwrng] 2025-05-16 06:08:41 -
@@ -54,7 +54,7 @@ sh-5.2# ./run-test.sh qcom_hwrng
5454
cat: write error: Broken pipe
5555
[PASS] 2025-05-16 06:08:41 - qcom_hwrng : Test Passed
5656
[INFO] 2025-05-16 06:08:41 - -------------------Completed qcom_hwrng Testcase----------------------------
57-
57+
```
5858
4. Results will be available in the `/var/Runner/suites/Kernel/FunctionalArea/baseport/qcom_hwrng/` directory.
5959

6060
## Notes

Runner/suites/Kernel/FunctionalArea/baseport/qcom_hwrng/run.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1+
#!/bin/sh
12
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
23
# SPDX-License-Identifier: BSD-3-Clause-Clear
34

4-
#!/bin/sh
55
# Import test suite definitions
6-
. $(pwd)/init_env
6+
. "${PWD}"/init_env
77
TESTNAME="qcom_hwrng"
88

99
#import test functions library
10-
. $TOOLS/functestlib.sh
10+
. "${TOOLS}"/functestlib.sh
1111
test_path=$(find_test_case_by_name "$TESTNAME")
1212
log_info "-----------------------------------------------------------------------------------------"
1313
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
1414

1515
# Set the hardware RNG source to Qualcomm's RNG
16-
echo qcom_hwrng > /sys/class/misc/hw_random/rng_current
16+
if [ -e /sys/class/misc/hw_random/rng_current ]; then
17+
echo qcom_hwrng > /sys/class/misc/hw_random/rng_current
18+
else
19+
echo "Path /sys/class/misc/hw_random/rng_current does not exist."
20+
log_fail "$TESTNAME : Test Failed"
21+
exit 1
22+
fi
1723

1824
# Verify that qcom_hwrng was successfully set
1925
current_rng=$(cat /sys/class/misc/hw_random/rng_current)
2026
if [ "$current_rng" != "qcom_hwrng" ]; then
2127
log_info "Error: Failed to set qcom_hwrng as the current RNG source."
28+
log_fail "$TESTNAME : Test Failed"
2229
exit 1
2330
else
2431
log_info "qcom_hwrng successfully set as the current RNG source."
@@ -37,7 +44,7 @@ if [ "$value" -lt 10 ]; then
3744
log_pass "$TESTNAME : Test Passed"
3845
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
3946
else
40-
log_fail "$TESTNAME : Test Failed"
41-
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
47+
log_fail "$TESTNAME : Test Failed"
48+
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
4249
fi
4350
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)