Skip to content

Commit 0c32583

Browse files
committed
Public CI OpenCV Shell Scripts
Added shell script for OpenVC testcases Added Readme for OpenVC Testcases Signed-off-by: Abhishek <[email protected]>
1 parent 73a2a03 commit 0c32583

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# OpenCV Test Script for Qualcomm Linux based platform (Yocto)
5+
6+
## Overview
7+
8+
OpenCV script automates the validation of one of the OpenCV APIs functionality on the Qualcomm Linux based platform running a Yocto-based Linux system.
9+
10+
## Features
11+
12+
- OpenCV core module - ARITHM API
13+
- accuracy test from ARITHM API
14+
15+
## Prerequisites
16+
17+
Ensure the following components are present in the target Yocto build:
18+
19+
- Compiling the OpenCV Binaries.
20+
- set up the build from Qualcomm Linux buid guide
21+
- To enable the tests package, include tests in PACKAGECONFIG in the
22+
<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb recipe file as follows.
23+
24+
PACKAGECONFIG ??= "gapi python3 eigen jpeg png tiff v4l libv4l
25+
samples tbb gphoto2 tests \
26+
${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
27+
28+
- To retain test bins, include the following code in the
29+
<workspace>/layers/meta-qcom-hwe/recipes-support/opencv/opencv_4.11.0.qcom.bb recipe file:
30+
31+
RM_WORK_EXCLUDE += "opencv"
32+
33+
- To Clean OpenCV, run the below command :
34+
35+
bitbake -fc cleanall opencv
36+
37+
- To compile OpenCV, run the following command:
38+
39+
bitbake opencv
40+
41+
- The path to OpenCV bins will be below :
42+
43+
tmp-glibc\work\armv8-2a-qcom-linux\opencv\4.11.0.qcom\build\bin
44+
45+
- Use the scp command to push the required test bin to /usr/bin. ( Test bin should be pushed to /usr/bin/ )
46+
47+
For example: scp -r opencv_test_core root@[IP-ADDR]:/usr/bin/
48+
49+
50+
## Directory Structure
51+
52+
```bash
53+
Runner/
54+
├── suites/
55+
│ ├── Multimedia/
56+
│ │ ├── OpenCV/
57+
│ │ │ ├── run.sh
58+
59+
```
60+
61+
## Usage
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 the /var directory on the target device.
64+
65+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
66+
67+
3. Run Scripts: Navigate to the /var directory 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:/var
76+
ssh user@target_device_ip
77+
cd /var/Runner && ./run-test.sh
78+
```
79+
Sample output:
80+
```
81+
sh-5.2# cd /var/Runner && ./run-test.sh OpenCV
82+
[Executing test case: /var/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.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
#!/bin/sh
5+
# Import test suite definitions
6+
. $(pwd)/init_env
7+
TESTNAME="Opencv_core"
8+
9+
# Import test functions
10+
. $TOOLS/functestlib.sh
11+
12+
test_path=$(find_test_case_by_name "$TESTNAME")
13+
log_info "-----------------------------------------------------------------------------------------"
14+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
15+
16+
17+
log_info "Checking if dependency binary is available"
18+
check_dependencies opencv_test_core
19+
20+
# Navigate to the directory where the fastrpc_test application is located
21+
cd /usr/bin/
22+
chmod 777 opencv_test_core
23+
24+
# Execute the command and capture the output
25+
export OPENCV_OPENCL_RUNTIME=disabled && /usr/bin/opencv_perf_core --gtest_filter=Core_AddMixed/ArithmMixedTest.accuracy/0 > /data/opencv_core_result.txt
26+
27+
# Check the log file for the string "SUCCESS" to determine if the test passed
28+
if grep -q "PASSED" /data/opencv_core_result.txt; then
29+
log_pass "$TESTNAME : Test Passed"
30+
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
31+
32+
else
33+
log_fail "$TESTNAME : Test Failed"
34+
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
35+
fi
36+
37+
# Print the completion of the test case
38+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
39+
40+
41+
42+

0 commit comments

Comments
 (0)