Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling disasm checks under certain testing environments #76202

Merged
merged 10 commits into from
Sep 27, 2022
45 changes: 26 additions & 19 deletions src/tests/Common/CLRTest.Jit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ IF NOT DEFINED DoLink (
</ItemGroup>
<PropertyGroup>
<HasDisasmCheck>false</HasDisasmCheck>
<HasDisasmCheck Condition="@(DisasmCheckFiles->Count()) &gt; 0 And '$(CLRTestKind)' == 'BuildAndRun'">true</HasDisasmCheck>
<HasDisasmCheck Condition="@(DisasmCheckFiles->Count()) &gt; 0 And '$(CLRTestKind)' == 'BuildAndRun' and '$(RunCrossGen2)' != 'true'">true</HasDisasmCheck>

<GCStressIncompatible Condition="'$(HasDisasmCheck)' == 'true'">true</GCStressIncompatible>
<HeapVerifyIncompatible Condition="'$(HasDisasmCheck)' == 'true'">true</HeapVerifyIncompatible>
</PropertyGroup>
</Target>

Expand Down Expand Up @@ -231,16 +234,18 @@ IF NOT DEFINED DoLink (
<BashDisasmListOutputFile Condition="'$(HasBashDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm_list.out</BashDisasmListOutputFile>

<BashCLRTestPreCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
@(DisasmCheckFiles -> ' dotnet $CORE_ROOT/SuperFileCheck/SuperFileCheck.dll --csharp-list-method-names "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) > "$(BashDisasmListOutputFile)"
ERRORLEVEL=$?
export COMPlus_JitDisasm=`cat $(BashDisasmListOutputFile)`
export COMPlus_JitDiffableDasm=1
export COMPlus_JitStdOutFile=$(BashDisasmOutputFile)
if [[ $ERRORLEVEL -ne 0 ]]
then
echo EXECUTION OF FILECHECK - FAILED $ERRORLEVEL
exit 1
fi', '%0a')
if [[ ( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" ) ]]; then
markples marked this conversation as resolved.
Show resolved Hide resolved
markples marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

This list is repeated four times, which will be difficult to maintain. For each of bash/batch, the two could be combined to one by defining a variable and using it in the two ifs.

Bash vs batch is difficult because the syntax is different. So perhaps instead of the above suggestion, the condition strings could be separately defined in msbuild variables and included twice in each script. Then those msbuild variables could be defined back-to-back so that it is clear that if you change one you need to change the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll see if I can clean it up - I'm just so afraid of getting the syntaxes wrong for each of them.

Copy link
Member

Choose a reason for hiding this comment

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

If you have a clean test run, merge without this to unblock outerloop, but please factor this afterwards.

I don't think it's too bad because you already have the script syntax. Something like

<PropertyGroup>
  <DisasmBashCondition>(<![CDATA[( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" )]]></DisasmBashCondition>
  <DisasmBatchCondition>"%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_TailcallStress%"=="" IF NOT "%COMPlus_TieredPGO%" == "1"</DisasmBatchCondition>
</PropertyGroup>

Then the if lines:

if [[ $(DisasmBashCondition) ]]; then
IF $(DisasmBatchCondition) (

@(DisasmCheckFiles -> ' dotnet $CORE_ROOT/SuperFileCheck/SuperFileCheck.dll --csharp-list-method-names "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) > "$(BashDisasmListOutputFile)"
ERRORLEVEL=$?
export COMPlus_JitDisasm=`cat $(BashDisasmListOutputFile)`
export COMPlus_JitDiffableDasm=1
export COMPlus_JitStdOutFile=$(BashDisasmOutputFile)
if [[ $ERRORLEVEL -ne 0 ]]
then
echo EXECUTION OF FILECHECK - FAILED $ERRORLEVEL
exit 1
fi', '%0a')
fi
]]>
</BashCLRTestPreCommands>

Expand Down Expand Up @@ -276,14 +281,16 @@ fi
<CLRTestBatchPreCommands Condition="'$(HasBatchDisasmCheck)' == 'true'">
<![CDATA[
$(CLRTestBatchPreCommands)
@(DisasmCheckFiles -> ' dotnet %CORE_ROOT%\SuperFileCheck\SuperFileCheck.dll --csharp-list-method-names "%(Identity)" --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) > "$(BatchDisasmListOutputFile)"
IF NOT "!ERRORLEVEL!" == "0" (
ECHO EXECUTION OF FILECHECK LISTING METHOD NAMES - FAILED !ERRORLEVEL!
Exit /b 1
)', '%0d%0a')
for /F "delims=" %%g in ($(BatchDisasmListOutputFile)) do set COMPlus_JitDisasm=%%g
set COMPlus_JitDiffableDasm=1
set COMPlus_JitStdOutFile=$(BatchDisasmOutputFile)
IF "%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_TailcallStress%"=="" IF NOT "%COMPlus_TieredPGO%" == "1" (
@(DisasmCheckFiles -> ' dotnet %CORE_ROOT%\SuperFileCheck\SuperFileCheck.dll --csharp-list-method-names "%(Identity)" --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) > "$(BatchDisasmListOutputFile)"
IF NOT "!ERRORLEVEL!" == "0" (
ECHO EXECUTION OF FILECHECK LISTING METHOD NAMES - FAILED !ERRORLEVEL!
Exit /b 1
)', '%0d%0a')
for /F "delims=" %%g in ($(BatchDisasmListOutputFile)) do set COMPlus_JitDisasm=%%g
set COMPlus_JitDiffableDasm=1
set COMPlus_JitStdOutFile=$(BatchDisasmOutputFile)
)
]]>
</CLRTestBatchPreCommands>

Expand Down