Browse Source

(Commandfile) add code coverage reporting

Stefan Siegl 8 years ago
parent
commit
5ca50f5253
3 changed files with 22 additions and 2 deletions
  1. 2 0
      .gitignore
  2. 19 1
      Commandfile
  3. 1 1
      Vagrantfile

+ 2 - 0
.gitignore

@@ -40,3 +40,5 @@ tests/*.mem
 
 .vagrant
 tmp-php.ini
+
+coverage_report/**

+ 19 - 1
Commandfile

@@ -20,7 +20,7 @@ command 'configure',
 command 'clean',
   description: 'executes "make clean"',
   script: <<-eof
-    cd /data/build; `which gmake || which make` clean
+    cd /data/build; `which gmake || which make` clean; rm -rf /data/v8js/coverage_report /data/build/gcov.info
     eof
 
 command 'build',
@@ -49,3 +49,21 @@ chain 'all',
     { command: 'build' },
     { command: 'test' }
   ]
+
+command 'coverage_report',
+  description: 'capture *.gcda files and generate code coverage report',
+  script: <<-eof
+    cd /data/build
+    lcov --base-directory=.libs --directory=.libs --directory ../v8js/ --no-external --capture --output-file gcov.info
+    genhtml --legend --output-directory ../v8js/coverage_report/ --title "V8Js Code Coverage" gcov.info
+    eof
+
+chain 'coverage',
+  commands: [
+    { command: 'phpize' },
+    { command: 'configure', argv: ['--cxxflags=-O0 --coverage', '--ldflags=--coverage'] },
+    { command: 'clean' },
+    { command: 'build' },
+    { command: 'test' },
+    { command: 'coverage_report' },
+  ]

+ 1 - 1
Vagrantfile

@@ -27,7 +27,7 @@ Vagrant.configure("2") do |config|
       gpg --armor --export 7F438280EF8D349F | apt-key add -
 
       apt-get update
-      apt-get install -y software-properties-common gdb tmux git tig curl apache2-utils
+      apt-get install -y software-properties-common gdb tmux git tig curl apache2-utils lcov
 
       add-apt-repository ppa:ondrej/php
       add-apt-repository ppa:pinepain/libv8-#{version}