blob: 3296894c137bc7bd42c59d99d55d7151963e761a [file] [edit]
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Wrapped command for rsproxy_wrapper_unready_fallback_test. Runs after
# rsproxy-wrap.sh has fallen back from unready_rsproxy.sh, and checks that the
# fallback left the environment intact.
set -eu
if [[ ! -f "${TEST_TMPDIR}/unready_rsproxy_got_sigterm" ]]; then
echo "FAIL: unready_rsproxy.sh never got SIGTERM; it probably exited early, so the timeout fallback path wasn't exercised." >&2
exit 1
fi
stderr_target="$(readlink /proc/self/fd/2 || true)"
if [[ "${stderr_target}" == "/dev/null" ]]; then
# stdout is the only channel left.
echo "FAIL: rsproxy-wrap.sh redirected the wrapped command's stderr to /dev/null."
exit 1
fi
echo "OK"