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
Prev Previous commit
Next Next commit
Feedback, force a failure
  • Loading branch information
TIHan committed Sep 26, 2022
commit b27a90841bca0d2fbcd40ca4b6ab1cbf88c6b847
29 changes: 15 additions & 14 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 All @@ -222,10 +225,7 @@ IF NOT DEFINED DoLink (
DependsOnTargets="GetDisasmCheckData">
<PropertyGroup>
<HasBashDisasmCheck>false</HasBashDisasmCheck>
<HasBashDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and ('$(TargetOS)' == 'Linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64') and '$(RunCrossGen2)' != 'true'">true</HasBashDisasmCheck>

<GCStressIncompatible Condition="'$(HasBashDisasmCheck)' == 'true'">true</GCStressIncompatible>
<HeapVerifyIncompatible Condition="'$(HasBashDisasmCheck)' == 'true'">true</HeapVerifyIncompatible>
<HasBashDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and ('$(TargetOS)' == 'Linux' or '$(TargetOS)' == 'OSX') and ('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64')">true</HasBashDisasmCheck>

<BashDisasmOutputFile>/dev/null</BashDisasmOutputFile>
<BashDisasmOutputFile Condition="'$(HasBashDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm.out</BashDisasmOutputFile>
Expand All @@ -234,13 +234,15 @@ IF NOT DEFINED DoLink (
<BashDisasmListOutputFile Condition="'$(HasBashDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm_list.out</BashDisasmListOutputFile>

<BashCLRTestPreCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
CAN_RUN_DISASM_CHECKS=0
if [[ ( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" ) ]]; then
Copy link
Contributor

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
Contributor

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 ]]
export COMPlus_JitDisasm=`cat $(BashDisasmListOutputFile)`
export COMPlus_JitDiffableDasm=1
export COMPlus_JitStdOutFile=$(BashDisasmOutputFile)
CAN_RUN_DISASM_CHECKS=1
then
echo EXECUTION OF FILECHECK - FAILED $ERRORLEVEL
exit 1
Expand All @@ -251,7 +253,7 @@ fi

<BashDisasmCheckPostCommands></BashDisasmCheckPostCommands>
<BashDisasmCheckPostCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
if [[ ( -z "$COMPlus_JitStress" ) && ( -z "$COMPlus_JitStressRegs" ) && ( -z "$COMPlus_TailcallStress" ) && ( "$COMPlus_TieredPGO" != "1" ) ]]; then
if [[ CAN_RUN_DISASM_CHECKS == 1 ]]; then
if [[ -n $COMPlus_JitDisasm ]]; then
@(DisasmCheckFiles -> ' dotnet $CORE_ROOT/SuperFileCheck/SuperFileCheck.dll --csharp "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) --dump-input-context 25 --input-file "$(BashDisasmOutputFile)"
ERRORLEVEL=$?
Expand All @@ -272,10 +274,7 @@ fi
DependsOnTargets="GetDisasmCheckData">
<PropertyGroup>
<HasBatchDisasmCheck>false</HasBatchDisasmCheck>
<HasBatchDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr' and '$(RunCrossGen2)' != 'true'">true</HasBatchDisasmCheck>

<GCStressIncompatible Condition="'$(HasBatchDisasmCheck)' == 'true'">true</GCStressIncompatible>
<HeapVerifyIncompatible Condition="'$(HasBatchDisasmCheck)' == 'true'">true</HeapVerifyIncompatible>
<HasBatchDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr'">true</HasBatchDisasmCheck>

<BatchDisasmOutputFile>NUL</BatchDisasmOutputFile>
<BatchDisasmOutputFile Condition="'$(HasBatchDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm.out</BatchDisasmOutputFile>
Expand All @@ -286,6 +285,7 @@ fi
<CLRTestBatchPreCommands Condition="'$(HasBatchDisasmCheck)' == 'true'">
<![CDATA[
$(CLRTestBatchPreCommands)
set CAN_RUN_DISASM_CHECKS=0
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" (
Expand All @@ -295,13 +295,14 @@ IF "%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_Tailc
for /F "delims=" %%g in ($(BatchDisasmListOutputFile)) do set COMPlus_JitDisasm=%%g
set COMPlus_JitDiffableDasm=1
set COMPlus_JitStdOutFile=$(BatchDisasmOutputFile)
set CAN_RUN_DISASM_CHECKS=1
)
]]>
</CLRTestBatchPreCommands>

<BatchDisasmCheckPostCommands></BatchDisasmCheckPostCommands>
<BatchDisasmCheckPostCommands Condition="'$(HasBatchDisasmCheck)' == 'true'"><![CDATA[
IF "%COMPlus_JitStress%"=="" IF "%COMPlus_JitStressRegs%"=="" IF "%COMPlus_TailcallStress%"=="" IF NOT "%COMPlus_TieredPGO%" == "1" (
IF "%CAN_RUN_DISASM_CHECKS%" == "1" (
IF NOT "%COMPlus_JitDisasm%" == "" (
@(DisasmCheckFiles -> ' dotnet %CORE_ROOT%\SuperFileCheck\SuperFileCheck.dll --csharp "%(Identity)" --allow-unused-prefixes --check-prefixes=CHECK,$(TargetArchitecture.ToUpperInvariant()),$(TargetArchitecture.ToUpperInvariant())-$(TargetOS.ToUpperInvariant()) --dump-input-context 25 --input-file "$(BatchDisasmOutputFile)"
IF NOT "!ERRORLEVEL!" == "0" (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static int PerformMod_2(int i)
// X64-FULL-LINE-NEXT: sar [[REG0]], 31
// X64-FULL-LINE-NEXT: and [[REG0]], 15
// X64-FULL-LINE-NEXT: add [[REG0]], [[REG1]]
// X64-FULL-LINE-NEXT: and [[REG0]], -16
// X64-FULL-LINE-NEXT: and [[REG1]], -16
// X64-WINDOWS-FULL-LINE-NEXT: mov [[REG2:[a-z]+]], [[REG1]]
// X64-WINDOWS-FULL-LINE-NEXT: sub [[REG2]], [[REG0]]
// X64-WINDOWS-FULL-LINE-NEXT: mov [[REG0]], [[REG2]]
Expand Down