Skip to content

Commit cb65b42

Browse files
authored
Merge pull request #24 from abbajaj806/DSP
Public CI fast RPC Shell Scripts
2 parents d75bcd4 + 377f8b9 commit cb65b42

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# FastRPC Test Scripts for Qualcomm Linux based platform (Yocto)
2+
3+
## Overview
4+
5+
CDSP scripts demonstrates the usage of FastRPC (Fast Remote Procedure Call) to offload computations to different DSP (Digital Signal Processor) domains. The test application supports multiple examples, including a simple calculator service, a HAP example, and a multithreading example. This test app is publicly available https://github.com/quic/fastrpc
6+
7+
## Features
8+
9+
- Simple Calculator Service
10+
- HAP example
11+
- Multithreading Example
12+
13+
## Prerequisites
14+
15+
Ensure the following components are present in the target Yocto build (at usr/share/bin/):
16+
17+
- this test app can be compiled from https://github.com/quic/fastrpc
18+
- `fastrpc_test` : The compiled test application.
19+
- `android Directory` : Contains shared libraries for the Android platform.
20+
- `linux Directory` : Contains shared libraries for the Linux platform.
21+
- `v68 Directory` : Contains skeletons for the v68 architecture version.
22+
- Write access to root filesystem (for environment setup)
23+
24+
## Directory Structure
25+
26+
```bash
27+
Runner/
28+
├── suites/
29+
│ ├── Multimedia/
30+
│ │ ├── CDSP/
31+
│ │ │ ├── fastrpc_test/
32+
│ │ │ │ ├── run.sh
33+
34+
```
35+
36+
## Usage
37+
38+
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.
44+
45+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
46+
47+
Run a specific test using:
48+
---
49+
Quick Example
50+
```
51+
git clone <this-repo>
52+
cd <this-repo>
53+
scp -r Runner user@target_device_ip:<Path in device>
54+
ssh user@target_device_ip
55+
cd <Path in device>/Runner && ./run-test.sh
56+
```
57+
Sample output:
58+
```
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 -
61+
[INFO] 1980-01-06 01:33:25 - -----------------------------------------------------------------------------------------
62+
[INFO] 1980-01-06 01:33:25 - -------------------Starting fastrpc_test Testcase----------------------------
63+
[INFO] 1980-01-06 01:33:25 - Checking if dependency binary is available
64+
[PASS] 1980-01-06 01:33:25 - Test related dependencies are present.
65+
...
66+
[PASS] 1980-01-06 01:33:27 - fastrpc_test : Test Passed
67+
[INFO] 1980-01-06 01:33:27 - -------------------Completed fastrpc_test Testcase----------------------------
68+
```
69+
70+
4. Results will be available in the `Runner/suites/Multimedia/CDSP/` directory.
71+
72+
## Notes
73+
74+
- The script does not take any arguments.
75+
- It validates the presence of required libraries before executing tests.
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+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause-Clear
5+
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
17+
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+
# ---------------------------------------------------------------
30+
31+
TESTNAME="fastrpc_test"
32+
test_path=$(find_test_case_by_name "$TESTNAME")
33+
cd "$test_path" || exit 1
34+
35+
log_info "-----------------------------------------------------------------------------------------"
36+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
37+
38+
RESULT_FILE="$TESTNAME.res"
39+
log_info "Checking if dependency binary is available"
40+
export PATH=$PATH:/usr/share/bin
41+
check_dependencies fastrpc_test grep stdbuf
42+
43+
# Step 1: Read the SoC ID
44+
soc=$(cat /sys/devices/soc0/soc_id)
45+
46+
# Step 2: Determine the architecture based on SoC ID
47+
case "$soc" in
48+
498)
49+
architecture="v68"
50+
;;
51+
676|534)
52+
architecture="v73"
53+
;;
54+
606)
55+
architecture="v75"
56+
;;
57+
*)
58+
echo "Unknown SoC ID: $soc"
59+
exit 1
60+
;;
61+
esac
62+
63+
# Step 3: Execute the command with the architecture
64+
output=$(stdbuf -oL -eL sh -c "cd /usr/share/bin && ./fastrpc_test -d 3 -U 1 -t linux -a \"$architecture\"")
65+
66+
echo $output
67+
68+
# Check if the output contains the desired string
69+
if echo "$output" | grep -q "All tests completed successfully"; then
70+
log_pass "$TESTNAME : Test Passed"
71+
echo "$TESTNAME : PASS" > "$RESULT_FILE"
72+
else
73+
log_fail "$TESTNAME : Test Failed"
74+
echo "$TESTNAME : FAIL" > "$RESULT_FILE"
75+
fi
76+
77+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)