-
Notifications
You must be signed in to change notification settings - Fork 21
Add FastCV OpenCV SFM validation test script #196
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# FastCV OpenCV SFM Validation Test | ||
|
||
This test validates the OpenCV Structure from Motion (SFM) module functionality using the FastCV framework on Qualcomm platforms with Yocto builds. | ||
|
||
## Overview | ||
|
||
The test script performs the following functional checks: | ||
|
||
1. **Filesystem Preparation** | ||
- Resizes the root filesystem partition to ensure sufficient space using `resize2fs`. | ||
|
||
2. **Binary Permissions** | ||
- Sets executable permissions for OpenCV binaries located in `/usr/bin/FastCV` and `/usr/bin`. | ||
|
||
3. **Package Installation** | ||
- Installs required `.ipk` packages from `/usr/bin/FastCV/opencv` using `opkg` | ||
|
||
4. **Test Execution** | ||
- Runs the OpenCV SFM test suite with performance parameters: | ||
``` | ||
OPENCV_TEST_DATA_PATH=/usr/bin/FastCV/testdata/ /usr/bin/opencv_test_sfm --perf_min_samples=10 --perf_force_samples=10 | ||
``` | ||
|
||
5. **Validation** | ||
- Parses the test output to confirm that all 19 tests have passed. | ||
|
||
## How to Run | ||
|
||
source init_env | ||
cd suites/Vision/FunctionalArea/FastCV | ||
./run.sh | ||
|
||
|
||
## Prerequisites | ||
|
||
- `resize2fs`, `opkg`, and OpenCV binaries must be available on the target device | ||
- Root access is required for resizing partitions and setting permissions | ||
- Test data must be present at `/usr/bin/FastCV/testdata/` | ||
- `.ipk` packages should be available in `/usr/bin/FastCV/opencv/` | ||
|
||
## Result Format | ||
Test result will be saved in fastCV.res as: | ||
|
||
- OpenCV test suite passed successfully. `[ PASSED ] 19 tests` – if all validations pass | ||
- OpenCV test suite failed or incomplete. Test output did not match expected results. – if any check fails | ||
|
||
## License | ||
|
||
SPDX-License-Identifier: BSD-3-Clause-Clear | ||
(C) Qualcomm Technologies, Inc. and/or its subsidiaries. |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,74 @@ | ||||
#!/bin/sh | ||||
|
||||
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||||
# SPDX-License-Identifier: BSD-3-Clause-Clear | ||||
|
||||
# Robustly find and source init_env | ||||
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 | ||||
|
||||
# Only source if not already loaded (idempotent) | ||||
if [ -z "$__INIT_ENV_LOADED" ]; then | ||||
# shellcheck disable=SC1090 | ||||
. "$INIT_ENV" | ||||
fi | ||||
|
||||
# Always source functestlib.sh, using $TOOLS exported by init_env | ||||
# shellcheck disable=SC1090,SC1091 | ||||
. "$TOOLS/functestlib.sh" | ||||
|
||||
TESTNAME="fastCV" | ||||
test_path=$(find_test_case_by_name "$TESTNAME") | ||||
cd "$test_path" || exit 1 | ||||
res_file="./$TESTNAME.res" | ||||
summary_file="./$TESTNAME.summary" | ||||
rm -f "$res_file" "$summary_file" | ||||
|
||||
log_info "-------------------------------------------------" | ||||
log_info "----------- Starting $TESTNAME Test -------------" | ||||
|
||||
# Step 1: Resize rootfs | ||||
log_info "Resizing rootfs partition..." | ||||
resize2fs /dev/disk/by-partlabel/rootfs | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use available functions qcom-linux-testkit/Runner/utils/functestlib.sh Line 3399 in 59365c8
|
||||
|
||||
# Step 2: Set permissions | ||||
log_info "Setting permissions for OpenCV binaries..." | ||||
chmod 777 /usr/bin/FastCV/opencv | ||||
chmod 777 /usr/bin/opencv* | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to review the current execute permissions first, rather than immediately assigning 777 without checking. |
||||
|
||||
# Step 3: Install IPK packages | ||||
log_info "Installing IPK packages from /usr/bin/FastCV/opencv..." | ||||
cd /usr/bin/FastCV/opencv || exit 1 | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add some debug logs before exit so that it will be easy for debugging |
||||
opkg install *.ipk | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you determine if any ipk failed to install? |
||||
|
||||
# Step 4: Run OpenCV test | ||||
log_info "Running OpenCV SFM test suite..." | ||||
OPENCV_TEST_DATA_PATH=/usr/bin/FastCV/testdata/ /usr/bin/opencv_test_sfm --perf_min_samples=10 --perf_force_samples=10 > test_output.log 2>&1 | ||||
|
||||
# Step 5: Validate output | ||||
if grep -q "\[ PASSED \] 19 tests" test_output.log; then | ||||
log_pass "OpenCV test suite passed successfully." | ||||
echo "$TESTNAME PASS" > "$res_file" | ||||
echo "All 19 tests passed." >> "$summary_file" | ||||
exit 0 | ||||
else | ||||
log_fail "OpenCV test suite failed or incomplete." | ||||
echo "$TESTNAME FAIL" > "$res_file" | ||||
echo "Test output did not match expected results." >> "$summary_file" | ||||
exit 1 | ||||
fi | ||||
|
||||
log_info "----------- Completed $TESTNAME Test ------------" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to FastCV as dir structure is different