Skip to content
Snippets Groups Projects
Commit e7af8e05 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

Merge branch 'feature/martin/tests/more-coverage-options' into 'master'

Add option to produce xml and json reports

See merge request frama-c/frama-c!4360
parents 7686917c d14dbe9d
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,9 @@ COMMIT= ...@@ -33,6 +33,9 @@ COMMIT=
TESTS= TESTS=
SAVE= SAVE=
COVER= COVER=
HTML=
XML=
JSON=
DUNE_ALIAS= DUNE_ALIAS=
DUNE_OPT= DUNE_OPT=
...@@ -78,7 +81,9 @@ function Usage ...@@ -78,7 +81,9 @@ function Usage
echo " -s|--save save dune logs into $DUNE_LOG" echo " -s|--save save dune logs into $DUNE_LOG"
echo " -v|--verbose print executed commands" echo " -v|--verbose print executed commands"
echo " -j|--jobs <jobs> run no more than <jobs> commands simultaneously." echo " -j|--jobs <jobs> run no more than <jobs> commands simultaneously."
echo " --coverage compute test coverage" echo " --coverage compute test coverage in html format"
echo " --coverage-xml compute test coverage in Cobertura XML format"
echo " --coverage-json compute test coverage in Coveralls JSON format"
echo " -h|--help print this help" echo " -h|--help print this help"
echo "" echo ""
echo "VARIABLES" echo "VARIABLES"
...@@ -197,7 +202,15 @@ do ...@@ -197,7 +202,15 @@ do
;; ;;
"--coverage") "--coverage")
COVER=yes COVER=yes
DUNE_OPT+="--workspace dev/dune-workspace.cover " HTML=yes
;;
"--coverage-xml")
COVER=yes
XML=yes
;;
"--coverage-json")
COVER=yes
JSON=yes
;; ;;
"-n"|"--name") "-n"|"--name")
ALIAS_NAME=$2 ALIAS_NAME=$2
...@@ -287,6 +300,7 @@ function PrepareCoverage ...@@ -287,6 +300,7 @@ function PrepareCoverage
then then
Cmd rm -rf _coverage Cmd rm -rf _coverage
Cmd rm -rf _bisect Cmd rm -rf _bisect
Cmd mkdir _coverage
Cmd mkdir _bisect Cmd mkdir _bisect
fi fi
} }
...@@ -296,7 +310,18 @@ function GenerateCoverage ...@@ -296,7 +310,18 @@ function GenerateCoverage
if [ "$COVER" = "yes" ] ; if [ "$COVER" = "yes" ] ;
then then
Head "Generating coverage in _coverage ..." Head "Generating coverage in _coverage ..."
Cmd bisect-ppx-report html --coverage-path=_bisect if [ "$HTML" = "yes" ] ;
then
Cmd bisect-ppx-report html --coverage-path=_bisect
fi
if [ "$XML" = "yes" ] ;
then
Cmd bisect-ppx-report cobertura --coverage-path=_bisect _coverage/coverage_report.xml
fi
if [ "$JSON" = "yes" ] ;
then
Cmd bisect-ppx-report coveralls --coverage-path=_bisect _coverage/coverage_report.json
fi
fi fi
} }
...@@ -325,7 +350,9 @@ function PrepareTests ...@@ -325,7 +350,9 @@ function PrepareTests
[ "$DUNE_LOG" = "" ] || rm -rf $DUNE_LOG [ "$DUNE_LOG" = "" ] || rm -rf $DUNE_LOG
function RunAlias function RunAlias
{ {
if [ "$COVER" = "yes" ]; then
DUNE_OPT+="--workspace dev/dune-workspace.cover "
fi
Head "Running tests..." Head "Running tests..."
if [ "$DUNE_LOG" = "" ]; then if [ "$DUNE_LOG" = "" ]; then
Run dune build $DUNE_OPT $@ Run dune build $DUNE_OPT $@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment