Bring the coverage analysis of the unit test suite back into a runnable state.
authorChris Jaekl <cejaekl@yahoo.com>
Tue, 28 Nov 2017 13:03:32 +0000 (22:03 +0900)
committerChris Jaekl <cejaekl@yahoo.com>
Tue, 28 Nov 2017 13:03:32 +0000 (22:03 +0900)
It seems that my system upgrade a few weeks ago (which changed the default JVM from 8 to 9)
has made jcov unhappy.  I'm adding a reference to JAVA_HOME, so that I can (temporarily!)
force Java 8 until I figure out what to do about jcov and Java 9.

Also disabling the 2nd run (under server local locale) because jcov seems unhappy about
that, too, at the moment, for reasons that remain unclear.

This change should bring things back to a runnable state.

cov.sh

diff --git a/cov.sh b/cov.sh
index a9fe22c662900aff624490fc446031892e01eed6..2007b1f5b62174b9e40abedf9b9b2f43580f97be 100755 (executable)
--- a/cov.sh
+++ b/cov.sh
@@ -1,11 +1,13 @@
 #!/bin/bash
 WEB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 INSTR_DIR="${WEB_ROOT}/../instr"
 #!/bin/bash
 WEB_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 INSTR_DIR="${WEB_ROOT}/../instr"
+JAVA=${JAVA_HOME}/bin/java
+JAVAC=${JAVA_HOME}/bin/javac
 
 #####################
 echo Compiling...
 
 #####################
 echo Compiling...
-find "${WEB_ROOT}/prod" -name "*.java" | xargs javac -Xlint:deprecation
-find "${WEB_ROOT}/test" -name "*.java" | xargs javac -classpath ${WEB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
+find "${WEB_ROOT}/prod" -name "*.java" | xargs ${JAVAC} -Xlint:deprecation
+find "${WEB_ROOT}/test" -name "*.java" | xargs ${JAVAC} -classpath ${WEB_ROOT}/prod:${CLASSPATH} -Xlint:deprecation
 
 #####################
 echo Cleaning old coverage files...
 
 #####################
 echo Cleaning old coverage files...
@@ -25,7 +27,7 @@ done
 
 #####################
 echo Instrumenting...
 
 #####################
 echo Instrumenting...
-java -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${WEB_ROOT}/prod"
+${JAVA} -classpath "${CLASSPATH}" -jar `pwd`/jcov/jcov.jar Instr -t template.xml -o "${INSTR_DIR}" -type all "${WEB_ROOT}/prod"
 
 #####################
 echo Running unit tests...
 
 #####################
 echo Running unit tests...
@@ -40,12 +42,12 @@ do
 done
 
 echo First run:  locale es_ES, timezone Europe/Madrid
 done
 
 echo First run:  locale es_ES, timezone Europe/Madrid
-java -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+${JAVA} -Duser.language=es -Duser.country=ES -Duser.timezone=Europe/Madrid -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
 
 
-echo Second run:  server default locale and timezone
-java -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
+#echo Second run:  server default locale and timezone
+#java -Djcov.template=${WEB_ROOT}/template.xml -Djcov.file=${WEB_ROOT}/result.xml -classpath "${INSTR_DIR}:${WEB_ROOT}/test:${CLASSPATH}:/usr/share/java/junit.jar:${WEB_ROOT}/jcov/jcov_file_saver.jar" org.junit.runner.JUnitCore ${TESTS}
 
 #####################
 echo Generating HTML Report...
 
 
 #####################
 echo Generating HTML Report...
 
-java -jar "${WEB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${WEB_ROOT}/prod" -log.level FINE result.xml
+${JAVA} -jar "${WEB_ROOT}/jcov/jcov.jar" RepGen -sourcepath "${WEB_ROOT}/prod" -log.level FINE result.xml