@@ -50,7 +50,7 @@ stages:
5050 strategy :
5151 matrix :
5252 Windows_py311 :
53- vmImage : ' windows-2022' # keep one job pinned to the oldest image
53+ vmImage : ' windows-2022' # Keep one job pinned to the oldest image
5454 python.version : ' 3.11'
5555 Windows_py312 :
5656 vmImage : ' windows-latest'
@@ -100,31 +100,24 @@ stages:
100100 echo "Coverage session ID: ${SESSION_ID}"
101101 VS=$(ls -d /c/Program\ Files*/Microsoft\ Visual\ Studio/*/Enterprise)
102102 echo "Visual Studio: ${VS}"
103- DIR="$VS"/Team\ Tools/Dynamic\ Code\ Coverage\ Tools/amd64
104- if [[ -d $DIR ]]; then
105- # This is for MSVC 2019 (on windows-2019).
106- VSINSTR="$VS"/Team\ Tools/Performance\ Tools/vsinstr.exe
107- for f in build/cp*/src/*.pyd; do
108- "$VSINSTR" $f -Verbose -Coverage
109- done
110- TOOL="$DIR/CodeCoverage.exe"
111- cat > extensions.config << EOF
112- <CodeCoverage>
113- <CollectFromChildProcesses>true</CollectFromChildProcesses>
114- <ModulePaths>
115- <Include>
116- <ModulePath>.*\\.*\.pyd</ModulePath>
117- </Include>
118- </ModulePaths>
119- </CodeCoverage>
120- EOF
121- echo "Starting $TOOL in server mode"
122- "$TOOL" collect \
123- -config:extensions.config -session:$SESSION_ID \
124- -output:extensions.coverage -verbose &
125- echo "Started $TOOL"
126- VS_VER=2019
127- fi
103+ DIR="$VS/Common7/IDE/Extensions/Microsoft/CodeCoverage.Console"
104+ # This is for MSVC 2022 (on windows-latest).
105+ TOOL="$DIR/Microsoft.CodeCoverage.Console.exe"
106+ for f in build/cp*/src/*.pyd; do
107+ echo $f
108+ echo "=============================="
109+ "$TOOL" instrument $f --session-id $SESSION_ID \
110+ --log-level Verbose --log-file instrument.log
111+ cat instrument.log
112+ rm instrument.log
113+ done
114+ echo "Starting $TOOL in server mode"
115+ "$TOOL" collect \
116+ --session-id $SESSION_ID --server-mode \
117+ --output-format cobertura --output extensions.xml \
118+ --log-level Verbose --log-file extensions.log &
119+ VS_VER=2022
120+
128121 echo "##vso[task.setvariable variable=VS_COVERAGE_TOOL]$TOOL"
129122
130123 PYTHONFAULTHANDLER=1 pytest -rfEsXR -n 2 \
0 commit comments