Skip to content

Commit e23317e

Browse files
committed
Public CI fast RPC Shell Scripts
Added shell script for fast RPC testcases Added Readme for fast RPC Testcases Signed-off-by: Abhishek Bajaj <[email protected]>
1 parent 2bb30ba commit e23317e

File tree

2 files changed

+70
-26
lines changed

2 files changed

+70
-26
lines changed

Runner/suites/Multimedia/CDSP/fastrpc_test/README_CDSP.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2-
# SPDX-License-Identifier: BSD-3-Clause-Clear
3-
41
# FastRPC Test Scripts for Qualcomm Linux based platform (Yocto)
52

63
## Overview
@@ -38,26 +35,29 @@ Runner/
3835

3936
## Usage
4037

41-
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.
4238

43-
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
39+
Instructions
40+
41+
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 any directory on the target device.
42+
43+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
4444

45-
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
45+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
4646

4747
Run a specific test using:
4848
---
4949
Quick Example
5050
```
5151
git clone <this-repo>
5252
cd <this-repo>
53-
scp -r common Runner user@target_device_ip:/var
53+
scp -r common Runner user@target_device_ip:<Path in device>
5454
ssh user@target_device_ip
55-
cd /var/Runner && ./run-test.sh
55+
cd <Path in device>/Runner && ./run-test.sh
5656
```
5757
Sample output:
5858
```
59-
sh-5.2# cd /var/Runner && ./run-test.sh fastrpc_test
60-
[Executing test case: /var/Runner/suites/Multimedia/CDSP/fastrpc_test] 1980-01-06 01:33:25 -
59+
sh-5.2# cd /<Path in device>/Runner && ./run-test.sh fastrpc_test
60+
[Executing test case: /<Path in device>/Runner/suites/Multimedia/CDSP/fastrpc_test] 1980-01-06 01:33:25 -
6161
[INFO] 1980-01-06 01:33:25 - -----------------------------------------------------------------------------------------
6262
[INFO] 1980-01-06 01:33:25 - -------------------Starting fastrpc_test Testcase----------------------------
6363
[INFO] 1980-01-06 01:33:25 - Checking if dependency binary is available
@@ -73,4 +73,9 @@ sh-5.2# cd /var/Runner && ./run-test.sh fastrpc_test
7373

7474
- The script does not take any arguments.
7575
- It validates the presence of required libraries before executing tests.
76-
- If any critical tool is missing, the script exits with an error message.
76+
- If any critical tool is missing, the script exits with an error message.
77+
78+
## License
79+
80+
SPDX-License-Identifier: BSD-3-Clause-Clear
81+
(C) Qualcomm Technologies, Inc. and/or its subsidiaries.

Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh

100644100755
Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,79 @@
1+
#!/bin/sh
2+
13
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
24
# SPDX-License-Identifier: BSD-3-Clause-Clear
35

4-
#!/bin/sh
5-
# Import test suite definitions
6-
. $(pwd)/init_env
7-
TESTNAME="fastrpc_test"
6+
# --------- Robustly source init_env and functestlib.sh ----------
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
while [ "$SEARCH" != "/" ]; do
11+
if [ -f "$SEARCH/init_env" ]; then
12+
INIT_ENV="$SEARCH/init_env"
13+
break
14+
fi
15+
SEARCH=$(dirname "$SEARCH")
16+
done
817

9-
#import test functions library
10-
. $TOOLS/functestlib.sh
18+
if [ -z "$INIT_ENV" ]; then
19+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
20+
exit 1
21+
fi
22+
23+
if [ -z "$__INIT_ENV_LOADED" ]; then
24+
# shellcheck disable=SC1090
25+
. "$INIT_ENV"
26+
fi
27+
# shellcheck disable=SC1090,SC1091
28+
. "$TOOLS/functestlib.sh"
29+
# ---------------------------------------------------------------
1130

1231
test_path=$(find_test_case_by_name "$TESTNAME")
32+
cd "$test_path" || exit 1
33+
1334
log_info "-----------------------------------------------------------------------------------------"
1435
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
1536

37+
RESULT_FILE="$TESTNAME.res"
1638
log_info "Checking if dependency binary is available"
1739
export PATH=$PATH:/usr/share/bin
18-
check_dependencies fastrpc_test
40+
check_dependencies fastrpc_test grep
41+
42+
cd /usr/share/bin/
43+
44+
# Step 1: Read the SoC ID
45+
soc=$(cat /sys/devices/soc0/soc_id)
1946

20-
mkdir -p results/fastrpc_test
21-
chmod -R 755 results/fastrpc_test
47+
# Step 2: Determine the architecture based on SoC ID
48+
case "$soc" in
49+
498)
50+
architecture="v68"
51+
;;
52+
676|534)
53+
architecture="v73"
54+
;;
55+
606)
56+
architecture="v75"
57+
;;
58+
*)
59+
echo "Unknown SoC ID: $soc"
60+
exit 1
61+
;;
62+
esac
2263

23-
# Navigate to the directory where the fastrpc_test application is located
64+
# Step 3: Execute the command with the architecture
2465

25-
cd /usr/share/bin
66+
output=$(/usr/share/bin/fastrpc_test -d 3 -U 1 -t linux -a "$architecture")
2667

27-
# Execute the command and capture the output
28-
output=$(./fastrpc_test -d 3 -U 1 -t linux -a v68)
2968
echo $output
3069

3170
# Check if the output contains the desired string
3271
if echo "$output" | grep -q "All tests completed successfully"; then
3372
log_pass "$TESTNAME : Test Passed"
34-
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
73+
echo "$TESTNAME : PASS" > "$RESULT_FILE"
3574
else
3675
log_fail "$TESTNAME : Test Failed"
37-
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
76+
echo "$TESTNAME : FAIL" > "$RESULT_FILE"
3877
fi
3978

4079
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)