From 7d18c7a25a54a89d83c89508fa15b192ac979325 Mon Sep 17 00:00:00 2001 From: Jeroen van Zundert Date: Sun, 10 Mar 2019 21:48:06 +0000 Subject: [PATCH 1/4] Skip files and lines. --- Project.toml | 1 + src/Coverage.jl | 98 ++++++- test/data/Coverage.jl.cov | 247 ------------------ .../data/folder_with_exclusions/.coverage.yml | 8 + .../data/folder_with_exclusions/testparser.jl | 28 ++ .../testparser_excluded.jl} | 0 test/data/{ => no_exclusions}/Coverage.jl | 0 test/data/no_exclusions/testparser.jl | 28 ++ test/data/tracefiles/expected.info | 2 +- test/runtests.jl | 33 ++- 10 files changed, 177 insertions(+), 268 deletions(-) delete mode 100644 test/data/Coverage.jl.cov create mode 100644 test/data/folder_with_exclusions/.coverage.yml create mode 100644 test/data/folder_with_exclusions/testparser.jl rename test/data/{testparser.jl => folder_with_exclusions/testparser_excluded.jl} (100%) rename test/data/{ => no_exclusions}/Coverage.jl (100%) create mode 100644 test/data/no_exclusions/testparser.jl diff --git a/Project.toml b/Project.toml index 4415e48..49e6971 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d" +YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" [compat] HTTP = ">=0.8.0" diff --git a/src/Coverage.jl b/src/Coverage.jl index cf308de..c08959a 100644 --- a/src/Coverage.jl +++ b/src/Coverage.jl @@ -6,6 +6,7 @@ ####################################################################### module Coverage using LibGit2 + import YAML export process_folder, process_file export clean_folder, clean_file @@ -136,10 +137,9 @@ module Coverage @info "Coverage.process_cov: processing $file" coverage = CovCount[] for line in eachline(file) - # Columns 1:9 contain the coverage count - cov_segment = line[1:9] # If coverage is NA, there will be a dash - push!(coverage, cov_segment[9] == '-' ? nothing : parse(Int, cov_segment)) + # Columns 1:9 contain the coverage count + push!(coverage, line[9] == '-' ? nothing : parse(Int, line[1:9])) end full_coverage = merge_coverage_counts(full_coverage, coverage) end @@ -156,8 +156,8 @@ module Coverage This function takes an existing result and updates the coverage vector in-place to mark source lines that may be inside a function. """ - amend_coverage_from_src!(coverage::Vector{CovCount}, srcname) = amend_coverage_from_src!(FileCoverage(srcname, read(srcname, String), coverage)) - function amend_coverage_from_src!(fc::FileCoverage) + amend_coverage_from_src!(coverage::Vector{CovCount}, srcname, excluded_line_patterns::Vector{Regex}=Regex[]) = amend_coverage_from_src!(FileCoverage(srcname, read(srcname, String), coverage), excluded_line_patterns) + function amend_coverage_from_src!(fc::FileCoverage, excluded_line_patterns::Vector{Regex}=Regex[]) # The code coverage results produced by Julia itself report some # lines as "null" (cannot be run), when they could have been run # but were never compiled (thus should be 0). @@ -201,11 +201,25 @@ module Coverage end end end + + # check for excluded lines + l = 1 + let io = IOBuffer(content) + while !eof(io) + line = readline(io) + # Verify that there is no line exclusion tag + if any(pat -> occursin(pat, line[10:end]), excluded_line_patterns) + @debug "removing with regex $excluded_line_patterns line $l: $line" + coverage[l] = nothing + end + l += 1 + end + end nothing end """ - process_file(filename[, folder]) -> FileCoverage + process_file(filename[, folder], excluded_line_patterns) -> FileCoverage Given a .jl file and its containing folder, produce a corresponding `FileCoverage` instance from the source and matching coverage files. If the @@ -213,12 +227,12 @@ module Coverage """ function process_file end - function process_file(filename, folder) + function process_file(filename, folder, excluded_line_patterns::Vector{Regex}=Regex[]) @info "Coverage.process_file: Detecting coverage for $filename" coverage = process_cov(filename, folder) fc = FileCoverage(filename, read(filename, String), coverage) if get(ENV, "DISABLE_AMEND_COVERAGE_FROM_SRC", "no") != "yes" - amend_coverage_from_src!(fc) + amend_coverage_from_src!(fc, excluded_line_patterns) end return fc end @@ -231,28 +245,88 @@ module Coverage statistics for all the files contained within. Will recursively traverse child folders. Default folder is "src", which is useful for the primary case where Coverage is called from the root directory of a package. + + In case there is a `.coverage.yml` present within `folder`, the indicated + file and line exclusion tags will be used. """ function process_folder(folder="src") - @info "Coverage.process_folder: Searching $folder for .jl files..." + # get coverage file + excl_file = joinpath(folder, ".coverage.yml") + excluded_files, excluded_line_patterns = get_exclusions(excl_file) + return process_folder(folder, excluded_files, excluded_line_patterns) + end + function process_folder(folder, excluded_files, excluded_line_patterns) + @info """Coverage.process_folder: Searching $folder for .jl files...""" source_files = FileCoverage[] files = readdir(folder) + for file in files - fullfile = joinpath(folder, file) + if file in excluded_files + @info "Coverage.process_folder: Skipping $file, in exclusion list" + continue + end + + fullfile = joinpath(folder,file) if isfile(fullfile) # Is it a Julia file? if splitext(fullfile)[2] == ".jl" - push!(source_files, process_file(fullfile, folder)) + push!(source_files, process_file(fullfile, folder, excluded_line_patterns)) else @debug "Coverage.process_folder: Skipping $file, not a .jl file" end elseif isdir(fullfile) # If it is a folder, recursively traverse - append!(source_files, process_folder(fullfile)) + # pass on the same excluded_files & excluded_line_patterns from root + append!(source_files, process_folder(fullfile, excluded_files, excluded_line_patterns)) end end return source_files end + """ + get_exclusions(file::AbstractString) -> (excluded_files, excluded_line_patterns) + + Parse the provided file as a coverage exclusions file (named + `.coverage.yml`). This file should have a format like the following: + ``` + # exclude files in the directory with these names + exclude_files: + - foo.jl + - bar.jl + + # exclude any lines that match any of the following regexes + exclude_patterns: + - "[NO COVERAGE]" + ``` + Note that both `exclude_files` and `exclude_patterns` should be lists. + """ + function get_exclusions(file) + excluded_files = Set{String}() + excluded_line_patterns = Regex[] + if isfile(file) + # read file + config = YAML.load_file(file) + + # if exclude_files entry is present, try to parse + if haskey(config, "exclude_files") + if !isa(config["exclude_files"], Array{String}) + error("'exclude_files' in $file must be a list of strings") + end + excluded_files = config["exclude_files"] + end + + # if exclude_patterns entry is present, try to parse + if haskey(config, "exclude_patterns") + if !isa(config["exclude_patterns"], Array{String}) + error("'exclude_patterns' in $file must be a list of strings") + end + excluded_line_patterns = Regex.(config["exclude_patterns"]) + end + end + + return excluded_files, excluded_line_patterns + end + # matches julia coverage files with and without the PID iscovfile(filename) = occursin(r"\.jl\.?[0-9]*\.cov$", filename) # matches a coverage file for the given sourcefile. They can be full paths diff --git a/test/data/Coverage.jl.cov b/test/data/Coverage.jl.cov deleted file mode 100644 index 2e21531..0000000 --- a/test/data/Coverage.jl.cov +++ /dev/null @@ -1,247 +0,0 @@ - - ####################################################################### - 6 # This file is not the result of a real test execution, but is used as - - # comparison input during tests of '*.cov' input and against - 7 # the tracefile 'expected.info' to verify LCOV.readfile/LCOV.writefile - - ####################################################################### - - module Coverage - - - - import JuliaParser.Parser - - - - # process_cov - - # Given a .cov file, return the counts for each line, where the - - # lines that can't be counted are denoted with a -1 - - export process_cov, amend_coverage_from_src!, coverage_file, coverage_folder, analyze_malloc - - function process_cov(filename) - 8 if !isfile(filename) - 3 srcname, ext = splitext(filename) - 3 lines = open(srcname) do fp - 3 readlines(fp) - - end - 3 coverage = Array(Union(Nothing,Int), length(lines)) - 3 return fill!(coverage, nothing) - - end - 5 fp = open(filename, "r") - 5 lines = readlines(fp) - 5 num_lines = length(lines) - 5 coverage = Array(Union(Nothing,Int), num_lines) - 5 for i = 1:num_lines - 570 cov_segment = lines[i][1:9] - 570 coverage[i] = cov_segment[9] == '-' ? nothing : int(cov_segment) - - end - 5 close(fp) - 5 return coverage - - end - - function amend_coverage_from_src!(coverage, srcname) - - # To make sure things stay in sync, parse the file position corresonding to each new line - 8 linepos = Int[] - 8 open(srcname) do io - 8 while !eof(io) - 753 push!(linepos, position(io)) - 753 readline(io) - - end - 8 push!(linepos, position(io)) - - end - 8 open(srcname) do io - 8 while !eof(io) - 38 pos = position(io) - 38 linestart = minimum(searchsorted(linepos, pos)) - 38 ast = Parser.parse(io) - 35 isa(ast, Expr) || continue - 24 flines = function_body_lines(ast) - 24 if !isempty(flines) - 17 flines += linestart-1 - 17 for l in flines - 44 if coverage[l] == nothing - 18 coverage[l] = 0 - - end - - end - - end - - end - - end - 5 coverage - - end - - function coverage_file(filename) - 1 results = Coveralls.process_file(filename) - 1 coverage = results["coverage"] - 25 tot = sum(x->x!=nothing, coverage) - 25 covered = sum(x->x!=nothing && x>0, coverage) - 1 covered, tot - - end - - function coverage_folder(folder="src") - 1 results = Coveralls.process_folder(folder) - 1 tot = covered = 0 - 1 for item in results - 2 coverage = item["coverage"] - 275 tot += sum(x->x!=nothing, coverage) - 275 covered += sum(x->x!=nothing && x>0, coverage) - - end - 1 covered, tot - - end - - - 24 function_body_lines(ast) = function_body_lines!(Int[], ast, false) - 339 function_body_lines!(flines, arg, infunction) = flines - - function function_body_lines!(flines, node::LineNumberNode, infunction) - 46 line = node.line - 46 if infunction - 18 push!(flines, line) - - end - 46 flines - - end - - function function_body_lines!(flines, ast::Expr, infunction) - 332 if ast.head == :line - 32 line = ast.args[1] - 32 if infunction - 26 push!(flines, line) - - end - 32 return flines - - end - 300 infunction |= Base.Cartesian.isfuncexpr(ast) - 300 for arg in ast.args - 693 flines = function_body_lines!(flines, arg, infunction) - - end - 300 flines - - end - - - - export Coveralls - - module Coveralls - - using Requests - - using Coverage - - using JSON - - - - # coveralls_process_file - - # Given a .jl file, return the Coveralls.io dictionary for this - - # file by reading in the file and its matching .cov. Don't convert - - # to JSON yet, just return dictionary. - - # https://coveralls.io/docs/api - - # { - - # "name" : "$filename" - - # "source": "...\n....\n...." - - # "coverage": [null, 1, null] - - # } - - export process_file - - function process_file(filename) - 8 return @compat Dict("name" => filename, - - "source" => readall(filename), - - "coverage" => amend_coverage_from_src!(process_cov(filename*".cov"), filename)) - - end - - - - # coveralls_process_src - - # Recursively walk through a Julia package's src/ folder - - # and collect coverage statistics - - export process_folder - - function process_folder(folder="src") - 1 source_files=Any[] - 1 filelist = readdir(folder) - 1 for file in filelist - 5 fullfile = joinpath(folder,file) - 5 println(fullfile) - 5 if isfile(fullfile) - 5 try - 5 new_sf = process_file(fullfile) - 2 push!(source_files, new_sf) - - catch e - - # if !isa(e,SystemError) - - # rethrow(e) - - # end - - # Skip - 3 println("Skipped $fullfile") - - end - 0 else isdir(fullfile) - 0 append!(source_files, process_folder(fullfile)) - - end - - end - 1 return source_files - - end - - - - # submit - - # Submit coverage to Coveralls.io - - # https://coveralls.io/docs/api - - # { - - # "service_job_id": "1234567890", - - # "service_name": "travis-ci", - - # "source_files": [ - - # { - - # "name": "example.rb", - - # "source": "def four\n 4\nend", - - # "coverage": [null, 1, null] - - # }, - - # { - - # "name": "lib/two.rb", - - # "source": "def seven\n eight\n nine\nend", - - # "coverage": [null, 1, 0, null] - - # } - - # ] - - # } - - export submit, submit_token - - function submit(source_files) - - data = @compat Dict("service_job_id" => ENV["TRAVIS_JOB_ID"], - - "service_name" => "travis-ci", - - "source_files" => source_files) - - r = Requests.post(URI("https://coveralls.io/api/v1/jobs"), files = - - [FileParam(JSON.json(data),"application/json","json_file","coverage.json")]) - - dump(r.data) - - end - - - - function submit_token(source_files) - - data = @compat Dict("repo_token" => ENV["REPO_TOKEN"], - - "source_files" => source_files) - - r = post(URI("https://coveralls.io/api/v1/jobs"), files = - - [FileParam(JSON.json(data),"application/json","json_file","coverage.json")]) - - dump(r.data) - - end - - end # module Coveralls - - - - - - ## Analyzing memory allocation - - immutable MallocInfo - - bytes::Int - - filename::UTF8String - - linenumber::Int - - end - - - 547 sortbybytes(a::MallocInfo, b::MallocInfo) = a.bytes < b.bytes - - - - function analyze_malloc_files(files) - 2 bc = MallocInfo[] - 2 for filename in files - 1 open(filename) do file - 1 for (i,ln) in enumerate(eachline(file)) - 249 tln = strip(ln) - 249 if !isempty(tln) && isdigit(tln[1]) - 79 s = split(tln) - 79 b = parseint(s[1]) - 79 push!(bc, MallocInfo(b, filename, i)) - - end - - end - - end - - end - 2 sort(bc, lt=sortbybytes) - - end - - - - function find_malloc_files(dirs) - 1 files = ByteString[] - 1 for dir in dirs - 1 filelist = readdir(dir) - 1 for file in filelist - 5 file = joinpath(dir, file) - 5 if isdir(file) - 0 append!(files, find_malloc_files(file)) - 5 elseif endswith(file, "jl.mem") - 1 push!(files, file) - - end - - end - - end - 1 files - - end - - find_malloc_files(file::ByteString) = find_malloc_files([file]) - - - 1 analyze_malloc(dirs) = analyze_malloc_files(find_malloc_files(dirs)) - 1 analyze_malloc(dir::ByteString) = analyze_malloc([dir]) - - - - # Support Unix command line usage like `julia Coverage.jl $(find ~/.julia/v0.3 -name "*.jl.mem")` - - if !isinteractive() - - bc = analyze_malloc_files(ARGS) - - println(bc) - - end - - end - - diff --git a/test/data/folder_with_exclusions/.coverage.yml b/test/data/folder_with_exclusions/.coverage.yml new file mode 100644 index 0000000..a645df3 --- /dev/null +++ b/test/data/folder_with_exclusions/.coverage.yml @@ -0,0 +1,8 @@ +# exclude files in the directory with these names +exclude_files: + - testparser_excluded.jl + - bar.jl + +# exclude any lines that match any of the following regexes +exclude_patterns: + - "[NO COVERAGE]" diff --git a/test/data/folder_with_exclusions/testparser.jl b/test/data/folder_with_exclusions/testparser.jl new file mode 100644 index 0000000..5d11406 --- /dev/null +++ b/test/data/folder_with_exclusions/testparser.jl @@ -0,0 +1,28 @@ +# This line should have no code +f2(x) = 2x # [NO COVERAGE] +if true + f3(x) = 3x +end +f4(x) = 4x; f5(x) = 5x +# This line should have no code +@doc """ +`f6(x)` multiplies `x` by 6 +""" +f6(x) = 6x +# This line should have no code +@doc """ +`f7(x)` multiplies `x` by 7 +""" +function f7(x) + 7x +end + +f8(x) = 8x + +# This line should have no code +module TestModule +end + +# This line should have no code +baremodule TestBareModule +end diff --git a/test/data/testparser.jl b/test/data/folder_with_exclusions/testparser_excluded.jl similarity index 100% rename from test/data/testparser.jl rename to test/data/folder_with_exclusions/testparser_excluded.jl diff --git a/test/data/Coverage.jl b/test/data/no_exclusions/Coverage.jl similarity index 100% rename from test/data/Coverage.jl rename to test/data/no_exclusions/Coverage.jl diff --git a/test/data/no_exclusions/testparser.jl b/test/data/no_exclusions/testparser.jl new file mode 100644 index 0000000..9b10d85 --- /dev/null +++ b/test/data/no_exclusions/testparser.jl @@ -0,0 +1,28 @@ +# This line should have no code +f2(x) = 2x +if true + f3(x) = 3x +end +f4(x) = 4x; f5(x) = 5x +# This line should have no code +@doc """ +`f6(x)` multiplies `x` by 6 +""" +f6(x) = 6x +# This line should have no code +@doc """ +`f7(x)` multiplies `x` by 7 +""" +function f7(x) + 7x +end + +f8(x) = 8x + +# This line should have no code +module TestModule +end + +# This line should have no code +baremodule TestBareModule +end diff --git a/test/data/tracefiles/expected.info b/test/data/tracefiles/expected.info index 677f6bb..8f8ad42 100644 --- a/test/data/tracefiles/expected.info +++ b/test/data/tracefiles/expected.info @@ -1,4 +1,4 @@ -SF:test/data/Coverage.jl +SF:test/data/no_exclusions/Coverage.jl DA:2,6 DA:4,7 DA:15,8 diff --git a/test/runtests.jl b/test/runtests.jl index 6e30bf9..c96ea84 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -49,7 +49,7 @@ end cd(dirname(@__DIR__)) do datadir = joinpath("test", "data") # Process a saved set of coverage data... - r = process_file(joinpath(datadir, "Coverage.jl")) + r = process_file(joinpath(datadir, "no_exclusions", "Coverage.jl")) # ... and memory data malloc_results = analyze_malloc(datadir) @@ -67,7 +67,7 @@ end @test String(take!(lcov)) == expected # LCOV.writefile is a short-hand for writing to a file - lcov = joinpath(datadir, "lcov_output_temp.info") + lcov = joinpath(datadir, "no_exclusions", "lcov_output_temp.info") LCOV.writefile(lcov, FileCoverage[r]) expected = read(joinpath(datadir, "tracefiles", "expected.info"), String) if Sys.iswindows() @@ -79,7 +79,7 @@ end rm(lcov) # test that reading the LCOV file gives the same data - lcov = LCOV.readfolder(datadir) + lcov = LCOV.readfolder(joinpath(datadir)) @test length(lcov) == 1 r2 = lcov[1] r2_filename = r2.filename @@ -108,14 +108,14 @@ end @test r4.coverage == lcov2[2].coverage # Test a file from scratch - srcname = joinpath("test", "data", "testparser.jl") + srcname = joinpath("test", "data", "no_exclusions", "testparser.jl") covname = srcname*".cov" # clean out any previous coverage files. Don't use clean_folder because we # need to preserve the pre-baked coverage file Coverage.jl.cov clean_file(srcname) cmdstr = "include($(repr(srcname))); using Test; @test f2(2) == 4" run(`$(Base.julia_cmd()) --startup-file=no --code-coverage=user -e $cmdstr`) - r = process_file(srcname, datadir) + r = process_file(srcname, joinpath(datadir, "no_exclusions")) target = Coverage.CovCount[nothing, 2, nothing, 0, nothing, 0, nothing, nothing, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, 0, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing] target_disabled = map(x -> (x !== nothing && x > 0) ? x : nothing, target) @@ -123,10 +123,10 @@ end covtarget = (sum(x->x !== nothing && x > 0, target), sum(x->x !== nothing, target)) @test get_summary(r) == covtarget - @test get_summary(process_folder(datadir)) == (98, 106) + @test get_summary(process_folder(joinpath(datadir, "no_exclusions"))) == (98, 106) r_disabled = withenv("DISABLE_AMEND_COVERAGE_FROM_SRC" => "yes") do - process_file(srcname, datadir) + process_file(srcname, joinpath(datadir, "no_exclusions")) end @test r_disabled.coverage == target_disabled @@ -142,7 +142,7 @@ end # test clean_folder # set up the test folder datadir_temp = joinpath("test", "data_temp") - cp(datadir, datadir_temp) + cp(joinpath(datadir, "no_exclusions"), datadir_temp) # run clean_folder clean_folder(datadir_temp) # .cov files should be deleted @@ -151,6 +151,23 @@ end @test isfile(joinpath(datadir_temp, "Coverage.jl")) # tear down test data rm(datadir_temp; recursive=true) + + close(open("fakefile", read=true, write=true, create=true, truncate=false, append=false)) + @test isempty(Coverage.process_cov("fakefile", datadir)) + rm("fakefile") + + # test exclusions parsing + datadir_exclusions = joinpath(datadir, "folder_with_exclusions") + excl_files, excl_lines = Coverage.get_exclusions(joinpath(datadir_exclusions, ".coverage.yml")) + @test excl_files == ["testparser_excluded.jl", "bar.jl"] + @test excl_lines == [Regex("[NO COVERAGE]")] + + # test that excluded files are indeed skipped + out = process_folder(datadir_exclusions) + @test length(out) == 1 # only testparser.jl should be here, not testparser_excluded.jl + + # verify that the second line is now indeed skipped + @test out[1].coverage[2] === nothing end end From 21e1922617c049e605446c9bb01edf18142b8cfa Mon Sep 17 00:00:00 2001 From: Jeroen van Zundert Date: Sun, 14 Jul 2019 21:24:00 +0100 Subject: [PATCH 2/4] Remove indexing into line. Co-Authored-By: Jameson Nash --- src/Coverage.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Coverage.jl b/src/Coverage.jl index c08959a..20485a6 100644 --- a/src/Coverage.jl +++ b/src/Coverage.jl @@ -208,7 +208,7 @@ module Coverage while !eof(io) line = readline(io) # Verify that there is no line exclusion tag - if any(pat -> occursin(pat, line[10:end]), excluded_line_patterns) + if any(pat -> occursin(pat, line), excluded_line_patterns) @debug "removing with regex $excluded_line_patterns line $l: $line" coverage[l] = nothing end From 9b29d860f605a8fb101ed88d4423468f72b2bf44 Mon Sep 17 00:00:00 2001 From: Jeroen van Zundert Date: Sun, 14 Jul 2019 21:41:57 +0100 Subject: [PATCH 3/4] Add .coverage.yml file usage to README. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index dfeb8e8..3c767c2 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,19 @@ For AppVeyor, add this to `.appveyor.yml`: environment: DISABLE_AMEND_COVERAGE_FROM_SRC: yes +To help the coverage tracking, one can put a `.coverage.yml` in the source code +folder to exclude particular files, or remove particular lines of code from the +coverage statistic. The file should look like this: +``` +# exclude files in the directory with these names exclude_files: + - file_to_be_excluded.jl + - another_file_to_excluded.jl + +# exclude any lines that match any of the following regexes exclude_patterns: + - "[NO COVERAGE]" +``` +The exclusions are applied to all files in the folder as well as sub folders. + ## Some Julia packages using Coverage.jl *Pull requests to add your package welcome (or open an issue)* From 4599a20351d3288619b501d62ce034dd3145967e Mon Sep 17 00:00:00 2001 From: Jeroen van Zundert Date: Thu, 15 Aug 2019 21:55:09 +0100 Subject: [PATCH 4/4] Fix tests --- test/runtests.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index c96ea84..894158c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -49,7 +49,7 @@ end cd(dirname(@__DIR__)) do datadir = joinpath("test", "data") # Process a saved set of coverage data... - r = process_file(joinpath(datadir, "no_exclusions", "Coverage.jl")) + r = process_file(joinpath(datadir, "no_exclusions", "Coverage.jl"), joinpath(datadir, "no_exclusions")) # ... and memory data malloc_results = analyze_malloc(datadir) @@ -62,7 +62,7 @@ end expected = read(joinpath(datadir, "tracefiles", "expected.info"), String) if Sys.iswindows() expected = replace(expected, "\r\n" => "\n") - expected = replace(expected, "SF:test/data/Coverage.jl\n" => "SF:test\\data\\Coverage.jl\n") + expected = replace(expected, "SF:test/data/no_exclusions/Coverage.jl\n" => "SF:test\\data\\no_exclusions\\Coverage.jl\n") end @test String(take!(lcov)) == expected @@ -72,7 +72,7 @@ end expected = read(joinpath(datadir, "tracefiles", "expected.info"), String) if Sys.iswindows() expected = replace(expected, "\r\n" => "\n") - expected = replace(expected, "SF:test/data/Coverage.jl\n" => "SF:test\\data\\Coverage.jl\n") + expected = replace(expected, "SF:test/data/no_exclusions/Coverage.jl\n" => "SF:test\\data\\no_exclusions\\Coverage.jl\n") end @test String(read(lcov)) == expected # tear down test file