Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add large version bubble test
Browse files Browse the repository at this point in the history
  • Loading branch information
A-And committed Jan 8, 2019
1 parent 2243d12 commit e76d09a
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19186,7 +19186,6 @@ void Compiler::impMarkInlineCandidate(GenTree* callNode,
inlineResult.NoteFatal(InlineObservation::CALLSITE_IS_CALL_TO_HELPER);
return;
}

/* Ignore indirect calls */
if (call->gtCallType == CT_INDIRECT)
{
Expand Down
89 changes: 48 additions & 41 deletions tests/runtest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,50 +59,52 @@ if /i "%1" == "-h" goto Usage
if /i "%1" == "/help" goto Usage
if /i "%1" == "-help" goto Usage

if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop)
if /i "%1" == "x86" (set __BuildArch=x86&shift&goto Arg_Loop)
if /i "%1" == "arm" (set __BuildArch=arm&shift&goto Arg_Loop)
if /i "%1" == "arm64" (set __BuildArch=arm64&shift&goto Arg_Loop)

if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)
if /i "%1" == "checked" (set __BuildType=Checked&shift&goto Arg_Loop)

if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop)

if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop)
if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop)
if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop)
if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop)
if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop)
if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "jitstressregs" (set COMPlus_JitStressRegs=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "jitminopts" (set COMPlus_JITMinOpts=1&shift&goto Arg_Loop)
if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs=1&shift&goto Arg_Loop)
if /i "%1" == "jitdisasm" (set __JitDisasm=1&shift&goto Arg_Loop)
if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop)
if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&shift&goto Arg_Loop)
if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&shift&goto Arg_Loop)
if /i "%1" == "buildxunitwrappers" (set __BuildXunitWrappers=1&shift&goto Arg_Loop)
if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop)
if /i "%1" == "PerfTests" (set __PerfTests=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTests" (set __CoreFXTests=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTestsAll" (set __CoreFXTests=true&set __CoreFXTestsRunAllAvailable=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTestList" (set __CoreFXTests=true&set __CoreFXTestList=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop)
if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "x64" (set __BuildArch=x64&shift&goto Arg_Loop)
if /i "%1" == "x86" (set __BuildArch=x86&shift&goto Arg_Loop)
if /i "%1" == "arm" (set __BuildArch=arm&shift&goto Arg_Loop)
if /i "%1" == "arm64" (set __BuildArch=arm64&shift&goto Arg_Loop)

if /i "%1" == "debug" (set __BuildType=Debug&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)
if /i "%1" == "checked" (set __BuildType=Checked&shift&goto Arg_Loop)

if /i "%1" == "vs2015" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop)

if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "AgainstPackages" (set __AgainstPackages=1&shift&goto Arg_Loop)
if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop)
if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop)
if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop)
if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop)
if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "jitstressregs" (set COMPlus_JitStressRegs=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "jitminopts" (set COMPlus_JITMinOpts=1&shift&goto Arg_Loop)
if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs=1&shift&goto Arg_Loop)
if /i "%1" == "jitdisasm" (set __JitDisasm=1&shift&goto Arg_Loop)
if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop)
if /i "%1" == "GenerateLayoutOnly" (set __GenerateLayoutOnly=1&shift&goto Arg_Loop)
if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&shift&goto Arg_Loop)
if /i "%1" == "buildxunitwrappers" (set __BuildXunitWrappers=1&shift&goto Arg_Loop)
if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop)
if /i "%1" == "PerfTests" (set __PerfTests=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTests" (set __CoreFXTests=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTestsAll" (set __CoreFXTests=true&set __CoreFXTestsRunAllAvailable=true&shift&goto Arg_Loop)
if /i "%1" == "CoreFXTestList" (set __CoreFXTests=true&set __CoreFXTestList=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop)
// This test feature is currently intentionally undocumented
if /i "%1" == "runlargeversionbubblecrossgentests" (set RunCrossGen=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop)
if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop)
REM tieredcompilation is on by default now, but setting this environment variable is harmless and I didn't want to break any automation that might be using it just yet
if /i "%1" == "tieredcompilation" (set COMPLUS_TieredCompilation=1&shift&goto Arg_Loop)
if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "altjitarch" (set __AltJitArch=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "tieredcompilation" (set COMPLUS_TieredCompilation=1&shift&goto Arg_Loop)
if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "altjitarch" (set __AltJitArch=%2&shift&shift&goto Arg_Loop)

REM change it to COMPlus_GCStress when we stop using xunit harness
if /i "%1" == "gcstresslevel" (set COMPlus_GCStress=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop)
if /i "%1" == "collectdumps" (set __CollectDumps=true&shift&goto Arg_Loop)
if /i "%1" == "gcstresslevel" (set COMPlus_GCStress=%2&set __TestTimeout=1800000&shift&shift&goto Arg_Loop)
if /i "%1" == "collectdumps" (set __CollectDumps=true&shift&goto Arg_Loop)

if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs
:: All the rest of the args will be collected and passed directly to msbuild.
Expand Down Expand Up @@ -205,6 +207,11 @@ if defined __DoCrossgen (
set __RuntestPyArgs=%__RuntestPyArgs% --precompile_core_root
)

if defined CrossgenLargeVersionBubble
(
set __RuntestPyArgs=%__RuntestPyArgs% --large_version_bubble
)

if defined __PrintLastResultsOnly (
set __RuntestPyArgs=%__RuntestPyArgs% --analyze_results_only
)
Expand Down
6 changes: 6 additions & 0 deletions tests/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
parser.add_argument("--jitdisasm", dest="jitdisasm", action="store_true", default=False)
parser.add_argument("--ilasmroundtrip", dest="ilasmroundtrip", action="store_true", default=False)
parser.add_argument("--run_crossgen_tests", dest="run_crossgen_tests", action="store_true", default=False)
parser.add_argument("--large_version_bubble", dest="large_version_bubble", action="store_true", default=False)
parser.add_argument("--precompile_core_root", dest="precompile_core_root", action="store_true", default=False)
parser.add_argument("--sequential", dest="sequential", action="store_true", default=False)

Expand Down Expand Up @@ -761,6 +762,10 @@ def run_tests(host_os,
print("Running tests R2R")
os.environ["RunCrossGen"] = "true"

if large_version_bubble:
print("Large Version Bubble enabled")
os.environ["LargeVersionBubble"] = "true"

if gc_stress:
print("Running GCStress, extending timeout to 120 minutes.")
os.environ["__TestTimeout"] = str(120*60*1000) # 1,800,000 ms
Expand Down Expand Up @@ -2047,6 +2052,7 @@ def do_setup(host_os,
is_ilasm=unprocessed_args.ilasmroundtrip,
run_sequential=unprocessed_args.sequential,
run_crossgen_tests=unprocessed_args.run_crossgen_tests,
large_version_bubble=unprocessed_args.large_version_bubble,
test_env=test_env)

################################################################################
Expand Down
5 changes: 3 additions & 2 deletions tests/src/CLRTest.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fi
REM CrossGen Script
if defined RunCrossGen (
if defined LargeVersionBubble ( set OptionalArguments=!OptionalArguments! /largeversionbubble)
set COMPlus_ZapRequire=$(ZapRequire)
set COMPlus_ZapRequireList=$(MSBuildProjectName)
if not exist "$(MSBuildProjectName).org" (
Expand All @@ -84,8 +85,8 @@ if defined RunCrossGen (
mkdir IL
copy $(MSBuildProjectName).exe IL\$(MSBuildProjectName).exe
ren $(MSBuildProjectName).exe $(MSBuildProjectName).org
echo "%_DebuggerFullPath% %CORE_ROOT%\crossgen.exe" /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe
%_DebuggerFullPath% "%CORE_ROOT%\crossgen.exe" /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe
echo "%_DebuggerFullPath% %CORE_ROOT%\crossgen.exe" !OptionalArguments! /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe
%_DebuggerFullPath% "%CORE_ROOT%\crossgen.exe" !OptionalArguments! /Platform_Assemblies_Paths %CORE_ROOT%%3B%25cd%25\IL%3B%25cd%25 /in $(MSBuildProjectName).org /out $(MSBuildProjectName).exe
set CrossGenStatus=!ERRORLEVEL!
)
call :ReleaseLock
Expand Down
13 changes: 13 additions & 0 deletions tests/src/readytorun/tests/versionbubbles/helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;

public class Helper
{
[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
public string GetLastMethodName()
{
StackTrace st = new StackTrace();
return st.GetFrame(0).GetMethod().Name;
}
}
33 changes: 33 additions & 0 deletions tests/src/readytorun/tests/versionbubbles/helper.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</ProjectGuid>
<OutputType>library</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
<DefineConstants>$(DefineConstants);STATIC;CORECLR</DefineConstants>
<CLRTestKind>SharedLibrary</CLRTestKind>
<Optimize>True</Optimize>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
</PropertyGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include=".\helper.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
46 changes: 46 additions & 0 deletions tests/src/readytorun/tests/versionbubbles/versionbubbles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;

public class Program
{
public static int Main()
{
return RunTest();
}

public static int RunTest()
{
Helper helper = new Helper();
string lastMethodName = String.Empty;
try
{
lastMethodName = helper.GetLastMethodName();
}
catch (System.MissingMethodException e)
{
if((System.Environment.GetEnvironmentVariable("LargeVersionBubble") != null))
{
// Cross-Assembly inlining is only allowed in multi-module version bubbles
Console.WriteLine("FAIL");
return 101;
}
else
{
// The missing method is expected in the default crossgen case (i.e. no large version bubble)
Console.WriteLine("PASS");
return 100;
}
}

if (lastMethodName != "GetNumber")
{
// method in helper.cs has been inlined
Console.WriteLine("PASS");
return 100;
}
else
{
Console.WriteLine("FAIL");
return 101;
}
}
}
59 changes: 59 additions & 0 deletions tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7DECC55A-B584-4456-83BA-6C42A5B3B3CB}</ProjectGuid>
<OutputType>exe</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<CLRTestKind>BuildAndRun</CLRTestKind>
<DefineConstants>$(DefineConstants);STATIC;CORECLR</DefineConstants>
<ZapRequire>1</ZapRequire>
<CLRTestPriority>1</CLRTestPriority>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
</PropertyGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<ProjectReference Include=".\helper.csproj">
<Project>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="versionbubbles.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<PropertyGroup>
<!-- <CLRTestBatchPreCommands><![CDATA[
echo Running CLRTestBatchPreCommands
$(CLRTestBatchPreCommands)
Set COMPLUS_ZAPREQUIRE=1
Set COMPLUS_ZAPREQUIRELIST=helper
set _inputFile=versionbubbles.exe
if exist "versionbubbles.org" (set _inputFile=versionbubbles.org)
%Core_Root%\crossgen /largeversionbubble /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out helper.ni.dll helper.dll
%Core_Root%\crossgen /largeversionbubble /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out versionbubbles.ni.exe %_inputFile%
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
echo Running BashCLRTestPreCommands
$(BashCLRTestPreCommands)
$CORE_ROOT/crossgen -readytorun -platform_assemblies_paths $CORE_ROOT:`pwd` -out helper.ni.dll helper.dll
$CORE_ROOT/crossgen -readytorun -platform_assemblies_paths $CORE_ROOT:`pwd` -out versionbubbles.ni.exe versionbubbles.exe
]]></BashCLRTestPreCommands> -->
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

0 comments on commit e76d09a

Please sign in to comment.