diff options
author | Sean Gillespie <segilles@microsoft.com> | 2016-02-26 14:56:07 -0800 |
---|---|---|
committer | Sean Gillespie <sean.william.g@gmail.com> | 2016-03-09 17:31:37 -0800 |
commit | f7c51223d7b3a0153b002b30f619a7f02ff4fc99 (patch) | |
tree | e27ea40b3601cd864a336e7c29aef22f15e7be49 /tests/src/GC/Coverage | |
parent | f178841cda726a30b98ae42529b0cadb6a486151 (diff) | |
download | coreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.tar.gz coreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.tar.bz2 coreclr-f7c51223d7b3a0153b002b30f619a7f02ff4fc99.zip |
Initial bringup of new set of ported GC tests.
Diffstat (limited to 'tests/src/GC/Coverage')
-rw-r--r-- | tests/src/GC/Coverage/271010.cs | 34 | ||||
-rw-r--r-- | tests/src/GC/Coverage/271010.csproj | 45 | ||||
-rw-r--r-- | tests/src/GC/Coverage/LargeObjectAlloc.csproj | 7 | ||||
-rw-r--r-- | tests/src/GC/Coverage/LargeObjectAlloc2.csproj | 6 | ||||
-rw-r--r-- | tests/src/GC/Coverage/app.config | 31 | ||||
-rw-r--r-- | tests/src/GC/Coverage/concurrentspin2.cs | 184 | ||||
-rw-r--r-- | tests/src/GC/Coverage/concurrentspin2.csproj | 45 | ||||
-rw-r--r-- | tests/src/GC/Coverage/delete_next_card_table.cs | 63 | ||||
-rw-r--r-- | tests/src/GC/Coverage/delete_next_card_table.csproj | 45 | ||||
-rw-r--r-- | tests/src/GC/Coverage/project.json | 34 | ||||
-rw-r--r-- | tests/src/GC/Coverage/smalloom.cs | 72 | ||||
-rw-r--r-- | tests/src/GC/Coverage/smalloom.csproj | 45 |
12 files changed, 575 insertions, 36 deletions
diff --git a/tests/src/GC/Coverage/271010.cs b/tests/src/GC/Coverage/271010.cs new file mode 100644 index 0000000000..64c1a19d27 --- /dev/null +++ b/tests/src/GC/Coverage/271010.cs @@ -0,0 +1,34 @@ +// 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. + +/* DESCRIPTION: regression test for VSWhidbey 271010 + * Should throw OOM + */ + +using System; +using System.Runtime.CompilerServices; + +public class Test { + + public static int Main() { + + int[][] otherarray; + + try + { + otherarray = new int[16384][]; + for(int i=0;i<16384;i++) + { + otherarray[i] = new int[1024*500]; + } + } + catch (System.OutOfMemoryException) + { + otherarray = null; + return 100; + } + return 1; + + } +} diff --git a/tests/src/GC/Coverage/271010.csproj b/tests/src/GC/Coverage/271010.csproj new file mode 100644 index 0000000000..60bb1b8dbb --- /dev/null +++ b/tests/src/GC/Coverage/271010.csproj @@ -0,0 +1,45 @@ +<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </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> + <!-- Add Compile Object Here --> + <Compile Include="271010.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <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/GC/Coverage/LargeObjectAlloc.csproj b/tests/src/GC/Coverage/LargeObjectAlloc.csproj index f9152b3369..0784021a6a 100644 --- a/tests/src/GC/Coverage/LargeObjectAlloc.csproj +++ b/tests/src/GC/Coverage/LargeObjectAlloc.csproj @@ -30,8 +30,13 @@ <Compile Include="LargeObjectAlloc.cs" /> </ItemGroup> <ItemGroup> - <None Include="project.json" /> + <None Include="app.config" /> + <None Include="$(GCPackagesConfigFileDirectory)extra\project.json" /> </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)extra\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)extra\project.lock.json</ProjectLockJson> + </PropertyGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> diff --git a/tests/src/GC/Coverage/LargeObjectAlloc2.csproj b/tests/src/GC/Coverage/LargeObjectAlloc2.csproj index 1ccf3205b8..ea304efc6d 100644 --- a/tests/src/GC/Coverage/LargeObjectAlloc2.csproj +++ b/tests/src/GC/Coverage/LargeObjectAlloc2.csproj @@ -30,8 +30,12 @@ <Compile Include="LargeObjectAlloc2.cs" /> </ItemGroup> <ItemGroup> - <None Include="project.json" /> + <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> diff --git a/tests/src/GC/Coverage/app.config b/tests/src/GC/Coverage/app.config new file mode 100644 index 0000000000..c51f616257 --- /dev/null +++ b/tests/src/GC/Coverage/app.config @@ -0,0 +1,31 @@ +<?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> + <dependentAssembly> + <assemblyIdentity name="System.Globalization" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> diff --git a/tests/src/GC/Coverage/concurrentspin2.cs b/tests/src/GC/Coverage/concurrentspin2.cs new file mode 100644 index 0000000000..23edb8bb34 --- /dev/null +++ b/tests/src/GC/Coverage/concurrentspin2.cs @@ -0,0 +1,184 @@ +// 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. + +using System; +using System.Diagnostics; +using System.Threading; + +class PriorityTest +{ + private byte[][] old; + private byte[][] med; + private Random rand; + + private int oldDataSize; + private int medDataSize; + private int iterCount; + private int meanAllocSize; + private int medTime; + private int youngTime; + + + public PriorityTest(int oldDataSize, int medDataSize, + int iterCount, int meanAllocSize, + int medTime, int youngTime) + { + rand = new Random(314159); + this.oldDataSize = oldDataSize; + this.medDataSize = medDataSize; + this.iterCount = iterCount; + this.meanAllocSize = meanAllocSize; + this.medTime = medTime; + this.youngTime = youngTime; + } + + // creates initial arrays + void AllocTest(int oldDataSize, int medDataSize, int meanAllocSize) + { + old = new byte[oldDataSize][]; + med = new byte[medDataSize][]; + + for (int i = 0; i < old.Length; i++) + { + old[i] = new byte[meanAllocSize]; + } + + for (int i = 0; i < med.Length; i++) + { + med[i] = new byte[meanAllocSize]; + } + } + + // churns data in the heap by replacing byte arrays with new ones of random length + // this should induce concurrent GCs + void SteadyState(int oldDataSize, int medDataSize, + int iterCount, int meanAllocSize, + int medTime, int youngTime) + { + + for (int i = 0; i < iterCount; i++) + { + byte[] newarray = new byte[meanAllocSize]; + + if ((i % medTime) == 0) + { + old[rand.Next(0, old.Length)] = newarray; + } + if ((i % youngTime) == 0) + { + med[rand.Next(0, med.Length)] = newarray; + } + //if (((i % 5000) == 0) && (Thread.CurrentThread.Priority != ThreadPriority.Lowest)) + //{ + // Thread.Sleep(200); + //} + } + } + + // method that runs the test + public void RunTest() + { + for (int iteration = 0; iteration < iterCount; iteration++) + { + AllocTest(oldDataSize, medDataSize, meanAllocSize); + + SteadyState(oldDataSize, medDataSize, + iterCount, meanAllocSize, + medTime, youngTime); + + if (((iteration + 1) % 20) == 0) + Console.WriteLine("Thread: {1} Finished iteration {0}", iteration, System.Threading.Thread.CurrentThread.Name); + } + + } + +} + + +class ConcurrentRepro +{ + + public static void Usage() + { + Console.WriteLine("Usage:"); + Console.WriteLine("\t<num iterations> <num threads>"); + } + + public static int[] ParseArgs(string[] args) + { + int[] parameters = new int[2]; + + // set defaults + parameters[0] = 100; + parameters[1] = 4; + + if (args.Length == 0) + { + //use defaults + Console.WriteLine("Using defaults: 100 iterations, 4 threads"); + return parameters; + } + if (args.Length == parameters.Length) + { + for (int i = 0; i < args.Length; i++) + { + int j = 0; + if (!int.TryParse(args[i], out j)) + { + Usage(); + return null; + } + parameters[i] = j; + } + + return parameters; + } + + // incorrect number of arguments + Usage(); + return null; + } + + + public static int Main(string[] args) + { + + // parse arguments + int[] parameters = ParseArgs(args); + if (parameters == null) + { + return 0; + } + + // set process affinity to 1 to repro bug easier + //Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)1; + + + PriorityTest priorityTest = new PriorityTest(1000000, 5000, parameters[0], 17, 30, 3); + ThreadStart startDelegate = new ThreadStart(priorityTest.RunTest); + + // create threads + Thread[] threads = new Thread[parameters[1]]; + for (int i = 0; i < threads.Length; i++) + { + threads[i] = new Thread(startDelegate); + threads[i].Name = String.Format("Thread{0}", i); + //if (i % 2 == 0) + //{ + // threads[i].Priority = ThreadPriority.Lowest; + //} + threads[i].Start(); + } + + // wait for threads to complete + for (int i = 0; i < threads.Length; i++) + { + threads[i].Join(); + } + + return 100; + } +} + + diff --git a/tests/src/GC/Coverage/concurrentspin2.csproj b/tests/src/GC/Coverage/concurrentspin2.csproj new file mode 100644 index 0000000000..7e63affeba --- /dev/null +++ b/tests/src/GC/Coverage/concurrentspin2.csproj @@ -0,0 +1,45 @@ +<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </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> + <!-- Add Compile Object Here --> + <Compile Include="ConcurrentSpin2.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <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/GC/Coverage/delete_next_card_table.cs b/tests/src/GC/Coverage/delete_next_card_table.cs new file mode 100644 index 0000000000..ad0bd5ca3f --- /dev/null +++ b/tests/src/GC/Coverage/delete_next_card_table.cs @@ -0,0 +1,63 @@ +// 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. + +/* TEST: delete_next_card_table + * DESCRIPTION: gains 14 blocks in gc.cpp + mscorwks!WKS::delete_next_card_table: (7 blocks, 11 arcs) + mscorwks!SVR::delete_next_card_table: (7 blocks, 11 arcs) + */ + +using System; +using System.Collections; + +public class delete_next_card_table +{ + public static int Main() + { + new delete_next_card_table().DoMemoryChurn(); + return 100; + } + + // this function attempts to allocate & free large amounts + // of memory to ensure our objects remain pinned, don't get + // relocated, etc... + void DoMemoryChurn() + { + + Random r = new Random(); + for (int j = 0; j < 10; j++) + { + Console.Write("Churn loop {0}", j); + + try + { + // arraylist keeps everything rooted until we run out of memory + //ArrayList al = new ArrayList(); + object[] objArray = new object[32]; + int len = 1; + + for (int i = 0; i < 32; i++) // todo: this should be based upon size of IntPtr (32 bits on 32 bit platforms, 64 on 64 bit platforms) + { + Console.Write("."); + + if (i < 30) + { + // Random.Next cannot handle negative (0x80000000) numbers + len *= 2; + } + //al.Add(new Guid[len + r.Next(len)]); + objArray[i] = new Guid[len + r.Next(len)]; + } + } + catch (OutOfMemoryException) + { + Console.WriteLine("OOM while Churning"); + GC.Collect(); + } + + Console.WriteLine(); + } + } +} + diff --git a/tests/src/GC/Coverage/delete_next_card_table.csproj b/tests/src/GC/Coverage/delete_next_card_table.csproj new file mode 100644 index 0000000000..bd6d96f975 --- /dev/null +++ b/tests/src/GC/Coverage/delete_next_card_table.csproj @@ -0,0 +1,45 @@ +<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </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> + <!-- Add Compile Object Here --> + <Compile Include="delete_next_card_table.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <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/GC/Coverage/project.json b/tests/src/GC/Coverage/project.json deleted file mode 100644 index 14c11d232b..0000000000 --- a/tests/src/GC/Coverage/project.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1-rc2-23816", - "System.Collections": "4.0.10", - "System.Collections.NonGeneric": "4.0.1-beta-23302", - "System.Collections.Specialized": "4.0.1-beta-23302", - "System.ComponentModel": "4.0.1-beta-23302", - "System.Console": "4.0.0-beta-23302", - "System.Diagnostics.Process": "4.0.0-beta-23302", - "System.Globalization": "4.0.10", - "System.Globalization.Calendars": "4.0.0", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Linq": "4.0.1-beta-23302", - "System.Linq.Queryable": "4.0.1-beta-23302", - "System.Reflection": "4.0.10", - "System.Reflection.Primitives": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Runtime.InteropServices": "4.0.20", - "System.Runtime.Loader": "4.0.0-beta-23302", - "System.Text.Encoding": "4.0.10", - "System.Threading": "4.0.10", - "System.Xml.ReaderWriter": "4.0.11-beta-23302", - "System.Xml.XDocument": "4.0.11-beta-23302", - "System.Xml.XmlDocument": "4.0.1-beta-23302", - "System.Xml.XmlSerializer": "4.0.11-beta-23302" - }, - "frameworks": { - "dnxcore50": {} - } -} diff --git a/tests/src/GC/Coverage/smalloom.cs b/tests/src/GC/Coverage/smalloom.cs new file mode 100644 index 0000000000..a640c30c9d --- /dev/null +++ b/tests/src/GC/Coverage/smalloom.cs @@ -0,0 +1,72 @@ +// 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. + +//Regression test for Dev 10 bug 479239: GC hangs on x86 rather than throwing OOM + +using System; +using System.Runtime; + +class TestClass +{ + public static int Main() + { + ByteArrayList list = new ByteArrayList(); + + + try + { + while (true) + { + list.AddByteArray(84500); + } + } + catch (OutOfMemoryException) + { + } + + Console.Write("NodesAllocated: "); + Console.WriteLine(list.NodeCount); + return 100; + } + + class ByteArrayList + { + class Node + { + byte[] data = null; + int size = 0; + public Node next = null; + + public Node(int Size) + { + data = new byte[Size]; + size = Size; + } + + } + + Node head; + + public int NodeCount = 0; + public ByteArrayList() + { + head = null; + } + + public void AddByteArray(int size) + { + Node newNode = new Node(size); + + if (head == null) + head = newNode; + else + { + newNode.next = head; + head = newNode; + } + NodeCount++; + } + } + +}
\ No newline at end of file diff --git a/tests/src/GC/Coverage/smalloom.csproj b/tests/src/GC/Coverage/smalloom.csproj new file mode 100644 index 0000000000..6f2fb9d4a2 --- /dev/null +++ b/tests/src/GC/Coverage/smalloom.csproj @@ -0,0 +1,45 @@ +<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </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> + <!-- Add Compile Object Here --> + <Compile Include="smalloom.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="$(GCPackagesConfigFileDirectory)minimal\project.json" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(GCPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(GCPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <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 |