summaryrefslogtreecommitdiff
path: root/tests/scripts/onert-test
blob: f5ed47419582d5d329ad0bfdec67e2369dad83f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

# Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[[ "${BASH_SOURCE[0]}" != "${0}" ]] && echo "Please don't source ${BASH_SOURCE[0]}, execute it" && return

# Common variables which are used on test commands
# DRIVER_PATH: test driver and related resources forder
# INSTALL_PATH: test package installed folder
# CACHE_PATH: cache folder for test resource download
DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_PATH="$(dirname $DRIVER_PATH)"
CACHE_PATH=$DRIVER_PATH/cache

export PATH=$INSTALL_PATH/bin:$PATH

COMMAND_PATH=$DRIVER_PATH/command

function Usage()
{
  echo "Usage: $0 [COMMAND] ..."
  echo "Command:"
  for file in $COMMAND_PATH/*;
  do
    echo "    $(basename "$file")"
  done
  exit 255
}

COMMAND=$1; shift
if [[ -z $COMMAND ]] || [[ $COMMAND == "--help" ]]; then
  Usage
  exit 255
fi

COMMAND_FILE=$COMMAND_PATH/$COMMAND
if [[ ! -f $COMMAND_FILE ]]; then
  echo "ERROR: '$COMMAND' is not supported"
  exit 255
fi

source $COMMAND_FILE $@