b2 icon indicating copy to clipboard operation
b2 copied to clipboard

Use of testing.launcher on PowerShell with parameters

Open Flamefire opened this issue 3 years ago • 0 comments

Environment and version details

  • Operating System+version: Windows
  • Shell: PowerShell

Brief problem description

To collect coverage data on Windows it is required to (e.g.) use a wrapper like OpenCppCoverage to run the binaries. This (for Boost.CI) currently looks like:
OpenCppCoverage.exe --export_type cobertura:__out/cobertura.xml --modules "D:\a\boost-ci\boost-root" --sources "boost\boost-ci" --sources D:\a\boost-ci\boost-root\libs\boost-ci --excluded_line_regex '.*// LCOV_EXCL_LINE' --excluded_line_regex '.*// coverity\[dead_error_line\]' --excluded_line_regex '\s*[}{]*\s*' --excluded_line_regex '\s*(\} )?else( \{)?\s*' --cover_children -- <binary>

So there are quite a few options for the wrapper tool already and I don't know of a simple way to avoid this. When now running this through b2 that command is modified (backslashes replaced by forward slashes) and execution fails

Steps to reproduce the issue

b2 libs/boost-ci/test toolset=msvc-14.3 variant=debug -j3 testing.launcher="OpenCppCoverage.exe --export_type cobertura:__out/cobertura.xml --modules "D:\a\boost-ci\boost-root" --sources "boost\boost-ci" --sources D:\a\boost-ci\boost-root\libs\boost-ci --excluded_line_regex '.*// LCOV_EXCL_LINE' --excluded_line_regex '.*// coverity\[dead_error_line\]' --excluded_line_regex '\s*[}{]*\s*' --excluded_line_regex '\s*(\} )?else( \{)?\s*' --cover_children -- "

Actual behavior summary

Run command generated by b2:

OpenCppCoverage.exe --export_type cobertura:__out/cobertura.xml --modules D:/a/boost-ci/boost-root --sources boost/boost-ci --sources D:/a/boost-ci/boost-root/libs/boost-ci --excluded_line_regex '.*// LCOV_EXCL_LINE' --excluded_line_regex '.*// coverity/[dead_error_line/]' --excluded_line_regex '/s*[}{]*/s*' --excluded_line_regex '/s*(/} )?else( /{)?/s*' --cover_children -- "bin.v2\libs\boost-ci\test\msvc-14.3\dbg\cxstd-ltst-iso\thrd-mlt\test.exe" && echo. > "bin.v2\libs\boost-ci\test\msvc-14.3\dbg\cxstd-ltst-iso\thrd-mlt\test.passed"

See https://github.com/boostorg/boost-ci/runs/6800596525?check_suite_focus=true

Edit: I already tried fixing up the quotes: b2 libs/boost-ci/test toolset=msvc-14.3 variant=debug -j3 testing.launcher="OpenCppCoverage.exe --export_type cobertura:__out/cobertura.xml --modules 'D:\a\boost-ci\boost-root' --sources 'boost\boost-ci' --sources 'D:\a\boost-ci\boost-root\libs\boost-ci' --excluded_line_regex '.*// LCOV_EXCL_LINE' --excluded_line_regex '.*// coverity\[dead_error_line\]' --excluded_line_regex '\s*[}{]*\s*' --excluded_line_regex '\s*(\} )?else( \{)?\s*' --cover_children -- "

And I still get forward slashes back from b2: https://github.com/boostorg/boost-ci/runs/6810268778?check_suite_focus=true

Expected behavior summary

Not fully sure if this is the best way to do that. Any ideas are welcome.
The current solution directly runs the wrapper on b2 (and hence its children) but that slows down every compiler invocation to the point where CI times out.

Finally I'm note sure what happens, if a test (in the Jamfile) already uses testing.launcher. My expectation is that they should be chained, i.e. <cmd-line-launcher> <Jam-file-launcher> <binary>

Flamefire avatar Jun 09 '22 09:06 Flamefire