@@ -666,7 +666,7 @@ function updatehook(pkgs::Vector)
666
666
""" )
667
667
end
668
668
669
- function test! (pkg:: String , errs:: Vector{String} , notests:: Vector{String} )
669
+ function test! (pkg:: String , errs:: Vector{String} , notests:: Vector{String} ; coverage :: Bool = false )
670
670
const reqs_path = abspath (pkg," test" ," REQUIRE" )
671
671
if isfile (reqs_path)
672
672
const tests_require = Reqs. parse (reqs_path)
@@ -680,7 +680,12 @@ function test!(pkg::String, errs::Vector{String}, notests::Vector{String})
680
680
info (" Testing $pkg " )
681
681
cd (dirname (test_path)) do
682
682
try
683
- run (` $JULIA_HOME /julia $test_path ` )
683
+ if coverage
684
+ cmd = ` $JULIA_HOME /julia --code-coverage $test_path `
685
+ else
686
+ cmd = ` $JULIA_HOME /julia $test_path `
687
+ end
688
+ run (cmd)
684
689
info (" $pkg tests passed" )
685
690
catch err
686
691
warnbanner (err, label= " [ ERROR: $pkg ]" )
@@ -693,11 +698,11 @@ function test!(pkg::String, errs::Vector{String}, notests::Vector{String})
693
698
resolve ()
694
699
end
695
700
696
- function test (pkgs:: Vector{String} )
701
+ function test (pkgs:: Vector{String} ; coverage :: Bool = false )
697
702
errs = String[]
698
703
notests = String[]
699
704
for pkg in pkgs
700
- test! (pkg,errs,notests)
705
+ test! (pkg,errs,notests; coverage = coverage )
701
706
end
702
707
if ! isempty (errs) || ! isempty (notests)
703
708
messages = String[]
@@ -707,6 +712,6 @@ function test(pkgs::Vector{String})
707
712
end
708
713
end
709
714
710
- test () = test (sort! (String[keys (installed ())... ]))
715
+ test (;coverage :: Bool = false ) = test (sort! (String[keys (installed ())... ]); coverage = coverage )
711
716
712
717
end # module
0 commit comments