Skip to content

Commit

Permalink
Simplify run_tests script.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681053339
  • Loading branch information
chaoren authored and Google Java Core Libraries committed Oct 1, 2024
1 parent 5956b55 commit 9f81752
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,26 @@
#
# Runs all tests, and tests that all libraries build without errors.

# TODO(cpovirk): Fix this, which started producing an empty list of libraries at some point!
libraries=""
for library in $(bazel query --output=label_kind //... | \
grep -v "//tools/" | \
grep _library | \
awk '{print $3}'); do
if [[ -z "${libraries}" ]]; then
libraries=" \"${library}\","
else
printf -v libraries '%s\n "%s",' "${libraries}" "${library}"
fi
done
readarray -t libraries < <(bazelisk query 'kind(_library, //third_party/...)')

readonly DIR=build_test

mkdir "${DIR}"
trap "rm -r ${DIR}/" EXIT

cat <<BUILD_TEST >> "${DIR}"/BUILD
java_library(
name = "build_test",
testonly = True,
srcs = ["BuildTest.java"],
deps = [
${libraries}
$(printf ' "%s",\n' "${libraries[@]}")
],
testonly = 1,
)
BUILD_TEST

echo "class BuildTest {}" > "${DIR}"/BuildTest.java

trap "rm -rf ${DIR}/" EXIT

bazelisk build //build_test //third_party/...

bazelisk test //tools/...

0 comments on commit 9f81752

Please sign in to comment.