I'm using cargo-make to collect profile data for code coverage analysis from a rust project in a cargo workspace. I crated this makefile in the workspace directory.
Makefile.toml
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["calc_engine_function_lib"]
COV_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage"
[tasks.cov-test]
env = { "CARGO_INCREMENTAL"="0", "RUSTFLAGS"="-Cinstrument-coverage", "LLVM_PROFILE_FILE"="${COV_DIRECTORY}/coverage-%p-%m.profraw" }
command = "cargo"
args = ["test" ]
[tasks.cov-merge]
command = "llvm-profdata"
args = ["merge", "-sparse", "${COV_DIRECTORY}/*.profraw", "-o", "${COV_DIRECTORY}/coverage.profdata"]
[tasks.cov]
dependencies = [
"clean",
"cov-test",
"cov-merge"
]
Here's what I get...
~/dev/calc_engine_workspace % cargo make cov
...
<snip>
[cargo-make][1] INFO - Execute Command: "llvm-profdata" "merge" "-sparse" "/Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw" "-o" "/Users/rslosberg/dev/calc_engine_workspace/target/coverage/coverage.profdata"
error: /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw: No such file or directory
Error while executing command, exit code: 1
[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 5 - Error while executing command, exit code: 105
[cargo-make] WARN - Build Failed.
Note the error from the llvm-profdata command "error: /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw: No such file or directory."
I verified that the files are there. And even ran the same command manually and verified that it created the output file...
~/dev/calc_engine_workspace % ls /Users/rslosberg/dev/calc_engine_workspace/target/coverage
coverage-93908-1368609239801235687_0.profraw coverage-93950-10216933870365406234_0.profraw coverage-93960-18408715756534919819_0.profraw
coverage-93909-5830244668369093928_0.profraw coverage-93950-2886698713092331560_0.profraw coverage-93961-13469185440639262121_0.profraw
coverage-93910-15057653203294252332_0.profraw coverage-93951-10216933870365406234_0.profraw coverage-93962-3673913671000486936_0.profraw
coverage-93941-2886698713092331560_0.profraw coverage-93951-2886698713092331560_0.profraw coverage-93963-10216933870365406234_0.profraw
coverage-93942-2886698713092331560_0.profraw coverage-93954-10216933870365406234_0.profraw coverage-93963-2886698713092331560_0.profraw
coverage-93945-2886698713092331560_0.profraw coverage-93954-2886698713092331560_0.profraw coverage-93964-10216933870365406234_0.profraw
coverage-93946-2886698713092331560_0.profraw coverage-93955-10216933870365406234_0.profraw coverage-93964-2886698713092331560_0.profraw
coverage-93947-2886698713092331560_0.profraw coverage-93955-2886698713092331560_0.profraw coverage-93967-15205823438128830545_0.profraw
~/dev/calc_engine_workspace % llvm-profdata merge -sparse /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw -o /Users/rslosberg/dev/calc_engine_workspace/target/coverage/coverage.profdata
~/dev/calc_engine_workspace % ls /Users/rslosberg/dev/calc_engine_workspace/target/coverage
coverage-93908-1368609239801235687_0.profraw coverage-93950-2886698713092331560_0.profraw coverage-93962-3673913671000486936_0.profraw
coverage-93909-5830244668369093928_0.profraw coverage-93951-10216933870365406234_0.profraw coverage-93963-10216933870365406234_0.profraw
coverage-93910-15057653203294252332_0.profraw coverage-93951-2886698713092331560_0.profraw coverage-93963-2886698713092331560_0.profraw
coverage-93941-2886698713092331560_0.profraw coverage-93954-10216933870365406234_0.profraw coverage-93964-10216933870365406234_0.profraw
coverage-93942-2886698713092331560_0.profraw coverage-93954-2886698713092331560_0.profraw coverage-93964-2886698713092331560_0.profraw
coverage-93945-2886698713092331560_0.profraw coverage-93955-10216933870365406234_0.profraw coverage-93967-15205823438128830545_0.profraw
coverage-93946-2886698713092331560_0.profraw coverage-93955-2886698713092331560_0.profraw coverage.profdata
coverage-93947-2886698713092331560_0.profraw coverage-93960-18408715756534919819_0.profraw
coverage-93950-10216933870365406234_0.profraw coverage-93961-13469185440639262121_0.profraw
I'm using cargo-make to collect profile data for code coverage analysis from a rust project in a cargo workspace. I crated this makefile in the workspace directory.
Makefile.toml
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_WORKSPACE_SKIP_MEMBERS = ["calc_engine_function_lib"]
COV_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage"
[tasks.cov-test]
env = { "CARGO_INCREMENTAL"="0", "RUSTFLAGS"="-Cinstrument-coverage", "LLVM_PROFILE_FILE"="${COV_DIRECTORY}/coverage-%p-%m.profraw" }
command = "cargo"
args = ["test" ]
[tasks.cov-merge]
command = "llvm-profdata"
args = ["merge", "-sparse", "${COV_DIRECTORY}/*.profraw", "-o", "${COV_DIRECTORY}/coverage.profdata"]
[tasks.cov]
dependencies = [
"clean",
"cov-test",
"cov-merge"
]
Here's what I get...
~/dev/calc_engine_workspace % cargo make cov
...
<snip>
[cargo-make][1] INFO - Execute Command: "llvm-profdata" "merge" "-sparse" "/Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw" "-o" "/Users/rslosberg/dev/calc_engine_workspace/target/coverage/coverage.profdata"
error: /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw: No such file or directory
Error while executing command, exit code: 1
[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 5 - Error while executing command, exit code: 105
[cargo-make] WARN - Build Failed.
Note the error from the llvm-profdata command "error: /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw: No such file or directory."
I verified that the files are there. And even ran the same command manually and verified that it created the output file...
~/dev/calc_engine_workspace % ls /Users/rslosberg/dev/calc_engine_workspace/target/coverage
coverage-93908-1368609239801235687_0.profraw coverage-93950-10216933870365406234_0.profraw coverage-93960-18408715756534919819_0.profraw
coverage-93909-5830244668369093928_0.profraw coverage-93950-2886698713092331560_0.profraw coverage-93961-13469185440639262121_0.profraw
coverage-93910-15057653203294252332_0.profraw coverage-93951-10216933870365406234_0.profraw coverage-93962-3673913671000486936_0.profraw
coverage-93941-2886698713092331560_0.profraw coverage-93951-2886698713092331560_0.profraw coverage-93963-10216933870365406234_0.profraw
coverage-93942-2886698713092331560_0.profraw coverage-93954-10216933870365406234_0.profraw coverage-93963-2886698713092331560_0.profraw
coverage-93945-2886698713092331560_0.profraw coverage-93954-2886698713092331560_0.profraw coverage-93964-10216933870365406234_0.profraw
coverage-93946-2886698713092331560_0.profraw coverage-93955-10216933870365406234_0.profraw coverage-93964-2886698713092331560_0.profraw
coverage-93947-2886698713092331560_0.profraw coverage-93955-2886698713092331560_0.profraw coverage-93967-15205823438128830545_0.profraw
~/dev/calc_engine_workspace % llvm-profdata merge -sparse /Users/rslosberg/dev/calc_engine_workspace/target/coverage/*.profraw -o /Users/rslosberg/dev/calc_engine_workspace/target/coverage/coverage.profdata
~/dev/calc_engine_workspace % ls /Users/rslosberg/dev/calc_engine_workspace/target/coverage
coverage-93908-1368609239801235687_0.profraw coverage-93950-2886698713092331560_0.profraw coverage-93962-3673913671000486936_0.profraw
coverage-93909-5830244668369093928_0.profraw coverage-93951-10216933870365406234_0.profraw coverage-93963-10216933870365406234_0.profraw
coverage-93910-15057653203294252332_0.profraw coverage-93951-2886698713092331560_0.profraw coverage-93963-2886698713092331560_0.profraw
coverage-93941-2886698713092331560_0.profraw coverage-93954-10216933870365406234_0.profraw coverage-93964-10216933870365406234_0.profraw
coverage-93942-2886698713092331560_0.profraw coverage-93954-2886698713092331560_0.profraw coverage-93964-2886698713092331560_0.profraw
coverage-93945-2886698713092331560_0.profraw coverage-93955-10216933870365406234_0.profraw coverage-93967-15205823438128830545_0.profraw
coverage-93946-2886698713092331560_0.profraw coverage-93955-2886698713092331560_0.profraw coverage.profdata
coverage-93947-2886698713092331560_0.profraw coverage-93960-18408715756534919819_0.profraw
coverage-93950-10216933870365406234_0.profraw coverage-93961-13469185440639262121_0.profraw
Share
Improve this question
asked Feb 5 at 17:42
Ron SlosbergRon Slosberg
53 bronze badges
1 Answer
Reset to default 0The problem is that glob expansion (i.e. going from *.profraw
to a list of a.profraw b.profraw
…) is ususally done by the shell. Here you don't have a shell, so llvm-profdata
is looking for a file that is named literally *.profraw
.
One easy way to work around the issue is to pass the command to a shell for execution, i.e. something like this:
[tasks.cov-merge]
command = "/bin/sh"
args = [ "-c", "llvm-profdata merge -sparse ${COV_DIRECTORY}/*.profraw -o ${COV_DIRECTORY}/coverage.profdata" ]