You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/21 23:31:54 UTC

[GitHub] marcoabreu closed pull request #11344: [MXNET-561] Add test coverage reporting

marcoabreu closed pull request #11344: [MXNET-561] Add test coverage reporting
URL: https://github.com/apache/incubator-mxnet/pull/11344
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index 00000000000..f9f3e8622b2
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1,28 @@
+# Codecov.io configuration file
+codecov:
+  notify:
+    require_ci_to_pass: yes
+
+coverage:
+  precision: 2
+  round: down
+  range: "70...100"
+
+  status:
+    project: yes
+    patch: yes
+    changes: no
+
+parsers:
+  gcov:
+    branch_detection:
+      conditional: yes
+      loop: yes
+      method: no
+      macro: no
+
+# Disable comments for now to gather data in the background
+comment: false
+#  layout: "header, diff"
+#  behavior: default
+#  require_changes: no
diff --git a/Jenkinsfile b/Jenkinsfile
index 56fbf3d74af..cc839171f86 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -92,6 +92,10 @@ echo ${libs} | sed -e 's/,/ /g' | xargs md5sum
 """
 }
 
+def publish_test_coverage() {
+    sh 'curl -s https://codecov.io/bash | bash -s -'
+}
+
 def collect_test_results_unix(original_file_name, new_file_name) {
     echo 'Saving python test results for ' + new_file_name
     // Rename file to make it distinguishable. Unfortunately, it's not possible to get STAGE_NAME in a parallel stage
@@ -493,6 +497,7 @@ try {
             init_git()
             unpack_lib('cpu')
             python2_ut('ubuntu_cpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python2_cpu_unittest.xml')
             collect_test_results_unix('nosetests_train.xml', 'nosetests_python2_cpu_train.xml')
@@ -508,6 +513,7 @@ try {
             init_git()
             unpack_lib('cpu')
             python3_ut('ubuntu_cpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python3_cpu_unittest.xml')
             collect_test_results_unix('nosetests_quantization.xml', 'nosetests_python3_cpu_quantization.xml')
@@ -522,6 +528,7 @@ try {
             init_git()
             unpack_lib('gpu', mx_lib)
             python2_gpu_ut('ubuntu_gpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python2_gpu.xml')
           }
@@ -535,6 +542,7 @@ try {
             init_git()
             unpack_lib('gpu', mx_lib)
             python3_gpu_ut('ubuntu_gpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python3_gpu.xml')
           }
@@ -549,6 +557,7 @@ try {
               init_git()
               unpack_lib('gpu', mx_lib)
               docker_run('ubuntu_gpu', 'unittest_ubuntu_python2_quantization_gpu', true)
+              publish_test_coverage()
             } finally {
               collect_test_results_unix('nosetests_quantization_gpu.xml', 'nosetests_python2_quantize_gpu.xml')
             }
@@ -564,6 +573,7 @@ try {
               init_git()
               unpack_lib('gpu', mx_lib)
               docker_run('ubuntu_gpu', 'unittest_ubuntu_python3_quantization_gpu', true)
+              publish_test_coverage()
             } finally {
               collect_test_results_unix('nosetests_quantization_gpu.xml', 'nosetests_python3_quantize_gpu.xml')
             }
@@ -578,6 +588,7 @@ try {
             init_git()
             unpack_lib('mkldnn_cpu', mx_mkldnn_lib)
             python2_ut('ubuntu_cpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python2_mkldnn_cpu_unittest.xml')
             collect_test_results_unix('nosetests_train.xml', 'nosetests_python2_mkldnn_cpu_train.xml')
@@ -593,6 +604,7 @@ try {
             init_git()
             unpack_lib('mkldnn_gpu', mx_mkldnn_lib)
             python2_gpu_ut('ubuntu_gpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python2_mkldnn_gpu.xml')
           }
@@ -606,6 +618,7 @@ try {
             init_git()
             unpack_lib('mkldnn_cpu', mx_mkldnn_lib)
             python3_ut_mkldnn('ubuntu_cpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python3_mkldnn_cpu_unittest.xml')
             collect_test_results_unix('nosetests_mkl.xml', 'nosetests_python3_mkldnn_cpu_mkl.xml')
@@ -620,6 +633,7 @@ try {
             init_git()
             unpack_lib('mkldnn_gpu', mx_mkldnn_lib)
             python3_gpu_ut('ubuntu_gpu')
+            publish_test_coverage()
           } finally {
             collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python3_mkldnn_gpu.xml')
           }
@@ -634,6 +648,7 @@ try {
               init_git()
               unpack_lib('centos7_cpu')
               docker_run('centos7_cpu', 'unittest_centos7_cpu', false)
+              publish_test_coverage()
             } finally {
               collect_test_results_unix('nosetests_unittest.xml', 'nosetests_python3_centos7_cpu_unittest.xml')
               collect_test_results_unix('nosetests_train.xml', 'nosetests_python3_centos7_cpu_train.xml')
@@ -650,6 +665,7 @@ try {
               init_git()
               unpack_lib('centos7_gpu')
               docker_run('centos7_gpu', 'unittest_centos7_gpu', true)
+              publish_test_coverage()
             } finally {
               collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python3_centos7_gpu.xml')
             }
@@ -664,6 +680,7 @@ try {
             init_git()
             unpack_lib('cpu', mx_dist_lib)
             docker_run('ubuntu_cpu', 'unittest_ubuntu_cpu_scala', false)
+            publish_test_coverage()
           }
         }
       }
@@ -675,6 +692,7 @@ try {
             init_git()
             unpack_lib('gpu', mx_dist_lib)
             docker_run('ubuntu_gpu', 'unittest_ubuntu_gpu_scala', true)
+            publish_test_coverage()
           }
         }
       }
@@ -686,6 +704,7 @@ try {
             init_git()
             unpack_lib('cpu')
             docker_run('ubuntu_cpu', 'unittest_ubuntu_cpugpu_perl', false)
+            publish_test_coverage()
           }
         }
       }
@@ -697,6 +716,7 @@ try {
             init_git()
             unpack_lib('gpu')
             docker_run('ubuntu_gpu', 'unittest_ubuntu_cpugpu_perl', true)
+            publish_test_coverage()
           }
         }
       }
@@ -708,6 +728,7 @@ try {
             init_git()
             unpack_lib('cmake_gpu', mx_cmake_lib)
             docker_run('ubuntu_gpu', 'unittest_ubuntu_gpu_cpp', true)
+            publish_test_coverage()
           }
         }
       }
@@ -719,6 +740,7 @@ try {
             init_git()
             unpack_lib('cmake_mkldnn_gpu', mx_cmake_mkldnn_lib)
             docker_run('ubuntu_gpu', 'unittest_ubuntu_gpu_cpp', true)
+            publish_test_coverage()
           }
         }
       }
@@ -730,6 +752,7 @@ try {
             init_git()
             unpack_lib('cpu')
             docker_run('ubuntu_cpu', 'unittest_ubuntu_cpu_R', false)
+            publish_test_coverage()
           }
         }
       }
@@ -741,6 +764,7 @@ try {
             init_git()
             unpack_lib('gpu')
             docker_run('ubuntu_gpu', 'unittest_ubuntu_gpu_R', true)
+            publish_test_coverage()
           }
         }
       }
@@ -871,6 +895,7 @@ try {
             init_git()
             unpack_lib('cpu')
             docker_run('ubuntu_cpu', 'integrationtest_ubuntu_cpu_onnx', false)
+            publish_test_coverage()
           }
         }
       }
@@ -882,6 +907,7 @@ try {
             init_git()
             unpack_lib('gpu')
             docker_run('ubuntu_gpu', 'integrationtest_ubuntu_gpu_python', true)
+            publish_test_coverage()
           }
         }
       }
@@ -893,6 +919,7 @@ try {
             init_git()
             unpack_lib('gpu')
             docker_run('ubuntu_gpu', 'integrationtest_ubuntu_gpu_caffe', true)
+            publish_test_coverage()
           }
         }
       }
@@ -914,6 +941,7 @@ try {
             unstash 'cpp_test_score'
             unstash 'cpp_test_optimizer'
             docker_run('ubuntu_gpu', 'integrationtest_ubuntu_gpu_cpp_package', true)
+            publish_test_coverage()
           }
         }
       }
@@ -925,6 +953,7 @@ try {
             init_git()
             unpack_lib('gpu')
             docker_run('ubuntu_gpu', 'integrationtest_ubuntu_gpu_dist_kvstore', true)
+            publish_test_coverage()
           }
         }
       }
diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh
index 6cefeea9fbc..7029689680e 100755
--- a/ci/docker/runtime_functions.sh
+++ b/ci/docker/runtime_functions.sh
@@ -22,6 +22,8 @@
 
 set -ex
 
+NOSE_COVERAGE_ARGUMENTS="--with-coverage --cover-inclusive --cover-xml --cover-branches --cover-package=mxnet"
+
 clean_repo() {
     set -ex
     git clean -xfd
@@ -543,9 +545,9 @@ unittest_ubuntu_python2_cpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1  # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-2.7 --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
-    nosetests-2.7 --with-xunit --xunit-file nosetests_train.xml --verbose tests/python/train
-    nosetests-2.7 --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
+    nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
+    nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_train.xml --verbose tests/python/train
+    nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
 }
 
 unittest_ubuntu_python3_cpu() {
@@ -555,8 +557,8 @@ unittest_ubuntu_python3_cpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1  # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-3.4 --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
-    nosetests-3.4 --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization.xml --verbose tests/python/quantization
 }
 
 unittest_ubuntu_python3_cpu_mkldnn() {
@@ -566,8 +568,8 @@ unittest_ubuntu_python3_cpu_mkldnn() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1  # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-3.4 --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
-    nosetests-3.4 --with-xunit --xunit-file nosetests_mkl.xml --verbose tests/python/mkl
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_mkl.xml --verbose tests/python/mkl
 }
 
 unittest_ubuntu_python2_gpu() {
@@ -577,7 +579,7 @@ unittest_ubuntu_python2_gpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1  # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-2.7 --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
+    nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
 }
 
 tutorialtest_ubuntu_python3_gpu() {
@@ -589,7 +591,7 @@ tutorialtest_ubuntu_python3_gpu() {
     export PYTHONPATH=/work/mxnet/python/
     export MXNET_TUTORIAL_TEST_KERNEL=python3
     cd /work/mxnet/tests/tutorials
-    nosetests-3.4 --with-xunit --xunit-file nosetests_tutorials.xml test_tutorials.py --nologcapture
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_tutorials.xml test_tutorials.py --nologcapture
 }
 
 tutorialtest_ubuntu_python2_gpu() {
@@ -601,7 +603,7 @@ tutorialtest_ubuntu_python2_gpu() {
     export PYTHONPATH=/work/mxnet/python/
     export MXNET_TUTORIAL_TEST_KERNEL=python2
     cd /work/mxnet/tests/tutorials
-    nosetests-3.4 --with-xunit --xunit-file nosetests_tutorials.xml test_tutorials.py --nologcapture
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_tutorials.xml test_tutorials.py --nologcapture
 }
 
 unittest_ubuntu_python3_gpu() {
@@ -611,7 +613,7 @@ unittest_ubuntu_python3_gpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1 # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-3.4 --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
 }
 
 # quantization gpu currently only runs on P3 instances
@@ -623,7 +625,7 @@ unittest_ubuntu_python2_quantization_gpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1  # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-2.7 --with-xunit --xunit-file nosetests_quantization_gpu.xml --verbose tests/python/quantization_gpu
+    nosetests-2.7 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization_gpu.xml --verbose tests/python/quantization_gpu
 }
 
 # quantization gpu currently only runs on P3 instances
@@ -635,7 +637,7 @@ unittest_ubuntu_python3_quantization_gpu() {
     # https://github.com/apache/incubator-mxnet/issues/10026
     #export MXNET_MKLDNN_DEBUG=1 # Ignored if not present
     export MXNET_STORAGE_FALLBACK_LOG_VERBOSE=0
-    nosetests-3.4 --with-xunit --xunit-file nosetests_quantization_gpu.xml --verbose tests/python/quantization_gpu
+    nosetests-3.4 $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_quantization_gpu.xml --verbose tests/python/quantization_gpu
 }
 
 unittest_ubuntu_cpu_scala() {
@@ -681,14 +683,14 @@ unittest_ubuntu_gpu_R() {
 unittest_centos7_cpu() {
     set -ex
     cd /work/mxnet
-    python3.6 -m "nose" --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
-    python3.6 -m "nose" --with-xunit --xunit-file nosetests_train.xml --verbose tests/python/train
+    python3.6 -m "nose" $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_unittest.xml --verbose tests/python/unittest
+    python3.6 -m "nose" $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_train.xml --verbose tests/python/train
 }
 
 unittest_centos7_gpu() {
     set -ex
     cd /work/mxnet
-    python3.6 -m "nose" --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
+    python3.6 -m "nose" $NOSE_COVERAGE_ARGUMENTS --with-xunit --xunit-file nosetests_gpu.xml --verbose tests/python/gpu
 }
 
 integrationtest_ubuntu_cpu_onnx() {
@@ -742,7 +744,7 @@ test_ubuntu_cpu_python2() {
     cd /work/mxnet/python
     pip install -e .
     cd /work/mxnet
-    python -m "nose" --with-timer --verbose tests/python/unittest
+    python -m "nose" $NOSE_COVERAGE_ARGUMENTS --with-timer --verbose tests/python/unittest
     popd
 }
 
@@ -758,7 +760,7 @@ test_ubuntu_cpu_python3() {
     pip3 install nose nose-timer
     pip3 install -e .
     cd /work/mxnet
-    python3 -m "nose" --with-timer --verbose tests/python/unittest
+    python3 -m "nose" $NOSE_COVERAGE_ARGUMENTS --with-timer --verbose tests/python/unittest
 
     popd
 }
diff --git a/tests/python/train/common.py b/tests/python/train/common.py
index 38718fa7817..13020d9ad4b 100644
--- a/tests/python/train/common.py
+++ b/tests/python/train/common.py
@@ -20,4 +20,4 @@
 sys.path.append(os.path.join(curr_path, '../common/'))
 
 import models
-import get_data
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services