diff options
author | 2016-04-25 15:14:55 +0000 | |
---|---|---|
committer | 2016-04-25 17:48:34 +0000 | |
commit | 06fb7ef98fedf9e814380e75f323a4f9669a1f93 (patch) | |
tree | 3474d81b455f169cd3d71491c1cb5c3e8da8628f /src/test/shell | |
parent | 6ba22c0b3bf323db9235a2bb2a5c333d2518b148 (diff) |
Fix docs on test environment and add a test
Fixes #1126.
--
MOS_MIGRATED_REVID=120707955
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/bazel_test_test.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index 60ca47351c..4997143298 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -115,6 +115,31 @@ EOF expect_log "TEST_TMPDIR=$TEST_TMPDIR" } +function test_env_vars() { + cat > WORKSPACE <<EOF +workspace(name = "bar") +EOF + mkdir -p foo + cat > foo/testenv.sh <<'EOF' +#!/bin/bash +echo "pwd: $PWD" +echo "src: $TEST_SRCDIR" +echo "ws: $TEST_WORKSPACE" +EOF + chmod +x foo/testenv.sh + cat > foo/BUILD <<EOF +sh_test( + name = "foo", + srcs = ["testenv.sh"], +) +EOF + + bazel test --test_output=all //foo &> $TEST_log || fail "Test failed" + expect_log "pwd: .*/foo.runfiles/bar$" + expect_log "src: .*/foo.runfiles$" + expect_log "ws: bar$" +} + function test_run_under_label_with_options() { mkdir -p testing run || fail "mkdir testing run failed" cat <<EOF > run/BUILD |