Skip to content

Commit 667eb0b

Browse files
committed
Public CI OpenCV Shell Scripts
Added shell script for OpenVC testcases Added Readme for OpenVC Testcases Signed-off-by: Abhishek Bajaj <abbajaj@qti.qualcomm.com>
1 parent e6c52e9 commit 667eb0b

File tree

2 files changed

+159
-0
lines changed

2 files changed

+159
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# OpenCV Test Script for Qualcomm Linux based platform (Yocto)
2+
3+
## Overview
4+
5+
OpenCV Test Scripts automates the validation of one of the OpenCV APIs functionality on the Qualcomm Linux based platform running a Yocto-based Linux system.
6+
7+
## Features
8+
9+
- OpenCV core module - ARITHM API
10+
- accuracy test from ARITHM API
11+
12+
## Prerequisites
13+
14+
Ensure the following components are present in the target Yocto build:
15+
16+
- Compiling the OpenCV Binaries.
17+
- set up the build from Qualcomm Linux buid guide
18+
- To enable the tests package, include tests in PACKAGECONFIG in the
19+
<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb recipe file as follows.
20+
21+
PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l
22+
samples tbb gphoto2 tests \
23+
${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
24+
25+
- To retain test bins, include the following code in the
26+
<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb recipe file:
27+
28+
RM_WORK_EXCLUDE += "opencv"
29+
30+
- To Clean OpenCV, run the below command :
31+
32+
bitbake -fc cleanall opencv
33+
34+
- To compile OpenCV, run the following command:
35+
36+
bitbake opencv
37+
38+
- The path to OpenCV bins will be below :
39+
40+
tmp-glibc\work\armv8-2a-qcom-linux\opencv\4.11.0.qcom\build\bin
41+
42+
- Use the scp command to push the required test bin to /usr/bin. ( Test bin should be pushed to /usr/bin/ )
43+
44+
For example: scp -r opencv_test_core root@[IP-ADDR]:/usr/bin/
45+
46+
47+
## Directory Structure
48+
49+
```bash
50+
Runner/
51+
├── suites/
52+
│ ├── Multimedia/
53+
│ │ ├── OpenCV/
54+
│ │ │ ├── run.sh
55+
56+
```
57+
58+
## Usage
59+
60+
61+
Instructions
62+
63+
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.
64+
65+
2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device.
66+
67+
3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed.
68+
69+
Run a specific test using:
70+
---
71+
Quick Example
72+
```
73+
git clone <this-repo>
74+
cd <this-repo>
75+
scp -r common Runner user@target_device_ip:/<Path in device>
76+
ssh user@target_device_ip
77+
cd <Path in device>Runner && ./run-test.sh
78+
```
79+
Sample output:
80+
```
81+
sh-5.2# cd <Path in device>/Runner && ./run-test.sh OpenCV
82+
[Executing test case: /<Path in device>/Runner/suites/Multimedia/OpenCV/] 1980-01-09 01:31:15 -
83+
[INFO] 1980-01-09 01:31:15 - -----------------------------------------------------------------------------------------
84+
[INFO] 1980-01-09 01:31:15 - -------------------Starting Opencv_core Testcase----------------------------
85+
[INFO] 1980-01-09 01:31:15 - Checking if dependency binary is available
86+
[PASS] 1980-01-08 01:31:15 - Test related dependencies are present.
87+
...
88+
[PASS] 1980-01-09 22:31:16 - Opencv_core : Test Passed
89+
[INFO] 1980-01-09 22:31:16 - -------------------Completed Opencv_core Testcase----------------------------
90+
```
91+
92+
## Notes
93+
94+
- The script does not take any arguments.
95+
- It validates the presence of required libraries before executing tests.
96+
- If any critical tool is missing, the script exits with an error message.
97+
98+
## License
99+
100+
SPDX-License-Identifier: BSD-3-Clause-Clear
101+
(C) Qualcomm Technologies, Inc. and/or its subsidiaries.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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="Opencv_core"
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+
39+
log_info "Checking if dependency binary is available"
40+
check_dependencies opencv_test_core grep chmod
41+
42+
# Navigate to the directory where the fastrpc_test application is located
43+
chmod 755 /usr/bin/opencv_test_core
44+
45+
# Execute the command and capture the output
46+
export OPENCV_OPENCL_RUNTIME=disabled && /usr/bin/opencv_test_core --gtest_filter=Core_AddMixed/ArithmMixedTest.accuracy/0 > opencv_core_result.txt
47+
48+
# Check the log file for the string "SUCCESS" to determine if the test passed
49+
if grep -q "PASSED" opencv_core_result.txt; then
50+
log_pass "$TESTNAME : Test Passed"
51+
echo "$TESTNAME PASS" > "$test_path/$TESTNAME.res"
52+
else
53+
log_fail "$TESTNAME : Test Failed"
54+
echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res"
55+
fi
56+
57+
# Print the completion of the test case
58+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)