3 set -o nounset ## (set -u) error exit on attempts to deref undefined variable
4 set -o errexit ## (set -e) error exit if subcommand returns nonzero
6 CFB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 INSTR_DIR="${CFB_ROOT}/../instr"
11 find "${CFB_ROOT}/prod" -name "*.java" | xargs javac -g -Xlint:deprecation
12 find "${CFB_ROOT}/test" -name "*.java" | xargs javac -g -classpath ${CFB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
14 if [ -d "${CFB_ROOT}/bin" ]; then
15 rm -rf "${CFB_ROOT}/bin"
17 mkdir -p "${CFB_ROOT}/bin"
19 find . -name '*.class' | xargs tar zcf "${CFB_ROOT}/tmp_classes.tar.gz"
21 tar zxf "${CFB_ROOT}/tmp_classes.tar.gz"
22 if [ -e "${CFB_ROOT}/tmp_classes.tar.gz" ]; then
23 rm "${CFB_ROOT}/tmp_classes.tar.gz"
28 echo Cleaning old coverage files...
29 for x in "${INSTR_DIR}" report
31 if [ -d "${x}" ]; then
36 for x in result.xml template.xml
45 java -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${CFB_ROOT}/prod"
48 echo Running unit tests...
51 for x in `cd ${CFB_ROOT}/test; find . -name '*Test.class'`
54 TEST_CLASS=`echo ${x} | sed s:\^./:: | cut -d . -f 1 | sed s:/:.:g`
55 #echo TEST_CLASS ${TEST_CLASS}
56 TESTS="${TEST_CLASS} ${TESTS}"
59 echo First run: locale es_ES, timezone Europe/Madrid
60 java -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
62 echo Second run: server default locale and timezone
63 java -Djcov.template=${CFB_ROOT}/template.xml -Djcov.file=${CFB_ROOT}/result.xml -classpath "${INSTR_DIR}:${CFB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${CFB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
66 echo Generating HTML Report...
68 java -jar "${CFB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${CFB_ROOT}/prod" -log.level FINE result.xml
72 find "${CFB_ROOT}/prod" -type f -name '*.class' -exec rm {} \;
73 find "${CFB_ROOT}/test" -type f -name '*.class' -exec rm {} \;