Skip to content

Public CI fast RPC Shell Scripts #24

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/README_CDSP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# FastRPC Test Scripts for Qualcomm Linux based platform (Yocto)

## Overview

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

## Features

- Simple Calculator Service
- HAP example
- Multithreading Example

## Prerequisites

Ensure the following components are present in the target Yocto build (at usr/share/bin/):

- this test app can be compiled from https://github.com/quic/fastrpc
- `fastrpc_test` : The compiled test application.
- `android Directory` : Contains shared libraries for the Android platform.
- `linux Directory` : Contains shared libraries for the Linux platform.
- `v68 Directory` : Contains skeletons for the v68 architecture version.
- Write access to root filesystem (for environment setup)

## Directory Structure

```bash
Runner/
├── suites/
│ ├── Multimedia/
│ │ ├── CDSP/
│ │ │ ├── fastrpc_test/
│ │ │ │ ├── run.sh

```

## Usage


Instructions

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.

2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.

3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.

Run a specific test using:
---
Quick Example
```
git clone <this-repo>
cd <this-repo>
scp -r Runner user@target_device_ip:<Path in device>
ssh user@target_device_ip
cd <Path in device>/Runner && ./run-test.sh
```
Sample output:
```
sh-5.2# cd /<Path in device>/Runner && ./run-test.sh fastrpc_test
[Executing test case: /<Path in device>/Runner/suites/Multimedia/CDSP/fastrpc_test] 1980-01-06 01:33:25 -
[INFO] 1980-01-06 01:33:25 - -----------------------------------------------------------------------------------------
[INFO] 1980-01-06 01:33:25 - -------------------Starting fastrpc_test Testcase----------------------------
[INFO] 1980-01-06 01:33:25 - Checking if dependency binary is available
[PASS] 1980-01-06 01:33:25 - Test related dependencies are present.
...
[PASS] 1980-01-06 01:33:27 - fastrpc_test : Test Passed
[INFO] 1980-01-06 01:33:27 - -------------------Completed fastrpc_test Testcase----------------------------
```

4. Results will be available in the `Runner/suites/Multimedia/CDSP/` directory.

## Notes

- The script does not take any arguments.
- It validates the presence of required libraries before executing tests.
- If any critical tool is missing, the script exits with an error message.

## License

SPDX-License-Identifier: BSD-3-Clause-Clear
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
77 changes: 77 additions & 0 deletions Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh

# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause-Clear

# --------- Robustly source init_env and functestlib.sh ----------
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
INIT_ENV=""
SEARCH="$SCRIPT_DIR"
while [ "$SEARCH" != "/" ]; do
if [ -f "$SEARCH/init_env" ]; then
INIT_ENV="$SEARCH/init_env"
break
fi
SEARCH=$(dirname "$SEARCH")
done

if [ -z "$INIT_ENV" ]; then
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
exit 1
fi

if [ -z "$__INIT_ENV_LOADED" ]; then
# shellcheck disable=SC1090
. "$INIT_ENV"
fi
# shellcheck disable=SC1090,SC1091
. "$TOOLS/functestlib.sh"
# ---------------------------------------------------------------

TESTNAME="fastrpc_test"
test_path=$(find_test_case_by_name "$TESTNAME")
cd "$test_path" || exit 1

log_info "-----------------------------------------------------------------------------------------"
log_info "-------------------Starting $TESTNAME Testcase----------------------------"

RESULT_FILE="$TESTNAME.res"
log_info "Checking if dependency binary is available"
export PATH=$PATH:/usr/share/bin
check_dependencies fastrpc_test grep stdbuf

# Step 1: Read the SoC ID
soc=$(cat /sys/devices/soc0/soc_id)

# Step 2: Determine the architecture based on SoC ID
case "$soc" in
498)
architecture="v68"
;;
676|534)
architecture="v73"
;;
606)
architecture="v75"
;;
*)
echo "Unknown SoC ID: $soc"
exit 1
;;
esac

# Step 3: Execute the command with the architecture
output=$(stdbuf -oL -eL sh -c "cd /usr/share/bin && ./fastrpc_test -d 3 -U 1 -t linux -a \"$architecture\"")

echo $output

# Check if the output contains the desired string
if echo "$output" | grep -q "All tests completed successfully"; then
log_pass "$TESTNAME : Test Passed"
echo "$TESTNAME : PASS" > "$RESULT_FILE"
else
log_fail "$TESTNAME : Test Failed"
echo "$TESTNAME : FAIL" > "$RESULT_FILE"
fi

log_info "-------------------Completed $TESTNAME Testcase----------------------------"
Loading