• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# Copyright (c) 2024 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
15set -e
16
17cur_path="$(pwd)"
18cur_dir="$(basename $cur_path)"
19
20if [ "$cur_dir" != "libabckit" ]; then
21    echo "please rerun from runtime_core/libabckit"
22    exit 1
23fi
24
25function clear_tests() {
26    rm -rf tests/null_args_tests/null_args_tests_*
27    rm -rf tests/wrong_ctx_tests/wrong_ctx_tests_*
28    rm -rf tests/wrong_mode_tests/wrong_mode_tests_*
29    rm -rf tests/wrong_imm_tests/wrong_imm_tests_*
30}
31
32function generate_tests() {
33    ruby scripts/gen_wrong_ctx_tests.rb
34    ruby scripts/gen_wrong_mode_tests.rb
35    ruby scripts/gen_wrong_imm_tests.rb
36    ruby scripts/gen_null_arg_tests.rb
37}
38
39if [[ "${1}" == "clear" ]]; then
40    clear_tests
41    if [[ "${2}" == "gen" ]]; then
42        generate_tests
43    fi
44fi
45
46if [[ "$1" == "gen" ]]; then
47    generate_tests
48    if [[ "$2" == "clear" ]]; then
49        clear_tests
50    fi
51fi
52