...
1#!/usr/bin/env bash
2usage() { echo "Usage: $0 [-c <bazelrc config>] [-f use file output]" 1>&2; exit 0; }
3[ $# -eq 0 ] && usage
4while getopts ":f:c:h" opt; do
5 case $opt in
6 f) targets_file="$OPTARG" ;;
7 c) config="--config=$OPTARG" ;;
8 h | *) usage ;;
9 esac
10done
11
12# set -eu
13
14# get the targets line by line
15tests=()
16while IFS='' read -r line; do
17 if [[ -z "$line" ]]; then
18 continue
19 fi
20
21 tests+=("$line");
22done <"$targets_file"
23
24if [[ -z "${tests[*]}" ]]; then
25 echo "No L1 tests to run"
26 exit 0;
27fi
28
29echo "Testing targets:"
30echo "${tests[@]}"
31
32
33# run tests that arent slow, disruptive, serial, flaky, or privileged
34test_exit=0
35bazel run //test/rosa int "${tests[@]}" "$config" -- --test_arg=--skip-labels=slow=true,disruptive=true,serial=true,flaky=true,privileged=true || test_exit=$?
36
37# Ok to exit 0 if bazel test exit is 4 (test requsted but none to run)
38if [[ $test_exit == 4 ]]; then
39 echo "No tests to run"
40 exit 0;
41fi
42
43exit $test_exit
View as plain text