Run plugins tests if present
When the plugin BUILD contains a junit_test target
then run the corresponding bazel test command to check
that the plugin acceptance tests are successful.
Change-Id: Ice6b88aa1b1463efc9f8b05821305ccfcf32bddd
diff --git a/jenkins/gerrit-bazel-build-plugin.sh b/jenkins/gerrit-bazel-build-plugin.sh
index 0fe9f46..d86e98f 100644
--- a/jenkins/gerrit-bazel-build-plugin.sh
+++ b/jenkins/gerrit-bazel-build-plugin.sh
@@ -10,11 +10,17 @@
fi
TARGETS=$(echo "{targets}" | sed -e 's/{{name}}/{name}/g')
+TEST_TARGET=$(grep -2 junit_tests plugins/{name}/BUILD | grep -o 'name = "[^"]*"' | cut -d '"' -f 2)
. set-java.sh 8
bazel build --spawn_strategy=standalone --genrule_strategy=standalone $TARGETS
+if [ "$TEST_TARGET" != "" ]
+then
+ bazel test plugins/{name}:$TEST_TARGET
+fi
+
for JAR in $(find bazel-genfiles/plugins/{name} -name {name}*.jar)
do
PLUGIN_VERSION=$(git describe --always origin/{branch})