aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
authorGravatar olaola <olaola@google.com>2017-10-16 10:33:07 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-10-16 17:48:53 +0200
commit6a3b41f34503a8f20b5b689bff14cb2424d35afb (patch)
tree1c49eea8901ce73cf030b3992615e0231209cab2 /src/test
parenta225458fbd066a76b9074197f0ce585d8c6a7983 (diff)
Removing the USER variable from test environment, unless explicitly provided.
TESTED=added remote test RELNOTES: Fixes #2574 PiperOrigin-RevId: 172294781
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/shell/bazel/remote_execution_test.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/shell/bazel/remote_execution_test.sh b/src/test/shell/bazel/remote_execution_test.sh
index 48c9b1a93e..c81ce2ed52 100755
--- a/src/test/shell/bazel/remote_execution_test.sh
+++ b/src/test/shell/bazel/remote_execution_test.sh
@@ -380,6 +380,41 @@ EOF
expect_log "TIMEOUT"
}
+function test_passed_env_user() {
+ mkdir -p a
+ cat > a/BUILD <<'EOF'
+sh_test(
+ name = "user_test",
+ timeout = "short",
+ srcs = ["user_test.sh"],
+)
+EOF
+
+ cat > a/user_test.sh <<'EOF'
+#!/bin/sh
+echo "user=$USER"
+EOF
+ chmod +x a/user_test.sh
+ bazel --host_jvm_args=-Dbazel.DigestFunction=SHA1 test \
+ --spawn_strategy=remote \
+ --remote_executor=localhost:${worker_port} \
+ --test_output=all \
+ --test_env=USER=boo \
+ //a:user_test >& $TEST_log \
+ || fail "Failed to run //a:user_test with remote execution"
+ expect_log "user=boo"
+
+ # Rely on the test-setup script to set USER value to whoami.
+ export USER=
+ bazel --host_jvm_args=-Dbazel.DigestFunction=SHA1 test \
+ --spawn_strategy=remote \
+ --remote_executor=localhost:${worker_port} \
+ --test_output=all \
+ //a:user_test >& $TEST_log \
+ || fail "Failed to run //a:user_test with remote execution"
+ expect_log "user=$(whoami)"
+}
+
function test_exitcode() {
mkdir -p a
cat > a/BUILD <<'EOF'