summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Directed/throwbox
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2015-06-10 13:11:59 -0700
committerPat Gavlin <pagavlin@microsoft.com>2015-06-10 21:31:41 -0700
commit937180e726dd08c84852a835bd711157769aed2b (patch)
tree8b9c350368cb9f2c57c2fea77d4cc90b51a80dd2 /tests/src/JIT/Directed/throwbox
parentc65178cbb205f8573c84791a31836fb3a7dd237e (diff)
downloadcoreclr-937180e726dd08c84852a835bd711157769aed2b.tar.gz
coreclr-937180e726dd08c84852a835bd711157769aed2b.tar.bz2
coreclr-937180e726dd08c84852a835bd711157769aed2b.zip
Import the first batch of IL tests.
This set of tests is comprised of IL tests that: - only reference APIs in .Net Core's System.Runtime, System.Runtime.Extensions, and System.Threading contracts - compile to a single executable, - and expect no command line arguments at runtime.
Diffstat (limited to 'tests/src/JIT/Directed/throwbox')
-rw-r--r--tests/src/JIT/Directed/throwbox/app.config27
-rw-r--r--tests/src/JIT/Directed/throwbox/fault.il111
-rw-r--r--tests/src/JIT/Directed/throwbox/filter.il76
-rw-r--r--tests/src/JIT/Directed/throwbox/finally.il111
-rw-r--r--tests/src/JIT/Directed/throwbox/il_template.proj42
-rw-r--r--tests/src/JIT/Directed/throwbox/packages.config6
-rw-r--r--tests/src/JIT/Directed/throwbox/rethrow.il126
-rw-r--r--tests/src/JIT/Directed/throwbox/throwbox.ilproj19
8 files changed, 518 insertions, 0 deletions
diff --git a/tests/src/JIT/Directed/throwbox/app.config b/tests/src/JIT/Directed/throwbox/app.config
new file mode 100644
index 0000000000..8077c95440
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/app.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/throwbox/fault.il b/tests/src/JIT/Directed/throwbox/fault.il
new file mode 100644
index 0000000000..5b44dd6233
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/fault.il
@@ -0,0 +1,111 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+.assembly extern mscorlib { }
+.assembly 'fault' { }
+.namespace JitTest
+{
+ .class private auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+ {
+ .method private hidebysig static int32
+ Main() cil managed
+ {
+ .entrypoint
+ // Code size 115 (0x73)
+ .maxstack 2
+ .locals (bool V_0,
+ bool V_1,
+ bool V_2,
+ int32 V_3)
+ IL_0000: ldc.i4.1
+ IL_0001: stloc.0
+ IL_0002: ldc.i4.0
+ IL_0003: stloc.1
+ IL_0004: ldc.i4.0
+ IL_0005: stloc.2
+ .try
+ {
+ IL_0006: ldstr "before try...fault"
+ IL_000b: call void [mscorlib]System.Console::WriteLine(string)
+ .try
+ {
+ IL_0010: ldstr "inside try"
+ IL_0015: call void [mscorlib]System.Console::WriteLine(string)
+ IL_001a: ldloc.0
+ IL_001b: brfalse.s IL_0023
+
+ ldc.r8 1.0
+ box float64
+ throw
+
+ IL_0023: leave.s IL_0032
+
+ } // end .try
+ fault
+ {
+ IL_0025: ldc.i4.1
+ IL_0026: stloc.1
+ IL_0027: ldstr "inside fault"
+ IL_002c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0031: endfinally
+ } // end handler
+ IL_0032: ldstr "after try...fault"
+ IL_0037: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003c: leave.s IL_004d
+
+ } // end .try
+ catch [mscorlib]System.Double
+ {
+ unbox float64
+ ldind.r8
+ ldc.r8 1.0
+ ceq
+ brfalse LEAVE
+
+ IL_003f: ldstr "inside catch"
+ IL_0044: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0049: ldc.i4.1
+ IL_004a: stloc.2
+ LEAVE:
+ IL_004b: leave.s IL_004d
+
+ } // end handler
+ IL_004d: ldloc.1
+ IL_004e: brfalse.s IL_0062
+
+ IL_0050: ldloc.2
+ IL_0051: brfalse.s IL_0062
+
+ IL_0053: ldstr "Passed => 100"
+ IL_0058: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005d: ldc.i4.s 100
+ IL_005f: stloc.3
+ IL_0060: br.s IL_0071
+
+ IL_0062: ldstr "Failed => 101"
+ IL_0067: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006c: ldc.i4.s 101
+ IL_006e: stloc.3
+ IL_006f: br.s IL_0071
+
+ IL_0071: ldloc.3
+ IL_0072: ret
+ } // end of method Test::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+ } // end of class Test
+
+} // end of namespace JitTest
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file finally.res
diff --git a/tests/src/JIT/Directed/throwbox/filter.il b/tests/src/JIT/Directed/throwbox/filter.il
new file mode 100644
index 0000000000..b8591c534b
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/filter.il
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+.assembly extern mscorlib { }
+.assembly 'filter' { }
+.namespace JitTest
+{
+ .class private auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+ {
+ .method private hidebysig static int32
+ Main() cil managed
+ {
+ .entrypoint
+ // Code size 120 (0x78)
+ .maxstack 2
+
+ TRY_1:
+ ldstr "inside 1st try"
+ call void [mscorlib]System.Console::WriteLine(string)
+ ldc.r4 1.0
+ box float32
+ throw
+ leave.s END_1
+
+ FILTER_1:
+ ldstr "entering filter"
+ call void [mscorlib]System.Console::WriteLine(string)
+ isinst [mscorlib]System.Single
+ br MAKE_JIT_WORK
+
+ MAKE_JIT_WORK:
+ unbox float32
+ ldind.r4
+ ldc.r4 1.0
+ ceq
+ brtrue OK_1
+
+ ldstr "bad value in filter!"
+ call void [mscorlib]System.Console::WriteLine(string)
+ ldc.i4.0
+ br.s MERGE_1
+
+ OK_1:
+ ldstr "leaving filter"
+ call void [mscorlib]System.Console::WriteLine(string)
+ ldc.i4.1
+
+ MERGE_1:
+ endfilter
+
+ HANDLER_1:
+ ldstr "inside _except"
+ call void [mscorlib]System.Console::WriteLine(string)
+ pop
+ leave.s END_1
+
+ END_1:
+ ldc.i4 100
+ ret
+ .try TRY_1 to FILTER_1 filter FILTER_1 handler HANDLER_1 to END_1
+ } // end of method Test::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+ } // end of class Test
+
+} // end of namespace JitTest
diff --git a/tests/src/JIT/Directed/throwbox/finally.il b/tests/src/JIT/Directed/throwbox/finally.il
new file mode 100644
index 0000000000..2cb094d2ba
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/finally.il
@@ -0,0 +1,111 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+.assembly extern mscorlib { }
+.assembly 'finally' { }
+.namespace JitTest
+{
+ .class private auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+ {
+ .method private hidebysig static int32
+ Main() cil managed
+ {
+ .entrypoint
+ // Code size 115 (0x73)
+ .maxstack 2
+ .locals (bool V_0,
+ bool V_1,
+ bool V_2,
+ int32 V_3)
+ IL_0000: ldc.i4.1
+ IL_0001: stloc.0
+ IL_0002: ldc.i4.0
+ IL_0003: stloc.1
+ IL_0004: ldc.i4.0
+ IL_0005: stloc.2
+ .try
+ {
+ IL_0006: ldstr "before try...finally"
+ IL_000b: call void [mscorlib]System.Console::WriteLine(string)
+ .try
+ {
+ IL_0010: ldstr "inside try"
+ IL_0015: call void [mscorlib]System.Console::WriteLine(string)
+ IL_001a: ldloc.0
+ IL_001b: brfalse.s IL_0023
+
+ ldc.r8 1.0
+ box float64
+ throw
+
+ IL_0023: leave.s IL_0032
+
+ } // end .try
+ finally
+ {
+ IL_0025: ldc.i4.1
+ IL_0026: stloc.1
+ IL_0027: ldstr "inside finally"
+ IL_002c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0031: endfinally
+ } // end handler
+ IL_0032: ldstr "after try...finally"
+ IL_0037: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003c: leave.s IL_004d
+
+ } // end .try
+ catch [mscorlib]System.Double
+ {
+ unbox float64
+ ldind.r8
+ ldc.r8 1.0
+ ceq
+ brfalse LEAVE
+
+ IL_003f: ldstr "inside catch"
+ IL_0044: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0049: ldc.i4.1
+ IL_004a: stloc.2
+ LEAVE:
+ IL_004b: leave.s IL_004d
+
+ } // end handler
+ IL_004d: ldloc.1
+ IL_004e: brfalse.s IL_0062
+
+ IL_0050: ldloc.2
+ IL_0051: brfalse.s IL_0062
+
+ IL_0053: ldstr "Passed => 100"
+ IL_0058: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005d: ldc.i4.s 100
+ IL_005f: stloc.3
+ IL_0060: br.s IL_0071
+
+ IL_0062: ldstr "Failed => 101"
+ IL_0067: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006c: ldc.i4.s 101
+ IL_006e: stloc.3
+ IL_006f: br.s IL_0071
+
+ IL_0071: ldloc.3
+ IL_0072: ret
+ } // end of method Test::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+ } // end of class Test
+
+} // end of namespace JitTest
+
+//*********** DISASSEMBLY COMPLETE ***********************
+// WARNING: Created Win32 resource file finally.res
diff --git a/tests/src/JIT/Directed/throwbox/il_template.proj b/tests/src/JIT/Directed/throwbox/il_template.proj
new file mode 100644
index 0000000000..cd6913e79e
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/il_template.proj
@@ -0,0 +1,42 @@
+<?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>$(AssemblyName1)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <ProjectLanguage>IL</ProjectLanguage>
+ </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>
+ <ItemGroup>
+ <Compile Include="$(AssemblyName1).il" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ <None Include="app.config" />
+ </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
diff --git a/tests/src/JIT/Directed/throwbox/packages.config b/tests/src/JIT/Directed/throwbox/packages.config
new file mode 100644
index 0000000000..37e10b961a
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/packages.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="System.Console" version="4.0.0-beta-22405" />
+ <package id="System.Runtime" version="4.0.20-beta-22405" />
+ <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" />
+</packages> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/throwbox/rethrow.il b/tests/src/JIT/Directed/throwbox/rethrow.il
new file mode 100644
index 0000000000..53df19cfb6
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/rethrow.il
@@ -0,0 +1,126 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+.assembly extern mscorlib { }
+.assembly 'rethrow' { }
+.namespace JitTest
+{
+ .class private auto ansi beforefieldinit Test
+ extends [mscorlib]System.Object
+ {
+ .method private hidebysig static int32
+ Main() cil managed
+ {
+ .entrypoint
+ // Code size 120 (0x78)
+ .maxstack 2
+ .locals (bool V_0,
+ bool V_1,
+ bool V_2,
+ object V_3,
+ int32 V_4)
+ IL_0000: ldc.i4.1
+ IL_0001: stloc.0
+ IL_0002: ldc.i4.0
+ IL_0003: stloc.1
+ IL_0004: ldc.i4.0
+ IL_0005: stloc.2
+ .try
+ {
+ IL_0006: ldstr "before 1st try...catch"
+ IL_000b: call void [mscorlib]System.Console::WriteLine(string)
+ .try
+ {
+ IL_0010: ldstr "inside 1st try"
+ IL_0015: call void [mscorlib]System.Console::WriteLine(string)
+ IL_001a: ldloc.0
+ IL_001b: brfalse.s IL_0023
+
+ ldc.r4 1.0
+ box float32
+ throw
+
+ IL_0023: leave.s IL_0034
+
+ } // end .try
+ catch [mscorlib]System.Single
+ {
+ stloc.3
+ ldloc.3
+ unbox float32
+ ldind.r4
+ ldc.r4 1.0
+ ceq
+ brfalse NEXT
+
+ ldc.i4.1
+ stloc.1
+ ldstr "inside 1st catch"
+ call void [mscorlib]System.Console::WriteLine(string)
+
+ NEXT:
+ ldloc.3
+ unbox float32
+ ldc.r4 11.0
+ stind.r4
+ rethrow
+
+ } // end handler
+ IL_0034: ldstr "after 1st try...catch"
+ IL_0039: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003e: leave.s IL_004f
+
+ } // end .try
+ catch [mscorlib]System.Single
+ {
+ unbox float32
+ ldind.r4
+ ldc.r4 11.0
+ ceq
+ brfalse NEXT1
+
+ ldstr "inside catch"
+ call void [mscorlib]System.Console::WriteLine(string)
+ ldc.i4.1
+ stloc.2
+
+ NEXT1:
+
+ leave.s IL_004f
+
+ } // end handler
+ IL_004f: ldloc.1
+ IL_0050: brfalse.s IL_0065
+
+ IL_0052: ldloc.2
+ IL_0053: brfalse.s IL_0065
+
+ IL_0055: ldstr "Passed => 100"
+ IL_005a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005f: ldc.i4.s 100
+ IL_0061: stloc.s V_4
+ IL_0063: br.s IL_0075
+
+ IL_0065: ldstr "Failed => 101"
+ IL_006a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006f: ldc.i4.s 101
+ IL_0071: stloc.s V_4
+ IL_0073: br.s IL_0075
+
+ IL_0075: ldloc.s V_4
+ IL_0077: ret
+ } // end of method Test::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Test::.ctor
+
+ } // end of class Test
+
+} // end of namespace JitTest
diff --git a/tests/src/JIT/Directed/throwbox/throwbox.ilproj b/tests/src/JIT/Directed/throwbox/throwbox.ilproj
new file mode 100644
index 0000000000..c641f8da8a
--- /dev/null
+++ b/tests/src/JIT/Directed/throwbox/throwbox.ilproj
@@ -0,0 +1,19 @@
+<?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" />
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <Target Name="Build">
+ <ItemGroup>
+ <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.il" />
+ </ItemGroup>
+ <PropertyGroup>
+ <GenerateRunScript>false</GenerateRunScript>
+ </PropertyGroup>
+ <MSBuild Projects="il_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" />
+ </Target>
+</Project> \ No newline at end of file