• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15function print_test_help() {
16    HELP_MESSAGE="
17    This script builds Panda SDK.
18
19    SYNOPSIS
20
21    $0 [OPTIONS]
22
23    OPTIONS
24
25    --help, -h              Show this message and exit.
26
27    --build_type=...        [Release/Debug/FastVerify] Set build type
28    "
29
30    echo "$HELP_MESSAGE"
31}
32
33set -eo pipefail
34
35SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
36PANDA_SDK_BUILD_TYPE="Release"
37
38for i in "$@"; do
39    ERROR_ARG=""
40    case $i in
41    -h|--help)
42        print_test_help
43        exit 0
44        ;;
45    --build_type=*)
46        TYPE_ARG=${i//[-a-zA-Z0-9]*=/}
47        if [[ "$TYPE_ARG" = "Release" ]]; then
48            PANDA_SDK_BUILD_TYPE="Release"
49        fi
50        if [[ "$TYPE_ARG" = "Debug" ]]; then
51            PANDA_SDK_BUILD_TYPE="Debug"
52        fi
53        if [[ "$TYPE_ARG" = "FastVerify" ]]; then
54            PANDA_SDK_BUILD_TYPE="FastVerify"
55        fi
56        shift
57        ;;
58    *)
59        ERROR_ARG="YES"
60    esac
61
62    if [[ -n "${ERROR_ARG}" ]]; then
63        echo "Error: Unsupported flag $i" >&2
64        exit 1
65    fi
66done
67
68bash "$SCRIPT_DIR"/test_sdk --build_type="$PANDA_SDK_BUILD_TYPE"
69