Add tests. Make appdomain-unload work again
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 2 Aug 2010 02:33:44 +0000 (22:33 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 2 Aug 2010 02:36:29 +0000 (22:36 -0400)
* Makefile.am: added 2 new tests
* threadpool-exceptions6.cs: new thread.abort inside the threadpool
test.
* appdomain-unload.exe.config: this test does not work in .NET without
having the legacy unhandled exception mode enabled.

mono/tests/Makefile.am
mono/tests/appdomain-unload.exe.config [new file with mode: 0644]
mono/tests/threadpool-exceptions6.cs [new file with mode: 0644]

index 66f02beb616cfb5807e6c4b3aed4b5918485d6ff..16a2abddeac15c4ad50c7ed8f48cf6c9792ff7c9 100644 (file)
@@ -219,6 +219,8 @@ BASE_TEST_CS_SRC=           \
        threadpool-exceptions2.cs \
        threadpool-exceptions3.cs \
        threadpool-exceptions4.cs \
+       threadpool-exceptions5.cs \
+       threadpool-exceptions6.cs \
        base-definition.cs      \
        bug-27420.cs            \
        bug-47295.cs            \
@@ -695,6 +697,7 @@ test-inline-call-stack.exe: TestDriver.dll test-inline-call-stack-library.dll $(
 
 EXTRA_DIST += unhandled-exception-base-configuration.config
 EXTRA_DIST += unhandled-exception-legacy-configuration.config
+EXTRA_DIST += appdomain-unload.exe.config
 EXTRA_DIST += unhandled-exception-test-case.2.cs
 EXTRA_DIST += unhandled-exception-test-runner.2.cs
 unhandled-exception-test-case.1.cs: unhandled-exception-test-case.2.cs
diff --git a/mono/tests/appdomain-unload.exe.config b/mono/tests/appdomain-unload.exe.config
new file mode 100644 (file)
index 0000000..b9680d2
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <runtime>
+    <legacyUnhandledExceptionPolicy enabled="1"/>
+  </runtime>
+</configuration>
diff --git a/mono/tests/threadpool-exceptions6.cs b/mono/tests/threadpool-exceptions6.cs
new file mode 100644 (file)
index 0000000..5612106
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using System.Threading;
+
+class Test {
+       static int Main ()
+       {
+               AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
+               WaitCallback wcb = new WaitCallback ((a) => {
+                       Thread.CurrentThread.Abort ();
+               });
+               wcb.BeginInvoke (wcb, null, null);
+               Thread.Sleep (1000);
+               return 0;
+       }
+
+       static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
+       {
+               Environment.Exit (1);
+       }
+}
+