Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Henry <ludovic@xamarin.com>2015-10-25 17:47:54 +0300
committerLudovic Henry <ludovic@xamarin.com>2015-10-28 16:18:10 +0300
commit45ba0107ea197d363c6c4372f0a010b6daa306ef (patch)
tree17f29f1175c31de3bc846d5cbd5289e97199fd1d /acceptance-tests/GCStressTests
parentb58fc1009b7c1f18b1e04819a56e519bb507fe9e (diff)
[tests] Add coreclr GC stress tests
Diffstat (limited to 'acceptance-tests/GCStressTests')
-rw-r--r--acceptance-tests/GCStressTests/AssemblyExtensions.cs14
-rw-r--r--acceptance-tests/GCStressTests/AssemblyLoadContext.cs41
2 files changed, 55 insertions, 0 deletions
diff --git a/acceptance-tests/GCStressTests/AssemblyExtensions.cs b/acceptance-tests/GCStressTests/AssemblyExtensions.cs
new file mode 100644
index 00000000000..418d5db66eb
--- /dev/null
+++ b/acceptance-tests/GCStressTests/AssemblyExtensions.cs
@@ -0,0 +1,14 @@
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace System.Runtime.Loader
+{
+ public static class AssemblyExtensions
+ {
+ public static Type[] GetTypes(this Assembly assembly)
+ {
+ return assembly.GetTypes ();
+ }
+ }
+}
diff --git a/acceptance-tests/GCStressTests/AssemblyLoadContext.cs b/acceptance-tests/GCStressTests/AssemblyLoadContext.cs
new file mode 100644
index 00000000000..b3a2c483453
--- /dev/null
+++ b/acceptance-tests/GCStressTests/AssemblyLoadContext.cs
@@ -0,0 +1,41 @@
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace System.Runtime.Loader
+{
+ public abstract class AssemblyLoadContext
+ {
+ protected abstract Assembly Load(AssemblyName assemblyName);
+
+ protected Assembly LoadFromAssemblyPath(string assemblyPath)
+ {
+ if (assemblyPath == null)
+ throw new ArgumentNullException("assemblyPath");
+
+ if (!Path.IsPathRooted(assemblyPath))
+ throw new ArgumentException("Gimme an absolute path " + assemblyPath + " XXX " + Path.GetPathRoot(assemblyPath), "assemblyPath");
+
+ return Assembly.LoadFrom (assemblyPath);
+ }
+
+ public Assembly LoadFromAssemblyName(AssemblyName assemblyName)
+ {
+ // AssemblyName is mutable. Cache the expected name before anybody gets a chance to modify it.
+ string requestedSimpleName = assemblyName.Name;
+
+ Assembly assembly = Load(assemblyName);
+ if (assembly == null)
+ throw new FileLoadException("File not found", requestedSimpleName);
+
+ return assembly;
+ }
+
+ public static AssemblyName GetAssemblyName(string assemblyPath)
+ {
+ if (!File.Exists (assemblyPath))
+ throw new Exception ("file not found");
+ return new AssemblyName (Path.GetFileName (assemblyPath));
+ }
+ }
+}