@@ -20,7 +20,7 @@ def backup_gcda_files(gcda_files)
2020end
2121
2222def run_lcov ( *args )
23- system ( "lcov" , "--rc" , "lcov_branch_coverage=1" , *args )
23+ system ( "lcov" , "--rc" , "geninfo_unexecuted_blocks=1" , "--rc" , " lcov_branch_coverage=1", *args , exception : true )
2424end
2525
2626$info_files = [ ]
@@ -41,11 +41,19 @@ def run_lcov_remove(info_src, info_out)
4141 ext/-test-/*
4242 ext/nkf/nkf-utf8/nkf.c
4343 ) . each { |f | dirs << File . join ( File . dirname ( __dir__ ) , f ) }
44- run_lcov ( "--remove" , info_src , *dirs , "-o" , info_out )
44+ run_lcov ( "--ignore-errors" , "unused" , "-- remove", info_src , *dirs , "-o" , info_out )
4545end
4646
4747def run_genhtml ( info , out )
48- system ( "genhtml" , "--branch-coverage" , "--ignore-errors" , "source" , info , "-o" , out )
48+ base_dir = File . dirname ( File . dirname ( __dir__ ) )
49+ ignore_errors = %w( source unmapped category ) . reject do |a |
50+ Open3 . capture3 ( "genhtml" , "--ignore-errors" , a ) [ 1 ] . include? ( "unknown argument for --ignore-errors" )
51+ end
52+ system ( "genhtml" ,
53+ "--branch-coverage" ,
54+ "--prefix" , base_dir ,
55+ *ignore_errors . flat_map { |a | [ "--ignore-errors" , a ] } ,
56+ info , "-o" , out , exception : true )
4957end
5058
5159def gen_rb_lcov ( file )
0 commit comments