diff options
Diffstat (limited to 'src/test/shell/bazel/runfiles_test.sh')
-rwxr-xr-x | src/test/shell/bazel/runfiles_test.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/shell/bazel/runfiles_test.sh b/src/test/shell/bazel/runfiles_test.sh index 33205b86d2..698f319d59 100755 --- a/src/test/shell/bazel/runfiles_test.sh +++ b/src/test/shell/bazel/runfiles_test.sh @@ -53,4 +53,43 @@ EOF [[ -x bazel-bin/foo/foo.runfiles/$name/foo/foo ]] || fail "No foo executable under $name" } +function test_external_runfiles() { + cat > WORKSPACE <<EOF +workspace(name = "foo") + +new_local_repository( + name = "bar", + path = ".", + build_file = "BUILD", +) +EOF + + cat > BUILD <<EOF +exports_files(glob(["*"])) + +cc_binary( + name = "thing", + srcs = ["thing.cc"], + data = ["@bar//:thing.cc"], +) +EOF + cat > thing.cc <<EOF +int main() { return 0; } +EOF + bazel build --legacy_external_runfiles //:thing &> $TEST_log \ + || fail "Build failed" + [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \ + || fail "bar not found" + + bazel build --nolegacy_external_runfiles //:thing &> $TEST_log \ + || fail "Build failed" + [[ ! -d bazel-bin/thing.runfiles/foo/external/bar ]] \ + || fail "Old bar still found" + + bazel build --legacy_external_runfiles //:thing &> $TEST_log \ + || fail "Build failed" + [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \ + || fail "bar not recreated" +} + run_suite "runfiles tests" |