Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add python coverage
authorAugustin Degomme <degomme@wasabi>
Wed, 9 Jan 2019 10:48:30 +0000 (11:48 +0100)
committerAugustin Degomme <degomme@wasabi>
Wed, 9 Jan 2019 10:49:29 +0000 (11:49 +0100)
May crash with some examples, such as actor-create..

examples/python/actor-create/actor-create.tesh
examples/python/actor-daemon/actor-daemon.tesh
examples/python/actor-join/actor-join.tesh
examples/python/actor-kill/actor-kill.tesh
examples/python/actor-lifetime/actor-lifetime.tesh
examples/python/actor-migrate/actor-migrate.tesh
examples/python/actor-suspend/actor-suspend.tesh
examples/python/actor-yield/actor-yield.tesh
examples/python/exec-basic/exec-basic.tesh
tools/jenkins/Coverage.sh

index c93449d..17f7c8b 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env tesh
 
-$ python3 ${srcdir:=.}/actor-create.py
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${srcdir:=.}/actor-create.py
 > [Tremblay:sender1:(2) 0.000000] [python/INFO] Hello s4u, I have something to send
 > [Jupiter:sender2:(3) 0.000000] [python/INFO] Hello s4u, I have something to send
 > [Fafard:sender:(4) 0.000000] [python/INFO] Hello s4u, I have something to send
index 71c19ce..1513f14 100644 (file)
@@ -2,7 +2,7 @@
 
 p Testing the process daemonization feature
 
-$ python3 ${bindir:=.}/actor-daemon.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-daemon.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.000000] (worker@Boivin) Let's do some work (for 10 sec on Boivin).
 > [  0.000000] (daemon@Tremblay) Hello from the infinite loop
 > [  3.000000] (daemon@Tremblay) Hello from the infinite loop
index 4fc199e..f9c8ffc 100644 (file)
@@ -1,4 +1,4 @@
-$ python3 ${bindir:=.}/actor-join.py ${platfdir}/small_platform.xml
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-join.py ${platfdir}/small_platform.xml
 > [Tremblay:master:(1) 0.000000] [python/INFO] Start sleeper
 > [Tremblay:sleeper from master:(2) 0.000000] [python/INFO] Sleeper started
 > [Tremblay:master:(1) 0.000000] [python/INFO] Join the sleeper (timeout 2)
index 422e40a..40a39a7 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env tesh
 
-$ python3 ${bindir:=.}/actor-kill.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-kill.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.000000] (killer@Tremblay) Hello!
 > [  0.000000] (victim A@Fafard) Hello!
 > [  0.000000] (victim A@Fafard) Suspending myself
index 4e52a38..c5b8121 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env tesh
 
-$ python3 ${bindir:=.}/actor-lifetime.py ${platfdir}/cluster_backbone.xml actor-lifetime_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-lifetime.py ${platfdir}/cluster_backbone.xml actor-lifetime_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:sleeper@node-0.simgrid.org) Hello! I go to sleep.
 > [  0.000000] (2:sleeper@node-1.simgrid.org) Hello! I go to sleep.
 > [  2.000000] (3:sleeper@node-0.simgrid.org) Hello! I go to sleep.
index 4ec3fca..5c3ac05 100644 (file)
@@ -2,7 +2,7 @@
 
 p Testing the actor migration feature 
 
-$ python3 ${bindir:=.}/actor-migrate.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-migrate.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.000000] (worker@Fafard) Let's move to Boivin to execute 1177.14 Mflops (5sec on Boivin and 5sec on Jacquelin)
 > [  5.000000] (monitor@Boivin) After 5 seconds, move the process to Jacquelin
 > [ 10.000000] (worker@Jacquelin) I wake up on Jacquelin. Let's suspend a bit
index e648398..226b54b 100644 (file)
@@ -3,7 +3,7 @@
 p Testing the suspend/resume feature of SimGrid
 
 ! output sort 19
-$ python3 ${bindir:=.}/actor-suspend.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/actor-suspend.py ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.000000] (dream_master@Boivin) Let's create a lazy guy.
 > [  0.000000] (Lazy@Boivin) Nobody's watching me ? Let's go to sleep.
 > [  0.000000] (dream_master@Boivin) Let's wait a little bit...
index 6cbf8ba..33b6c3f 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/env tesh
 
-$ python3 ${srcdir:=.}/actor-yield.py ${platfdir}/small_platform_fatpipe.xml ${srcdir:=.}/../../s4u/actor-yield/s4u-actor-yield_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${srcdir:=.}/actor-yield.py ${platfdir}/small_platform_fatpipe.xml ${srcdir:=.}/../../s4u/actor-yield/s4u-actor-yield_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:yielder@Tremblay) I yielded 10 times. Goodbye now!
 > [  0.000000] (2:yielder@Ruby) I yielded 15 times. Goodbye now!
index ce25f09..fffc31b 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env tesh
 
 p Start remote processes 
-$ python3 ${srcdir}/exec-basic.py ${platfdir}/small_platform.xml 
+$ python3 ${PYTHON_TOOL_OPTIONS:=} ${srcdir}/exec-basic.py ${platfdir}/small_platform.xml 
 > [Tremblay:privileged:(2) 0.001500] [python/INFO] Done.
 > [Tremblay:executor:(1) 0.002000] [python/INFO] Done.
index b268cdb..fca49e6 100755 (executable)
@@ -48,6 +48,8 @@ NUMPROC="$(nproc)" || NUMPROC=1
 
 cd $BUILDFOLDER
 rm -rf java_cov*
+rm -rf jacoco_cov*
+rm -rf python_cov*
 rm -rf xml_coverage.xml
 
 ctest -D ExperimentalStart || true
@@ -64,6 +66,8 @@ cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \
 JACOCO_PATH="/usr/local/share/jacoco"
 export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
 
+export PYTHON_TOOL_OPTIONS="/usr/bin/python3-coverage run --branch"
+
 ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
 ctest -D ExperimentalCoverage || true
 
@@ -78,13 +82,28 @@ if [ -f Testing/TAG ] ; then
     #convert jacoco reports in xml ones
     ant -f $WORKSPACE/tools/jenkins/jacoco.xml -Dexamplesrcdir=$WORKSPACE -Dbuilddir=$BUILDFOLDER/${sourcepath} -Djarfile=$BUILDFOLDER/simgrid.jar -Djacocodir=${JACOCO_PATH}/lib
     #convert jacoco xml reports in cobertura xml reports
-    cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $WORKSPACE/java_coverage_${i}.xml
+    cover2cover.py $BUILDFOLDER/${sourcepath}/report.xml .. ../src/bindings/java src/bindings/java > $BUILDFOLDER/java_coverage_${i}.xml
+    #save jacoco xml report as sonar only allows it 
+    mv $BUILDFOLDER/${sourcepath}/report.xml $BUILDFOLDER/jacoco_coverage_${i}.xml
+    i=$((i + 1))
+  done
+
+  cd $WORKSPACE
+
+  files=$( find . -size +1c -name ".coverage" )
+  i=0
+  for file in $files
+  do
+    sourcepath=$( dirname $file )
+    #convert python coverage reports in xml ones
+    cd $sourcepath
+    /usr/bin/python3-coverage xml -i -o $BUILDFOLDER/python_coverage_${i}.xml
+    cd $WORKSPACE
     i=$((i + 1))
   done
 
-   cd $WORKSPACE
    #convert all gcov reports to xml cobertura reports
-   gcovr -r . --xml-pretty -e teshsuite -u -o $WORKSPACE/xml_coverage.xml
+   gcovr -r . --xml-pretty -e teshsuite -u -o $BUILDFOLDER/xml_coverage.xml
    xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl build/Testing/$( head -n 1 < build/Testing/TAG )/Test.xml > CTestResults_memcheck.xml
 
    #generate sloccount report
@@ -93,13 +112,19 @@ if [ -f Testing/TAG ] ; then
    #upload files to codacy. CODACY_PROJECT_TOKEN must be setup !
    if ! [ -z $CODACY_PROJECT_TOKEN ]
    then 
-     for report in $WORKSPACE/java_cov*
+     for report in $BUILDFOLDER/java_cov*
      do
        if [ ! -e "$report" ]; then continue; fi
        java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l Java -r $report --partial
      done
      java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar final
-     java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l C -f -r $WORKSPACE/xml_coverage.xml
-     java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l CPP -f -r $WORKSPACE/xml_coverage.xml
+     for report in $BUILDFOLDER/python_cov*
+     do
+       if [ ! -e "$report" ]; then continue; fi
+       java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l Python -r $report --partial
+     done
+     java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar final
+     java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l C -f -r $BUILDFOLDER/xml_coverage.xml
+     java -jar /home/ci/codacy-coverage-reporter-*-assembly.jar report -l CPP -f -r $BUILDFOLDER/xml_coverage.xml
    fi
 fi