diff --git a/src/test/py/bazel/windows_remote_test.py b/src/test/py/bazel/windows_remote_test.py index a717b035819e67..79bbcdc59b9755 100644 --- a/src/test/py/bazel/windows_remote_test.py +++ b/src/test/py/bazel/windows_remote_test.py @@ -124,7 +124,12 @@ def testShTestRunsRemotely(self): ')', ]) self.ScratchFile( - 'foo/foo_test.sh', ['#!/bin/sh', 'echo hello test'], executable=True) + 'foo/foo_test.sh', [ + '#!/bin/sh', + 'echo hello test', + 'echo "RUNFILES_MANIFEST_FILE: \\"${RUNFILES_MANIFEST_FILE:-}\\""' + ], + executable=True) self.ScratchFile('bar/BUILD', ['exports_files(["bar.txt"])']) self.ScratchFile('bar/bar.txt', ['hello']) @@ -132,6 +137,7 @@ def testShTestRunsRemotely(self): exit_code, stdout, stderr = self._RunRemoteBazel( ['test', '--test_output=all', '//foo:foo_test']) self.AssertExitCode(exit_code, 0, stderr, stdout) + self.assertIn('RUNFILES_MANIFEST_FILE: ""', stdout) # The Java launcher uses Rlocation which has differing behavior for local and # remote. diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index efb282fddd42e2..4d81b3500880b9 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -126,9 +126,9 @@ function rlocation() { export -f rlocation export -f is_absolute -# If RUNFILES_MANIFEST_ONLY is set to 1, then test programs should use manifest file to find -# runfiles. -if [[ "${RUNFILES_MANIFEST_ONLY:-}" == "1" ]]; then +# If RUNFILES_MANIFEST_ONLY is set to 1 and the manifest file does exist, +# then test programs should use manifest file to find runfiles. +if [[ "${RUNFILES_MANIFEST_ONLY:-}" == "1" && -e "${RUNFILES_MANIFEST_FILE:-}" ]]; then export RUNFILES_MANIFEST_FILE export RUNFILES_MANIFEST_ONLY fi