Mercurial > hg > Members > anatofuz > nqp-cbc-tools
changeset 10:4f704a718752
add coverage
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 09 Nov 2018 17:47:21 +0900 |
parents | 1fda58f3b60f |
children | ee60403fc119 |
files | dotest_coverage.pl |
diffstat | 1 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dotest_coverage.pl Fri Nov 09 17:47:21 2018 +0900 @@ -0,0 +1,42 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use File::Find; + +my $top_dir = "/mnt/dalmore-home/one/src/Perl6/nqp/vmtest"; +my $MOAR = "/mnt/dalmore-home/one/src/Perl6/moar"; +my $NQP_ORIGINAL = "/mnt/dalmore-home/one/src/MoarVM_Original/nqp"; +our $sum_tests =0; +our $sum_ok = 0; + +sub coverage_test { + my $filename = $_; + return if ($filename !~ /\.moarvm/); + + my ($start,$end,$counter); + + for my $line (`$MOAR --libpath=${NQP_ORIGINAL}/gen/moar/stage2 $filename`){ + if ($line =~ (\d+)\.\.(\d+)){ + $start = $1; + $end = $2; + } + + if ($lien =~ /ok \d+/){ + $counter++; + } + } + + $sum_ok += $counter; + $sum_tests += $end; +} + +find(\&coverage_test,$top_dir); + +print "ok ==> $sum_ok\n"; +print "total ==> $sum_tests\n"; + +my $parset = $sum_ok/$sum_tests; + +$parset *=100; + +print "parsent $parset%\n";