Skip to content

Commit

Permalink
Standardize test script naming to CLRTestBa{tc,s}hP{re,ost}Commands (#…
Browse files Browse the repository at this point in the history
…76483)

Main change is BashCLRTestPreCommands -> CLRTestBashPreCommands. As part of this I noticed that wasm tests overwrite the Bash precommands, and fixing that breaks them so it isn't touched here. Also, there are several non-Commands variables that start with Ba{tc,s}hTest that aren't touched here.

Remove check on RunCrossGen2 in disasm checks as that is intended as a shell environment variable, not an msbuild variable.

Convert a few more tests to the new environment variable format.
  • Loading branch information
markples authored Nov 4, 2022
1 parent 3b0ef30 commit be87e80
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 131 deletions.
2 changes: 1 addition & 1 deletion src/tests/Common/CLRTest.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fi
]]>
</CrossgenBashScript>

<BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(CrossgenBashScript)</BashCLRTestPreCommands>
<CLRTestBashPreCommands>$(CLRTestBashPreCommands);$(CrossgenBashScript)</CLRTestBashPreCommands>
</PropertyGroup>
</Target>

Expand Down
17 changes: 6 additions & 11 deletions src/tests/Common/CLRTest.Execute.Bash.targets
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ fi
<PropertyGroup>
<CLRTestRunFile Condition="'$(CLRTestIsHosted)'=='true'">"$CORE_ROOT/corerun" $(CoreRunArgs) ${__DotEnvArg}</CLRTestRunFile>

<BashCLRTestPreCommands Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(TargetArchitecture)' == 'wasm'">
<![CDATA[
<!-- Note that this overwrites CLRTestBashPreCommands rather than adding to it. -->
<CLRTestBashPreCommands Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(TargetArchitecture)' == 'wasm'"><![CDATA[
# Build wasm app containing the test dll
__Command=""
if [ ! -z ${__TestDotNetCmd+x} ] %3B then
Expand All @@ -292,7 +292,7 @@ export DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER=1
$__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssemblyFileName=$(MsBuildProjectName).dll /p:TestBinDir=`pwd` $(CLRTestMSBuildArgs) || exit $?
]]>
</BashCLRTestPreCommands>
</CLRTestBashPreCommands>

<BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun' And $(TargetOS) != 'Browser' And '$(TargetOS)' != 'Android' And '$(TargetArchitecture)' != 'arm64'">
<![CDATA[
Expand Down Expand Up @@ -430,13 +430,8 @@ echo /usr/bin/env bash $(InputAssemblyName) %24(printf "'%s' " "${CLRTestExecuti
CLRTestExitCode=$?
CLRTestExpectedExitCode=0
]]></BashCLRTestLaunchCmds>

<BashCLRTestPostCommands><![CDATA[
$(BashDisasmCheckPostCommands)
$(CLRTestBashPostCommands)
]]></BashCLRTestPostCommands>

</PropertyGroup>

<PropertyGroup>
<BashEnvironmentVariables>
@(CLRTestBashEnvironmentVariable -> 'export %(Identity)=%(Value)', '%0a')
Expand Down Expand Up @@ -548,11 +543,11 @@ ExePath=$(InputAssemblyName)
export TestExclusionListPath=$CORE_ROOT/TestExclusionList.txt
$(BashEnvironmentVariables)
# PreCommands
$(BashCLRTestPreCommands)
$(CLRTestBashPreCommands)
# Launch
$(BashCLRTestLaunchCmds)
# PostCommands
$(BashCLRTestPostCommands)
$(CLRTestBashPostCommands)
$(BashCLRTestExitCodeCheck)
]]>
</_CLRTestExecutionScriptText>
Expand Down
9 changes: 2 additions & 7 deletions src/tests/Common/CLRTest.Execute.Batch.targets
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,8 @@ cmd /c $(InputAssemblyName)
set CLRTestExitCode=!ERRORLEVEL!
set CLRTestExpectedExitCode=0
]]></BatchCLRTestLaunchCmds>

<BatchCLRTestPostCommands><![CDATA[
$(BatchDisasmCheckPostCommands)
$(CLRTestBatchPostCommands)
]]></BatchCLRTestPostCommands>

</PropertyGroup>

<PropertyGroup>
<BatchEnvironmentVariables>
@(CLRTestBatchEnvironmentVariable -> 'set %(Identity)=%(Value)', '%0d%0a')
Expand Down Expand Up @@ -453,7 +448,7 @@ $(CLRTestBatchPreCommands)
REM Launch
$(BatchCLRTestLaunchCmds)
REM PostCommands
$(BatchCLRTestPostCommands)
$(CLRTestBatchPostCommands)
$(BatchCLRTestExitCodeCheck)
]]></_CLRTestExecutionScriptText>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Common/CLRTest.GC.targets
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ then
fi
]]></GCSimulatorTestBashScript>

<BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(GCLongGCTestBashScript);$(GCSimulatorTestBashScript)</BashCLRTestPreCommands>
<CLRTestBashPreCommands>$(CLRTestBashPreCommands);$(GCLongGCTestBashScript);$(GCSimulatorTestBashScript)</CLRTestBashPreCommands>
<GCLongGCTestBatchScript Condition="'$(IsLongRunningGCTest)' != 'true'"><![CDATA[
REM Long GC script
if defined RunningLongGCTests (
Expand Down
55 changes: 17 additions & 38 deletions src/tests/Common/CLRTest.Jit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ export RunningIlasmRoundTrip=
]]>
</IlasmRoundTripBashScript>

<IlasmRoundTripBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun'">
<![CDATA[
<IlasmRoundTripBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun'"><![CDATA[
# IlasmRoundTrip Script
# Disable Ilasm round-tripping for Linker tests.
# Todo: Ilasm round-trip on linked binaries.
Expand Down Expand Up @@ -192,14 +191,13 @@ IF NOT DEFINED DoLink (
</PropertyGroup>
</Target>

<Target Name="GetDisasmCheckData"
Returns="$(HasDisasmCheck);@(DisasmCheckFiles)">
<Target Name="GetDisasmCheckData">
<ItemGroup>
<DisasmCheckFiles Include="%(Compile.Identity)" Condition="'%(Compile.HasDisasmCheck)' == 'true'" />
</ItemGroup>
<PropertyGroup>
<HasDisasmCheck>false</HasDisasmCheck>
<HasDisasmCheck Condition="@(DisasmCheckFiles->Count()) &gt; 0 And '$(CLRTestKind)' == 'BuildAndRun' and '$(RunCrossGen2)' != '1'">true</HasDisasmCheck>
<HasDisasmCheck Condition="@(DisasmCheckFiles->Count()) &gt; 0 And '$(CLRTestKind)' == 'BuildAndRun'">true</HasDisasmCheck>

<GCStressIncompatible Condition="'$(HasDisasmCheck)' == 'true'">true</GCStressIncompatible>
<HeapVerifyIncompatible Condition="'$(HasDisasmCheck)' == 'true'">true</HeapVerifyIncompatible>
Expand All @@ -221,20 +219,16 @@ IF NOT DEFINED DoLink (
</Target>

<Target Name="GetDisasmCheckBashScript"
Returns="$(HasBashDisasmCheck);$(BashDisasmOutputFile);$(BashDisasmCheckPostCommands)"
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')">true</HasBashDisasmCheck>

<BashDisasmOutputFile>/dev/null</BashDisasmOutputFile>
<BashDisasmOutputFile Condition="'$(HasBashDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm.out</BashDisasmOutputFile>

<BashDisasmListOutputFile>/dev/null</BashDisasmListOutputFile>
<BashDisasmListOutputFile Condition="'$(HasBashDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm_list.out</BashDisasmListOutputFile>

<BashCLRTestPreCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
$(BashCLRTestPreCommands)
<CLRTestBashPreCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
$(CLRTestBashPreCommands)
if [[ ( -z "$DOTNET_JitStress" ) && ( -z "$DOTNET_JitStressRegs" ) && ( -z "$DOTNET_TailcallStress" ) && ( "$DOTNET_TieredPGO" != "1" ) && ( -z "$RunCrossGen2" ) && ( -z "$DOTNET_JitForceControlFlowGuard" ) ]]; then
@(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=$?
Expand All @@ -248,10 +242,10 @@ if [[ ( -z "$DOTNET_JitStress" ) && ( -z "$DOTNET_JitStressRegs" ) && ( -z "$DOT
fi', '%0a')
fi
]]>
</BashCLRTestPreCommands>
</CLRTestBashPreCommands>

<BashDisasmCheckPostCommands></BashDisasmCheckPostCommands>
<BashDisasmCheckPostCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
<CLRTestBashPostCommands Condition="'$(HasBashDisasmCheck)' == 'true'"><![CDATA[
$(CLRTestBashPostCommands)
if [[ -n $DOTNET_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 40 --input-file "$(BashDisasmOutputFile)"
ERRORLEVEL=$?
Expand All @@ -262,26 +256,22 @@ if [[ -n $DOTNET_JitDisasm ]]; then
fi', '%0a')
fi
]]>
</BashDisasmCheckPostCommands>
</CLRTestBashPostCommands>
</PropertyGroup>
</Target>

<Target Name="GetDisasmCheckBatchScript"
Returns="$(HasBatchDisasmCheck);$(BatchDisasmOutputFile);$(BatchDisasmCheckPostCommands)"
DependsOnTargets="GetDisasmCheckData">
<PropertyGroup>
<HasBatchDisasmCheck>false</HasBatchDisasmCheck>
<HasBatchDisasmCheck Condition="'$(HasDisasmCheck)' == 'true' and '$(RuntimeFlavor)' == 'coreclr'">true</HasBatchDisasmCheck>

<BatchDisasmOutputFile>NUL</BatchDisasmOutputFile>
<BatchDisasmOutputFile Condition="'$(HasBatchDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm.out</BatchDisasmOutputFile>

<BatchDisasmListOutputFile>NUL</BatchDisasmListOutputFile>
<BatchDisasmListOutputFile Condition="'$(HasBatchDisasmCheck)' == 'true'">$(scriptPath)__jit_disasm_list.out</BatchDisasmListOutputFile>

<CLRTestBatchPreCommands Condition="'$(HasBatchDisasmCheck)' == 'true'">
<![CDATA[
$(CLRTestBatchPreCommands)
$(CLRTestBatchPreCommands)
IF "%DOTNET_JitStress%"=="" IF "%DOTNET_JitStressRegs%"=="" IF "%DOTNET_TailcallStress%"=="" IF NOT "%DOTNET_TieredPGO%" == "1" IF NOT "%RunCrossGen2%" == "1" IF "%DOTNET_JitForceControlFlowGuard%"=="" (
@(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,8 +285,8 @@ IF "%DOTNET_JitStress%"=="" IF "%DOTNET_JitStressRegs%"=="" IF "%DOTNET_Tailcall
]]>
</CLRTestBatchPreCommands>

<BatchDisasmCheckPostCommands></BatchDisasmCheckPostCommands>
<BatchDisasmCheckPostCommands Condition="'$(HasBatchDisasmCheck)' == 'true'"><![CDATA[
<CLRTestBatchPostCommands Condition="'$(HasBatchDisasmCheck)' == 'true'"><![CDATA[
$(CLRTestBatchPostCommands)
IF NOT "%DOTNET_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 40 --input-file "$(BatchDisasmOutputFile)"
IF NOT "!ERRORLEVEL!" == "0" (
Expand All @@ -305,7 +295,7 @@ IF NOT "%DOTNET_JitDisasm%" == "" (
)', '%0d%0a')
)
]]>
</BatchDisasmCheckPostCommands>
</CLRTestBatchPostCommands>
</PropertyGroup>
</Target>

Expand Down Expand Up @@ -373,20 +363,9 @@ set DOTNET_JitPath=%CORE_ROOT%\superpmi-shim-collector.dll
***********************************************************************************************
-->

<PropertyGroup Condition="$(RunWithGcStress) != ''" >
<CLRTestBatchPreCommands>
<![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_GCStress=$(RunWithGcStress)
]]>
</CLRTestBatchPreCommands>
<BashCLRTestPreCommands>
<![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_GCStress=$(RunWithGcStress)
]]>
</BashCLRTestPreCommands>
</PropertyGroup>

<ItemGroup>
<CLRTestEnvironmentVariable Condition="'$(RunWithGcStress)' != ''"
Include="DOTNET_GCStress" Value="$(RunWithGcStress)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
set DOTNET_GCStress=0x3
set DOTNET_GCSegmentSize=8000
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
<CLRTestBashPreCommands><![CDATA[
$(CLRTestBashPreCommands)
export DOTNET_TieredCompilation=0
export DOTNET_GCStress=0x3
export DOTNET_GCSegmentSize=8000
]]></BashCLRTestPreCommands>
]]></CLRTestBashPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="DllImportPathTest.cs" />
</ItemGroup>
<ItemGroup>

<CLRTestBashEnvironmentVariable Include="LD_LIBRARY_PATH" Value="$LD_LIBRARY_PATH:$%28pwd)/Subdirectory" />
</ItemGroup>
<PropertyGroup>
<PathEnvSetupCommands><![CDATA[
mkdir Subdirectory
]]></PathEnvSetupCommands>
<BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(PathEnvSetupCommands)</BashCLRTestPreCommands>
<CLRTestBashPreCommands>$(CLRTestBashPreCommands);$(PathEnvSetupCommands)</CLRTestBashPreCommands>
</PropertyGroup>
<ItemGroup>
<CMakeProjectReference Include="CMakeLists.txt" />
Expand Down
16 changes: 4 additions & 12 deletions src/tests/JIT/PGO/InstrumentedTiers/InstrumentedTiers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_TieredCompilation=1
set DOTNET_TieredPGO=1
set DOTNET_TieredPGO_InstrumentOnlyHotCode=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_TieredCompilation=1
export DOTNET_TieredPGO=1
export DOTNET_TieredPGO_InstrumentOnlyHotCode=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="InstrumentedTiers.cs" />

<CLRTestBatchEnvironmentVariable Include="DOTNET_TieredCompilation" Value="1" />
<CLRTestBatchEnvironmentVariable Include="DOTNET_TieredPGO" Value="1" />
<CLRTestBatchEnvironmentVariable Include="DOTNET_TieredPGO_InstrumentOnlyHotCode" Value="1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />

<!-- This test requires GCStress to trigger the regression. Set DOTNET_GCStress here. However,
not all CI platforms support GCStress. In particular, macOS and Alpine do not (currently).
All Windows support GCStress. We don't have any way (currently) to determine if we're
running on a platform that supports GCStress. So, don't set GCStress for non-Windows (Bash).
The test will run under GCStress in normal, scheduled GCStress runs, when only the supported
platforms are run with GCStress.
-->
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_GCStress=0xc
]]></CLRTestBatchPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
<CLRTestBatchEnvironmentVariable Include="DOTNET_GCStress" Value="0xc" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_GCStress=0xC
]]></CLRTestBatchPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />

<CLRTestBatchEnvironmentVariable Include="DOTNET_GCStress" Value="0xC" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,10 @@
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set COMPlus_TieredPGO=1
set COMPlus_TC_QuickJitForLoops=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export COMPlus_TieredPGO=1
export COMPlus_TC_QuickJitForLoops=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />

<CLRTestEnvironmentVariable Include="DOTNET_TieredPGO" Value="1" />
<CLRTestEnvironmentVariable Include="DOTNET_TC_QuickJitForLoops" Value="1" />
</ItemGroup>
</Project>
12 changes: 7 additions & 5 deletions src/tests/JIT/SIMD/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
<CLRTestBatchPreCommands>
<![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_JitFuncInfoLogFile=SIMD.log
if EXIST SIMD.log (del SIMD.log)
]]>
</CLRTestBatchPreCommands>
<BashCLRTestPreCommands>
<CLRTestBashPreCommands>
<![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_JitFuncInfoLogFile=SIMD.log
$(CLRTestBashPreCommands)
rm -f SIMD.log
]]>
</BashCLRTestPreCommands>
</CLRTestBashPreCommands>
</PropertyGroup>

<ItemGroup>
<CLRTestBashEnvironmentVariable Include="DOTNET_JitFuncInfoLogFile" Value="SIMD.log" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/tests/Loader/NativeLibs/FromNativePaths.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PathEnvSetupCommands><![CDATA[
mkdir Subdirectory
]]></PathEnvSetupCommands>
<BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(PathEnvSetupCommands)</BashCLRTestPreCommands>
<CLRTestBatchPreCommands>$(BatchCLRTestPreCommands);$(PathEnvSetupCommands)</CLRTestBatchPreCommands>
<CLRTestBashPreCommands>$(CLRTestBashPreCommands);$(PathEnvSetupCommands)</CLRTestBashPreCommands>
<CLRTestBatchPreCommands>$(CLRTestBatchPreCommands);$(PathEnvSetupCommands)</CLRTestBatchPreCommands>
</PropertyGroup>
</Project>
Loading

0 comments on commit be87e80

Please sign in to comment.