|
| 1 | +#!/bin/sh |
| 2 | + |
1 | 3 | # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
2 | 4 | # SPDX-License-Identifier: BSD-3-Clause-Clear
|
3 | 5 |
|
4 |
| -#!/bin/sh |
5 |
| -# Import test suite definitions |
6 |
| -. $(pwd)/init_env |
7 |
| -TESTNAME="Opencv_core" |
| 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 |
8 | 22 |
|
9 |
| -# Import test functions |
10 |
| -. $TOOLS/functestlib.sh |
| 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 | +# --------------------------------------------------------------- |
11 | 30 |
|
| 31 | +TESTNAME="Opencv_core" |
12 | 32 | test_path=$(find_test_case_by_name "$TESTNAME")
|
| 33 | +cd "$test_path" || exit 1 |
| 34 | + |
13 | 35 | log_info "-----------------------------------------------------------------------------------------"
|
14 | 36 | log_info "-------------------Starting $TESTNAME Testcase----------------------------"
|
15 | 37 |
|
16 | 38 |
|
17 | 39 | log_info "Checking if dependency binary is available"
|
18 |
| -check_dependencies opencv_test_core |
| 40 | +check_dependencies opencv_test_core grep chmod |
19 | 41 |
|
20 | 42 | # Navigate to the directory where the fastrpc_test application is located
|
21 |
| -cd /usr/bin/ |
22 |
| -chmod 777 opencv_test_core |
| 43 | +chmod 777 /usr/bin/opencv_test_core |
23 | 44 |
|
24 | 45 | # 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 |
| 46 | +export OPENCV_OPENCL_RUNTIME=disabled && /usr/bin/opencv_test_core --gtest_filter=Core_AddMixed/ArithmMixedTest.accuracy/0 > opencv_core_result.txt |
26 | 47 |
|
27 | 48 | # 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 |
| 49 | +if grep -q "PASSED" opencv_core_result.txt; then |
29 | 50 | log_pass "$TESTNAME : Test Passed"
|
30 |
| - echo "$TESTNAME PASS" > $test_path/$TESTNAME.res |
| 51 | + echo "$TESTNAME PASS" > "$test_path/$TESTNAME.res" |
31 | 52 |
|
32 | 53 | else
|
33 | 54 | log_fail "$TESTNAME : Test Failed"
|
34 |
| - echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res |
| 55 | + echo "$TESTNAME FAIL" > "$test_path/$TESTNAME.res" |
35 | 56 | fi
|
36 | 57 |
|
37 | 58 | # Print the completion of the test case
|
|
0 commit comments