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 6set -x 7echo $@ 8 9set -euo pipefail 10# --- begin runfiles.bash initialization --- 11if [[ ! -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 19fi 20if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then 21 source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" 22elif [[ -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-)" 25else 26 echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" 27 exit 1 28fi 29# --- end runfiles.bash initialization --- 30 31TESTEE= 32FAILURE_LIST= 33TEXT_FORMAT_FAILURE_LIST= 34MAXIMUM_EDITION= 35 36while [[ -n "$@" ]]; do 37 arg="$1"; shift 38 val="$1"; shift 39 case "$arg" in 40 "--testee") TESTEE="$val" ;; 41 "--failure_list") FAILURE_LIST="$val" ;; 42 "--text_format_failure_list") TEXT_FORMAT_FAILURE_LIST="$val" ;; 43 "--maximum_edition") MAXIMUM_EDITION="$val" ;; 44 *) echo "Flag $arg is not recognized." && exit 1 ;; 45 esac 46done 47 48conformance_test_runner=$(rlocation com_google_protobuf/conformance/conformance_test_runner) 49conformance_testee=$(rlocation $TESTEE) 50args=(--enforce_recommended) 51 52failure_list=$(rlocation $FAILURE_LIST) || unset 53if [ -n "$failure_list" ] ; then 54 args+=(--failure_list $failure_list) 55fi 56 57text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST) || unset 58if [ -n "$text_format_failure_list" ]; then 59 args+=(--text_format_failure_list $text_format_failure_list) 60fi 61 62if [ -n "$MAXIMUM_EDITION" ]; then 63 args+=(--maximum_edition $MAXIMUM_EDITION) 64fi 65 66$conformance_test_runner "${args[@]}" $conformance_testee 67