test_coverage: put exclude_path value between double quotes

We don't want the shell to interpret the contents of exclude_path,
but we want it all used as a single string for `--ignore-filename-regex`,
so let's put it between double quotes.

An example of failure is when we have | , as in this case:

  $ CARGO_TARGET_DIR=./cov_build cargo llvm-cov test --summary-only \
      --ignore-filename-regex crates/virtio-bindings|crates/virtio-queue/src/mock.rs \
      --workspace  --features=virtio-blk/backend-stdio
  bash: crates/virtio-queue/src/mock.rs: Permission denied
  ...
  error: failed to generate report: process didn't exit successfully: ...
  (exit status: 74)

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
Stefano Garzarella
2023-10-19 09:58:04 +02:00
committed by Patrick Roy
parent b6483ebe81
commit 9699b4dfe3

View File

@@ -82,7 +82,7 @@ def _get_current_coverage(coverage_config, no_cleanup, test_scope):
additional_exclude_path = coverage_config["exclude_path"]
if additional_exclude_path:
llvm_cov_command += f" --ignore-filename-regex {additional_exclude_path}"
llvm_cov_command += f" --ignore-filename-regex \"{additional_exclude_path}\""
if test_scope == pytest.workspace:
llvm_cov_command += " --workspace "