diff options
author | 2016-02-29 10:15:52 +0000 | |
---|---|---|
committer | 2016-02-29 17:40:00 +0000 | |
commit | 05c7d11baba6eca78cd9b440a6453fdab366c2c8 (patch) | |
tree | 7c5ca2da2d834bd6d5de37a9f2f5f1866d8cda14 /src/test/shell/bazel | |
parent | b47288152eef10d39744fd633e43e3722d910b12 (diff) |
Use client environment for repository_ctx.which path environment
This unify the way which() and os.environ() get their environment
and won't lead to weird issue.
--
MOS_MIGRATED_REVID=115829154
Diffstat (limited to 'src/test/shell/bazel')
-rwxr-xr-x | src/test/shell/bazel/skylark_repository_test.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test/shell/bazel/skylark_repository_test.sh b/src/test/shell/bazel/skylark_repository_test.sh index 7d49598e2f..7c6cb7b4ee 100755 --- a/src/test/shell/bazel/skylark_repository_test.sh +++ b/src/test/shell/bazel/skylark_repository_test.sh @@ -268,12 +268,22 @@ EOF function test_skylark_repository_which_and_execute() { setup_skylark_repository + bazel info + + # Test we are using the client environment, not the server one + echo "#!/bin/bash" > bin.sh + echo "exit 0" >> bin.sh + chmod +x bin.sh + # Our custom repository rule cat >test.bzl <<EOF def _impl(ctx): bash = ctx.which("bash") if bash == None: fail("Bash not found!") + bin = ctx.which("bin.sh") + if bin == None: + fail("bin.sh not found!") result = ctx.execute([bash, "--version"]) if result.return_code != 0: fail("Non-zero return code from bash: " + result.return_code) @@ -285,7 +295,7 @@ def _impl(ctx): repo = repository_rule(implementation=_impl, local=True) EOF - bazel build @foo//:bar >& $TEST_log || fail "Failed to build" + PATH="${PATH}:${PWD}" bazel build @foo//:bar >& $TEST_log || fail "Failed to build" expect_log "version" } |