summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorAndon Andonov <anandono@microsoft.com>2019-01-14 19:59:12 -0800
committerGitHub <noreply@github.com>2019-01-14 19:59:12 -0800
commit9fe3286e3810298934315e999580edd78c3322c2 (patch)
tree79258a0ed5b043cc7a0ecac0131a77e58753e436 /tests/src
parentdbdae9cc324a97ebc9199b973abe9a21b1177f01 (diff)
downloadcoreclr-9fe3286e3810298934315e999580edd78c3322c2.tar.gz
coreclr-9fe3286e3810298934315e999580edd78c3322c2.tar.bz2
coreclr-9fe3286e3810298934315e999580edd78c3322c2.zip
Large version bubble Support (#21727)
* Preliminary Changes * Module Index Resolution * Change infoModule encoding * Change referencing module in R2R * Pre-condition Check * Virtual Method Module Resolution * Remove Workarounds and add conditional import loading * Add signature kind module override * Add ELEMENT_TYPE_MODULE_ZAPSIG * Add switch to enable large version bubble * Cleanup * Change Native header check * Add large version bubble test * Add Large Version Bubble Checks * Cleanup * Revert unnecessary check * Change EncodeMethod Version Bubble Condition * Add Large Version Bubble asserts * Cleanup * Add default argument to runtests.py * Change test PreCommands * Revert whitespace changes * Change breaking conditional check * Streamline Version Bubble test * Address PR Feedback * Address PR Feedback #2 * Remove dead code * Add crossgen-time ifdef
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/CLRTest.CrossGen.targets5
-rw-r--r--tests/src/readytorun/tests/versionbubbles/helper.cs13
-rw-r--r--tests/src/readytorun/tests/versionbubbles/helper.csproj33
-rw-r--r--tests/src/readytorun/tests/versionbubbles/versionbubbles.cs41
-rw-r--r--tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj58
5 files changed, 148 insertions, 2 deletions
diff --git a/tests/src/CLRTest.CrossGen.targets b/tests/src/CLRTest.CrossGen.targets
index 7dddfa2c36..9dc441f636 100644
--- a/tests/src/CLRTest.CrossGen.targets
+++ b/tests/src/CLRTest.CrossGen.targets
@@ -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" (
@@ -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
diff --git a/tests/src/readytorun/tests/versionbubbles/helper.cs b/tests/src/readytorun/tests/versionbubbles/helper.cs
new file mode 100644
index 0000000000..0fc5aa66ec
--- /dev/null
+++ b/tests/src/readytorun/tests/versionbubbles/helper.cs
@@ -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;
+ }
+}
diff --git a/tests/src/readytorun/tests/versionbubbles/helper.csproj b/tests/src/readytorun/tests/versionbubbles/helper.csproj
new file mode 100644
index 0000000000..a11d2b0cf7
--- /dev/null
+++ b/tests/src/readytorun/tests/versionbubbles/helper.csproj
@@ -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>
diff --git a/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs b/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs
new file mode 100644
index 0000000000..fd1f596571
--- /dev/null
+++ b/tests/src/readytorun/tests/versionbubbles/versionbubbles.cs
@@ -0,0 +1,41 @@
+using System;
+
+public class Program
+{
+ public static int Main()
+ {
+ return RunTest();
+ }
+
+ public static int RunTest()
+ {
+
+ Helper helper = new Helper();
+ string lastMethodName = String.Empty;
+
+ lastMethodName = helper.GetLastMethodName();
+
+ if((System.Environment.GetEnvironmentVariable("LargeVersionBubble") == null))
+ {
+ // Cross-Assembly inlining is only allowed in multi-module version bubbles
+ Console.WriteLine("Large Version Bubble is disabled.");
+ Console.WriteLine("PASS");
+ return 100;
+ }
+
+ Console.WriteLine("Large Version Bubble is enabled.");
+ // Helper returns the name of the method in the last stack frame
+ // Check to see if the method has been inlined cross-module
+ if (lastMethodName != "GetLastMethodName")
+ {
+ // method in helper.cs has been inlined
+ Console.WriteLine("PASS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("FAIL");
+ return 101;
+ }
+ }
+}
diff --git a/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj b/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj
new file mode 100644
index 0000000000..2a6b749c16
--- /dev/null
+++ b/tests/src/readytorun/tests/versionbubbles/versionbubbles.csproj
@@ -0,0 +1,58 @@
+<?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[
+$(CLRTestBatchPreCommands)
+set COMPLUS_ZAPREQUIRE=1
+set COMPLUS_ZAPREQUIRELIST=helper;versionbubbles
+set _inputFile=versionbubbles.exe
+%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 versionbubbles.exe
+]]></CLRTestBatchPreCommands>
+ <BashCLRTestPreCommands><![CDATA[
+export COMPLUS_ZAPREQUIRE=1
+export COMPLUS_ZAPREQUIRELIST=helper;versionbubbles
+$(BashCLRTestPreCommands)
+$CORE_ROOT/crossgen -largeversionbubble -readytorun -platform_assemblies_paths $CORE_ROOT:`pwd` -out helper.ni.dll helper.dll
+$CORE_ROOT/crossgen -largeversionbubble -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>