Skip to content

Commit

Permalink
Add test for query and cquery in the repo
Browse files Browse the repository at this point in the history
This will ensure we don't regress #2359

We can discuss adding this to different configurations (e.g. bazel
versions, bzlmod enabled vs disabled, ...), but I think "latest bazel in
its default config" is a reasonable place to start.
  • Loading branch information
illicitonion committed Jan 5, 2024
1 parent 0a4523e commit eb6f3f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ tasks:
test_targets: *default_linux_targets
coverage_targets: *default_linux_targets
post_shell_commands: *coverage_validation_post_shell_commands
run_targets:
- //test:query_test_binary
rbe_ubuntu2004:
shell_commands:
- sed -i 's/^# load("@bazelci_rules/load("@bazelci_rules/' WORKSPACE.bazel
Expand Down
4 changes: 4 additions & 0 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sh_binary(
name = "query_test_binary",
srcs = ["query_test_binary.sh"],
)
10 changes: 10 additions & 0 deletions test/query_test_binary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

cd "${BUILD_WORKSPACE_DIRECTORY}"

# We always expect to be able to query ... in this repo with no flags.
# In the past this has regressed, e.g. in https://github.com/bazelbuild/rules_rust/issues/2359, so we have this test to ensure we don't regress again.
bazel query //... >/dev/null
bazel cquery //... >/dev/null

0 comments on commit eb6f3f2

Please sign in to comment.