Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Clean up test intermediates when clean test rebuild is requested
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
  • Loading branch information
trylek committed Nov 24, 2021
commit 7aa6ef34b1cd59402166e5ed50ee2aeecbe2c6b5
4 changes: 3 additions & 1 deletion src/tests/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ set "__TestBinDir=%__TestRootDir%\%__OSPlatformConfig%"
set "__TestIntermediatesDir=%__TestRootDir%\obj\%__OSPlatformConfig%"

if "%__RebuildTests%" == "1" (
echo Removing tests build dir^: !__TestBinDir!
echo Removing test build dir^: !__TestBinDir!
rmdir /s /q !__TestBinDir!
echo Removing test intermediate dir^: !__TestIntermediatesDir!
rmdir /s /q !__TestIntermediatesDir!
)

REM We have different managed and native intermediate dirs because the managed bits will include
Expand Down
15 changes: 8 additions & 7 deletions src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ build_Tests()
echo "${__MsgPrefix}Building Tests..."

__ProjectFilesDir="$__TestDir"
__TestBinDir="$__TestWorkingDir"
__Exclude="$__RepoRootDir/src/tests/issues.targets"

if [[ -f "${__TestWorkingDir}/build_info.json" ]]; then
rm "${__TestWorkingDir}/build_info.json"
if [[ -f "${__TestBinDir}/build_info.json" ]]; then
rm "${__TestBinDir}/build_info.json"
fi

if [[ "$__RebuildTests" -ne 0 ]]; then
Expand Down Expand Up @@ -363,7 +362,7 @@ __OSPlatformConfig="$__TargetOS.$__BuildArch.$__BuildType"
__BinDir="$__RootBinDir/bin/coreclr/$__OSPlatformConfig"
__PackagesBinDir="$__BinDir/.nuget"
__TestDir="$__RepoRootDir/src/tests"
__TestWorkingDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
__TestBinDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
__IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
Expand All @@ -382,9 +381,11 @@ if [[ -z "$HOME" ]]; then
fi

if [[ "$__RebuildTests" -ne 0 ]]; then
if [[ -d "${__TestWorkingDir}" ]]; then
echo "Removing tests build dir: ${__TestWorkingDir}"
rm -rf "${__TestWorkingDir}"
if [[ -d "${__TestBinDir}" ]]; then
echo "Removing test build dir: ${__TestBinDir}"
rm -rf "${__TestBinDir}"
echo "Removing test intermediate dir: ${__TestIntermediatesDir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a preceding:

if [[ -d "${__TestIntermediatesDir}" ]]; then

? Or will rm -rf not complain if it doesn't exist? Of course, if __TestBinDir exists, it will essentially always exist anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Bruce for pointing that out. I have locally verified that rm -rf has no trouble with non-existent folders so I just removed the pre-existing condition instead of introducing a new one.

rm -rf "${__TestIntermediatesDir}"
fi
fi

Expand Down