File
Blob: src/workerd/server/tests/python/python-abort-isolate-on-fatal/python-abort-isolate-on-fatal.sh
| 1 | #!/bin/bash |
| 2 | # Test that when the python-abort-isolate-on-fatal-error autogate is enabled, |
| 3 | # triggering a Python fatal error causes the workerd process to abort. |
| 4 | |
| 5 | set -uo pipefail |
| 6 | |
| 7 | WORKERD=$1 |
| 8 | CONFIG=$2 |
| 9 | PYODIDE_BUNDLE=$3 |
| 10 | WHEELS_DIR=$4 |
| 11 | |
| 12 | TEST_TMPDIR="${TEST_TMPDIR:-/tmp}" |
| 13 | |
| 14 | # Pyodide bundle directory is the parent of the .capnp.bin file. |
| 15 | BUNDLE_DIR=$(dirname "$PYODIDE_BUNDLE") |
| 16 | |
| 17 | output=$("$WORKERD" test \ |
| 18 | "$CONFIG" \ |
| 19 | --experimental \ |
| 20 | --compat-date=2000-01-01 \ |
| 21 | --pyodide-bundle-disk-cache-dir "$BUNDLE_DIR" \ |
| 22 | --pyodide-package-disk-cache-dir "$WHEELS_DIR" \ |
| 23 | -dTEST_TMPDIR="$TEST_TMPDIR" 2>&1) |
| 24 | exit_code=$? |
| 25 | |
| 26 | echo "--- captured output ---" >&2 |
| 27 | echo "$output" >&2 |
| 28 | echo "--- end captured output ---" >&2 |
| 29 | |
| 30 | if [ "$exit_code" -eq 0 ]; then |
| 31 | echo "FAIL: expected nonzero exit code from abortIsolate" >&2 |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | if ! echo "$output" | grep -qF "abortIsolate() called, terminating process"; then |
| 36 | echo "FAIL: expected abortIsolate fatal message not found" >&2 |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | if ! echo "$output" | grep -qF "Python worker fatal error"; then |
| 41 | echo "FAIL: expected Python worker fatal error reason not found" >&2 |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
| 45 | echo "Success" |
| 46 | exit 0 |