aboutsummaryrefslogtreecommitdiff
path: root/examples/check_for_finding.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/check_for_finding.sh')
-rwxr-xr-xexamples/check_for_finding.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/examples/check_for_finding.sh b/examples/check_for_finding.sh
index f60c011c..afe110c6 100755
--- a/examples/check_for_finding.sh
+++ b/examples/check_for_finding.sh
@@ -13,17 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-eval "$@"
+# --- begin runfiles.bash initialization v2 ---
+# Copy-pasted from the Bazel Bash runfiles library v2.
+set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
+source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$0.runfiles/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+# --- end runfiles.bash initialization v2 ---
+
+# Temporarily disable exit on error since we expect the command below to fail.
+set +e
+"$(rlocation "$1")" "$2" "$(rlocation "$3")" "${@:4}"
+declare -i exit_code=$?
+set -e
+
# Assert that we either found a crash in java (exit code 77) or an ASan crash
# (exit code 76).
-declare -i exit_code=$?
if [ $exit_code -eq 77 ] || [ $exit_code -eq 76 ]
then
- if [ "$(ls "$DEFAULT_CRASH_PREFIX/")" ]; then
- exit 0
- else
- exit 1
- fi
+ exit 0
else
echo "Unexpected exit code: $exit_code"
exit 1