diff --git a/BUILD.bazel b/BUILD.bazel index 88aaac0470..fb09d1be90 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -107,6 +107,7 @@ test_suite( name = "tests", # bazel query --output label 'kind(".*_test rule", //...)' tests = [ + # __BEGIN_TESTS "//core/app/analytics:go_default_test", "//core/app/auth:go_default_test", "//core/app/benchmark:go_default_test", @@ -199,5 +200,6 @@ test_suite( "//test/integration/replay:go_default_test", "//test/integration/service:go_default_test", "//test/robot/stash/grpc:go_default_test", + # __END_TESTS ], ) diff --git a/kokoro/presubmit/presubmit.sh b/kokoro/presubmit/presubmit.sh index 47f49cb98b..ed38abf261 100755 --- a/kokoro/presubmit/presubmit.sh +++ b/kokoro/presubmit/presubmit.sh @@ -69,6 +69,13 @@ function run_buildozer() { [ $r -eq 3 ] && return 0 || return $r } +function run_enumerate_tests() { + TARGETS="$(bazel query --output label 'kind(".*_test rule", //...)' | sort -t: -k1,1 | awk '{print " \""$0"\","}')" + OUT=$(mktemp) + cp BUILD.bazel $OUT + cat $OUT | awk -v targets="$TARGETS" 'begin {a=0} /__END_TESTS/ {a=0} { if (a==0) print $0;} /__BEGIN_TESTS/ { a=1; print targets }' > BUILD.bazel +} + function run_gazelle() { echo # TODO: figure out a way to make bazel not print anything. $BAZEL run gazelle @@ -89,6 +96,9 @@ check buildifier run_buildifier # Check bazel style. check "buildozer fix" run_buildozer +# Check that the //:tests target contains all tests. +check "//:tests contains all tests" run_enumerate_tests + # Check gazelle. check "gazelle" run_gazelle