Debian Codegraph @

extra/protobuf/protobuf-24.4/conformance/bazel_conformance_test_runner.sh

raw
1 #!/bin/bash
2 # This is an internal file that should only be called from Bazel rules. For
3 # custom conformance tests outside of Bazel use CMAKE with
4 # -Dprotobuf_BUILD_CONFORMANCE=ON to build the test runner.
5
6 set -x
7 echo $@
8
9 set -euo pipefail
10 # --- begin runfiles.bash initialization ---
11 if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
12 if [[ -f "$0.runfiles_manifest" ]]; then
13 export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest"
14 elif [[ -f "$0.runfiles/MANIFEST" ]]; then
15 export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST"
16 elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
17 export RUNFILES_DIR="$0.runfiles"
18 fi
19 fi
20 if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
21 source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
22 elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
23 source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
24 "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
25 else
26 echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
27 exit 1
28 fi
29 # --- end runfiles.bash initialization ---
30
31 TESTEE=unset
32 FAILURE_LIST=unset
33 TEXT_FORMAT_FAILURE_LIST=unset
34
35 while [[ -n "$@" ]]; do
36 arg="$1"; shift
37 val="$1"; shift
38 case "$arg" in
39 "--testee") TESTEE="$val" ;;
40 "--failure_list") FAILURE_LIST="$val" ;;
41 "--text_format_failure_list") TEXT_FORMAT_FAILURE_LIST="$val" ;;
42 *) echo "Flag $arg is not recognized." && exit 1 ;;
43 esac
44 done
45
46 conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner)
47 conformance_testee=$(rlocation $TESTEE)
48 args=(--enforce_recommended)
49
50 failure_list=$(rlocation $FAILURE_LIST) || unset
51 if [ -n "$failure_list" ] ; then
52 args+=(--failure_list $failure_list)
53 fi
54
55 text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST) || unset
56 if [ -n "$text_format_failure_list" ]; then
57 args+=(--text_format_failure_list $text_format_failure_list)
58 fi
59
60 $conformance_test_runner "${args[@]}" $conformance_testee