1cb93a386Sopenharmony_ci#!/usr/bin/env bash
2cb93a386Sopenharmony_ci# Copyright 2021 The Tint Authors
3cb93a386Sopenharmony_ci#
4cb93a386Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5cb93a386Sopenharmony_ci# you may not use this file except in compliance with the License.
6cb93a386Sopenharmony_ci# You may obtain a copy of the License at
7cb93a386Sopenharmony_ci#
8cb93a386Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
9cb93a386Sopenharmony_ci#
10cb93a386Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11cb93a386Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12cb93a386Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cb93a386Sopenharmony_ci# See the License for the specific language governing permissions and
14cb93a386Sopenharmony_ci# limitations under the License.
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciset -e # Fail on any error.
17cb93a386Sopenharmony_ci
18cb93a386Sopenharmony_ciif [ ! -x "$(which go)" ] ; then
19cb93a386Sopenharmony_ci    echo "error: go needs to be on \$PATH to use $0"
20cb93a386Sopenharmony_ci    exit 1
21cb93a386Sopenharmony_cifi
22cb93a386Sopenharmony_ci
23cb93a386Sopenharmony_ciSCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
24cb93a386Sopenharmony_ciROOT_DIR="$( cd "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd )"
25cb93a386Sopenharmony_ciBINARY="${SCRIPT_DIR}/bin/test-runner"
26cb93a386Sopenharmony_ci
27cb93a386Sopenharmony_ci# Rebuild the binary.
28cb93a386Sopenharmony_ci# Note, go caches build artifacts, so this is quick for repeat calls
29cb93a386Sopenharmony_cipushd "${SCRIPT_DIR}/src/cmd/test-runner" > /dev/null
30cb93a386Sopenharmony_ci    go build -o "${BINARY}" main.go
31cb93a386Sopenharmony_cipopd > /dev/null
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ci"${BINARY}" "$@"
34