2020-11-30 07:53:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-05-11 06:50:36 +00:00
|
|
|
##
|
|
|
|
## To include test coverage data, use -Djacoco.skip=false parameter.
|
|
|
|
## This will gather the coverage data into target/jacoco.exec file and
|
|
|
|
## generate the coverage report for each module in keycloak/model/*/target/site.
|
|
|
|
##
|
|
|
|
|
2020-11-30 07:53:31 +00:00
|
|
|
cd "$(dirname $0)"
|
2021-03-11 15:55:13 +00:00
|
|
|
mvn -version
|
2020-11-30 07:53:31 +00:00
|
|
|
|
|
|
|
EXIT_CODE=0
|
|
|
|
mvn clean
|
|
|
|
for I in `perl -ne 'print "$1\n" if (m,<id>([^<]+)</id>,)' pom.xml`; do
|
|
|
|
echo "========"
|
|
|
|
echo "======== Profile $I"
|
|
|
|
echo "========"
|
2022-01-19 21:21:57 +00:00
|
|
|
mvn -B -Dsurefire.timeout=600 test "-P$I" "$@" 2>&1 | tee /tmp/surefire.out
|
|
|
|
EXIT_CODE=$[$EXIT_CODE + ${PIPESTATUS[0]}]
|
2020-11-30 07:53:31 +00:00
|
|
|
mv target/surefire-reports "target/surefire-reports-$I"
|
2022-01-19 21:21:57 +00:00
|
|
|
perl -ne "print '::error::| $I | Timed out.' . \"\n\" if (/There was a timeout in the fork/)" /tmp/surefire.out
|
2020-11-30 07:53:31 +00:00
|
|
|
done
|
|
|
|
|
2021-05-11 06:50:36 +00:00
|
|
|
## If the jacoco file is present, generate reports in each of the model projects
|
|
|
|
[ -f target/jacoco.exec ] && mvn -f ../../model org.jacoco:jacoco-maven-plugin:0.8.7:report -Djacoco.dataFile="$(readlink -f target/jacoco.exec)"
|
|
|
|
|
2021-02-26 10:45:38 +00:00
|
|
|
for I in `perl -ne 'print "$1\n" if (m,<id>([^<]+)</id>,)' pom.xml`; do
|
|
|
|
grep -A 1 --no-filename '<<<' "target/surefire-reports-$I"/*.txt | perl -pe "print '::error::| $I | ';"
|
|
|
|
done
|
|
|
|
|
2020-11-30 07:53:31 +00:00
|
|
|
exit $EXIT_CODE
|