Skip to content

Commit bf1797a

Browse files
authored
Clean up test intermediates when clean test rebuild is requested (#62001)
I hit this problem locally when working on the test merging - I made a change in Jeremy's Roslyn generator logic adding a hard FailFast and the tests continued building normally even when specifying the rebuild option because the XUnitWrapperGenerator project remained in the intermediate test folder and didn't get actually rebuilt. Thanks Tomas
1 parent 2c55431 commit bf1797a

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/tests/build.cmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ set "__TestBinDir=%__TestRootDir%\%__OSPlatformConfig%"
146146
set "__TestIntermediatesDir=%__TestRootDir%\obj\%__OSPlatformConfig%"
147147

148148
if "%__RebuildTests%" == "1" (
149-
echo Removing tests build dir^: !__TestBinDir!
149+
echo Removing test build dir^: !__TestBinDir!
150150
rmdir /s /q !__TestBinDir!
151+
echo Removing test intermediate dir^: !__TestIntermediatesDir!
152+
rmdir /s /q !__TestIntermediatesDir!
151153
)
152154

153155
REM We have different managed and native intermediate dirs because the managed bits will include

src/tests/build.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ build_Tests()
55
echo "${__MsgPrefix}Building Tests..."
66

77
__ProjectFilesDir="$__TestDir"
8-
__TestBinDir="$__TestWorkingDir"
98
__Exclude="$__RepoRootDir/src/tests/issues.targets"
109

11-
if [[ -f "${__TestWorkingDir}/build_info.json" ]]; then
12-
rm "${__TestWorkingDir}/build_info.json"
10+
if [[ -f "${__TestBinDir}/build_info.json" ]]; then
11+
rm "${__TestBinDir}/build_info.json"
1312
fi
1413

1514
if [[ "$__RebuildTests" -ne 0 ]]; then
@@ -363,7 +362,7 @@ __OSPlatformConfig="$__TargetOS.$__BuildArch.$__BuildType"
363362
__BinDir="$__RootBinDir/bin/coreclr/$__OSPlatformConfig"
364363
__PackagesBinDir="$__BinDir/.nuget"
365364
__TestDir="$__RepoRootDir/src/tests"
366-
__TestWorkingDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
365+
__TestBinDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
367366
__IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
368367
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
369368
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
@@ -382,10 +381,10 @@ if [[ -z "$HOME" ]]; then
382381
fi
383382

384383
if [[ "$__RebuildTests" -ne 0 ]]; then
385-
if [[ -d "${__TestWorkingDir}" ]]; then
386-
echo "Removing tests build dir: ${__TestWorkingDir}"
387-
rm -rf "${__TestWorkingDir}"
388-
fi
384+
echo "Removing test build dir: ${__TestBinDir}"
385+
rm -rf "${__TestBinDir}"
386+
echo "Removing test intermediate dir: ${__TestIntermediatesDir}"
387+
rm -rf "${__TestIntermediatesDir}"
389388
fi
390389

391390
build_Tests

0 commit comments

Comments
 (0)