aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/integration
diff options
context:
space:
mode:
authorGravatar jcater <jcater@google.com>2017-12-05 17:48:11 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-05 17:50:21 -0800
commita2d2615362c65be98629b39ce39754a325ed1c42 (patch)
tree34ee3120287d244f57ce6bda51609ed51fb11e76 /src/test/shell/integration
parent21fdc48b07682314a5cee5d4625425f627255c0e (diff)
Check for null build file returned from getBuildFileForPackage.
This can occur in genqueries when a referenced package isn't in the scope. PiperOrigin-RevId: 178038701
Diffstat (limited to 'src/test/shell/integration')
-rwxr-xr-xsrc/test/shell/integration/bazel_query_test.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/shell/integration/bazel_query_test.sh b/src/test/shell/integration/bazel_query_test.sh
index f5de27c8e5..76ff0e8019 100755
--- a/src/test/shell/integration/bazel_query_test.sh
+++ b/src/test/shell/integration/bazel_query_test.sh
@@ -457,6 +457,30 @@ EOF
expect_not_log "//foo:BUILD$"
}
+function test_buildfile_in_genquery() {
+ mkdir -p papaya
+ cat > papaya/BUILD <<EOF
+exports_files(['papaya.bzl'])
+EOF
+ cat > papaya/papaya.bzl <<EOF
+foo = 1
+EOF
+ mkdir -p honeydew
+ cat > honeydew/BUILD <<EOF
+load('//papaya:papaya.bzl', 'foo')
+sh_library(name='honeydew', deps=[':pineapple'])
+sh_library(name='pineapple')
+genquery(name='q',
+ scope=[':honeydew'],
+ strict=0,
+ expression='buildfiles(//honeydew:all)')
+EOF
+
+ bazel build //honeydew:q >& $TEST_log || fail "Expected success"
+ cat bazel-bin/honeydew/q > $TEST_log
+ expect_log_once "^//honeydew:BUILD$"
+}
+
function tear_down() {
bazel shutdown
}