summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-12-05 11:37:43 +0100
committerGitHub <noreply@github.com>2017-12-05 11:37:43 +0100
commit809b8f792923c95b9d5fee824c60dde21079cca1 (patch)
tree9aeced1d4c0ba6ef4598fae401526afec17be324 /tests
parentd714acda701d78a572b3fe36f33abcaf7e26c2df (diff)
downloadcoreclr-809b8f792923c95b9d5fee824c60dde21079cca1.tar.gz
coreclr-809b8f792923c95b9d5fee824c60dde21079cca1.tar.bz2
coreclr-809b8f792923c95b9d5fee824c60dde21079cca1.zip
Put default interfaces behind a define (#15358)
This is needed so that we can turn default interfaces off in release branches. I can't find a central location where the PRERELEASE flag could be defined because native and managed builds seem to be completely disconnected. To limit the risk of only flipping the flag in one build type, I'm adding a test that verifies being able to load an interface with default methods matches what RuntimeFeature says.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj18
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj16
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj16
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj16
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj16
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj16
-rw-r--r--tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj16
-rw-r--r--tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.il73
-rw-r--r--tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.ilproj38
9 files changed, 112 insertions, 113 deletions
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj
index de431d50eb..7a2fb51daf 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj
@@ -14,23 +14,7 @@
<ReferenceLocalMscorlib>true</ReferenceLocalMscorlib>
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
- <CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
+ <CLRTestPriority>0</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj
index 78d9162d9f..df375eb90f 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj
index 03db9c544c..463e3ed66e 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj
index 03f4842fb4..eb7660bab1 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj
index 7b6f274c1f..a97596ec68 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj
index aa2f06c9bf..0446a787c9 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj
index f928997846..f190a75059 100644
--- a/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj
+++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj
@@ -15,22 +15,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
- <UseCustomILAsm>True</UseCustomILAsm>
-
- <CLRTestBatchPreCommands>
-<![CDATA[
- $(CLRTestBatchPreCommands)
-set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </CLRTestBatchPreCommands>
- <BashCLRTestPreCommands>
-<![CDATA[
- $(BashCLRTestPreCommands)
-export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
- ]]>
- </BashCLRTestPreCommands>
-
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.il b/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.il
new file mode 100644
index 0000000000..56ff2e723d
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.il
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+//
+// Verifies that RuntimeFeature::IsSupported("DefaultImplementationsOfInterfaces") matches reality.
+// This needs to succeed no matter whether default interfaces are supported.
+//
+
+.assembly extern System.Runtime{}
+.assembly DefaultImplementationsOfInterfaces{}
+
+.class interface private abstract auto ansi DefaultInterface
+{
+ .method public hidebysig newslot virtual
+ instance void Method() cil managed
+ {
+ .maxstack 8
+ ret
+ }
+}
+
+.method private hidebysig static void TryLoadDefaultInterface() cil managed noinlining
+{
+ .maxstack 8
+ ldtoken DefaultInterface
+ call class [System.Runtime]System.Type [System.Runtime]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ callvirt instance string [System.Runtime]System.Object::ToString()
+ pop
+ ret
+}
+
+.method private hidebysig static bool SupportsDefaultInterfaces() cil managed
+{
+ .maxstack 1
+ .try
+ {
+ call void TryLoadDefaultInterface()
+ leave.s Supports
+
+ }
+ catch [System.Runtime]System.TypeLoadException
+ {
+ pop
+ leave.s DoesNotSupport
+
+ }
+ Supports:
+ ldc.i4.1
+ ret
+
+ DoesNotSupport:
+ ldc.i4.0
+ ret
+ }
+
+.method private hidebysig static int32
+ Main() cil managed
+{
+ .entrypoint
+ .maxstack 2
+ ldstr "DefaultImplementationsOfInterfaces"
+ call bool [System.Runtime]System.Runtime.CompilerServices.RuntimeFeature::IsSupported(string)
+ call bool SupportsDefaultInterfaces()
+ beq Good
+
+ ldc.i4.m1
+ ret
+
+ Good:
+ ldc.i4 100
+ ret
+}
diff --git a/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.ilproj b/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.ilproj
new file mode 100644
index 0000000000..56bfa03467
--- /dev/null
+++ b/tests/src/baseservices/compilerservices/RuntimeFeature/DefaultImplementationsOfInterfaces.ilproj
@@ -0,0 +1,38 @@
+<?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>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A8E3EED5-E6C0-4976-AC7E-70691EA00C52}</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>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="DefaultImplementationsOfInterfaces.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file