From 5ca50f5253d2d55313afabf776c9ed42241ba1e5 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sun, 12 Mar 2017 18:13:35 +0100 Subject: [PATCH] (Commandfile) add code coverage reporting --- .gitignore | 2 ++ Commandfile | 20 +++++++++++++++++++- Vagrantfile | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4c95294..7099cae 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ tests/*.mem .vagrant tmp-php.ini + +coverage_report/** diff --git a/Commandfile b/Commandfile index c7ec082..63f8290 100644 --- a/Commandfile +++ b/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' }, + ] diff --git a/Vagrantfile b/Vagrantfile index bb5930b..4bcdc86 100644 --- a/Vagrantfile +++ b/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}