Skip to content

Commit

Permalink
Fix non-determinism in skylark_repository_test.sh.
Browse files Browse the repository at this point in the history
The test_skylark_repository_which_and_execute test would fail when run alone or when sharding puts it into a different group of tests, because it tried to run "bazel info" before it actually setup its test workspace. This only worked, because the files would have been created (and not cleaned up) by an earlier test.

PiperOrigin-RevId: 222393468
  • Loading branch information
philwo authored and Copybara-Service committed Nov 21, 2018
1 parent ebeccb3 commit 9ca0cab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test/shell/bazel/skylark_repository_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ EOF
function test_skylark_repository_which_and_execute() {
setup_skylark_repository

# Test we are using the client environment, not the server one
bazel info &> /dev/null # Start up the server.
echo "#!/bin/sh" > bin.sh
echo "exit 0" >> bin.sh
chmod +x bin.sh
Expand All @@ -393,6 +391,9 @@ def _impl(repository_ctx):
repo = repository_rule(implementation=_impl, local=True)
EOF

# Test we are using the client environment, not the server one
bazel info &> /dev/null # Start up the server.

FOO="BAZ" PATH="${PATH}:${PWD}" bazel build @foo//:bar >& $TEST_log \
|| fail "Failed to build"
expect_log "version"
Expand Down

0 comments on commit 9ca0cab

Please sign in to comment.