Author: gert
Date: 2008-01-12 08:39:35 -0500 (Sat, 12 Jan 2008)
New Revision: 92727
Added:
trunk/gert/standalone/bug350530/
trunk/gert/standalone/bug350530/a.cs
trunk/gert/standalone/bug350530/b.cs
trunk/gert/standalone/bug350530/default.build
trunk/gert/standalone/bug350530/test.cs
Log:
Added test for bug #350530.
Added: trunk/gert/standalone/bug350530/a.cs
===================================================================
--- trunk/gert/standalone/bug350530/a.cs 2008-01-12 12:48:20 UTC (rev
92726)
+++ trunk/gert/standalone/bug350530/a.cs 2008-01-12 13:39:35 UTC (rev
92727)
@@ -0,0 +1,22 @@
+using System;
+using System.IO;
+
+namespace MyAssembly
+{
+ class MainClass
+ {
+ static void Main (string [] args)
+ {
+ string tempFile;
+
+ if (args.Length != 1) {
+ string dir =
AppDomain.CurrentDomain.BaseDirectory;
+ tempFile = Path.Combine (dir, "temp");
+ } else {
+ tempFile = args [0];
+ }
+
+ File.Create (tempFile).Close ();
+ }
+ }
+}
Property changes on: trunk/gert/standalone/bug350530/a.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug350530/b.cs
===================================================================
--- trunk/gert/standalone/bug350530/b.cs 2008-01-12 12:48:20 UTC (rev
92726)
+++ trunk/gert/standalone/bug350530/b.cs 2008-01-12 13:39:35 UTC (rev
92727)
@@ -0,0 +1,3 @@
+class B
+{
+}
Property changes on: trunk/gert/standalone/bug350530/b.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug350530/default.build
===================================================================
--- trunk/gert/standalone/bug350530/default.build 2008-01-12 12:48:20 UTC
(rev 92726)
+++ trunk/gert/standalone/bug350530/default.build 2008-01-12 13:39:35 UTC
(rev 92727)
@@ -0,0 +1,44 @@
+<project name="bug350530" default="rebuild">
+ <include buildfile="../../build/common.build" />
+
+ <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+ <target name="clean">
+ <delete>
+ <fileset>
+ <include name="a.exe" />
+ <include name="b.dll" />
+ <include name="c.dll" />
+ <include name="log" />
+ <include name="temp" />
+ <include name="test.exe" />
+ <include name="out" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="compile" depends="init">
+ <csc target="exe" define="${csc.defines}" output="a.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="a.cs" />
+ </sources>
+ </csc>
+ <csc target="library" define="${csc.defines}" output="b.dll"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="b.cs" />
+ </sources>
+ </csc>
+ <csc target="exe" define="${csc.defines}" output="test.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="../../build/common/Assert.cs" />
+ <include name="test.cs" />
+ </sources>
+ </csc>
+ </target>
+
+ <target name="run-test" depends="compile">
+ <echo file="c.dll">WHATEVER</echo>
+ <exec program="test.exe" managed="true" output="out" />
+ <fail if="${file::exists('out')}" />
+ </target>
+</project>
Property changes on: trunk/gert/standalone/bug350530/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug350530/test.cs
===================================================================
--- trunk/gert/standalone/bug350530/test.cs 2008-01-12 12:48:20 UTC (rev
92726)
+++ trunk/gert/standalone/bug350530/test.cs 2008-01-12 13:39:35 UTC (rev
92727)
@@ -0,0 +1,181 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Security.Policy;
+
+class Program
+{
+ static void Main ()
+ {
+ string dir = AppDomain.CurrentDomain.BaseDirectory;
+ string tempFile = Path.Combine (dir, "temp");
+ string logFile = Path.Combine (dir, "log");
+
+ AppDomain dA = AppDomain.CreateDomain ("New App Domain");
+ dA.ExecuteAssembly ("a.exe");
+ AppDomain.Unload (dA);
+
+ Assert.IsTrue (File.Exists (tempFile), "#A1");
+ Assert.IsFalse (File.Exists (logFile), "#A2");
+ File.Delete (tempFile);
+
+#if NET_2_0
+ AppDomain dB = AppDomain.CreateDomain ("New App Domain 2");
+ dB.ExecuteAssemblyByName ("a");
+ AppDomain.Unload (dB);
+
+ Assert.IsTrue (File.Exists (tempFile), "#B1");
+ Assert.IsFalse (File.Exists (logFile), "#B2");
+ File.Delete (tempFile);
+#endif
+
+ AppDomain dC = AppDomain.CreateDomain ("New App Domain");
+ dC.ExecuteAssembly ("a.exe", AppDomain.CurrentDomain.Evidence,
+ new string [] { logFile });
+ AppDomain.Unload (dC);
+
+ Assert.IsFalse (File.Exists (tempFile), "#C1");
+ Assert.IsTrue (File.Exists (logFile), "#C2");
+ File.Delete (logFile);
+
+#if NET_2_0
+ AppDomain dD = AppDomain.CreateDomain ("New App Domain 2");
+ dD.ExecuteAssemblyByName ("a", AppDomain.CurrentDomain.Evidence,
+ new string [] { logFile });
+ AppDomain.Unload (dD);
+
+ Assert.IsFalse (File.Exists (tempFile), "#D1");
+ Assert.IsTrue (File.Exists (logFile), "#D2");
+ File.Delete (logFile);
+#endif
+
+ AppDomain dE = AppDomain.CreateDomain ("New App Domain");
+ dE.ExecuteAssembly ("a.exe", (Evidence) null, (string []) null);
+ AppDomain.Unload (dE);
+
+ Assert.IsTrue (File.Exists (tempFile), "#E1");
+ Assert.IsFalse (File.Exists (logFile), "#E2");
+ File.Delete (tempFile);
+
+#if NET_2_0
+ AppDomain dF = AppDomain.CreateDomain ("New App Domain 2");
+ dF.ExecuteAssemblyByName ("a", (Evidence) null, (string [])
null);
+ AppDomain.Unload (dF);
+
+ Assert.IsTrue (File.Exists (tempFile), "#F1");
+ Assert.IsFalse (File.Exists (logFile), "#F2");
+ File.Delete (tempFile);
+#endif
+
+ AppDomain dG = AppDomain.CreateDomain ("New App Domain");
+ try {
+ dG.ExecuteAssembly ("b.dll");
+ Assert.Fail ("#G1");
+#if NET_2_0
+ } catch (MissingMethodException ex) {
+ // Entry point not found in assembly '...'
+ Assert.AreEqual (typeof (MissingMethodException),
ex.GetType (), "#G2");
+ Assert.IsNull (ex.InnerException, "#G3");
+ Assert.IsNotNull (ex.Message, "#G4");
+ Assert.IsTrue (ex.Message.IndexOf ("'b,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'") != -1, "#G5");
+#else
+ } catch (COMException ex) {
+ // Unspecified error
+ Assert.AreEqual (typeof (COMException), ex.GetType (),
"#G2");
+ Assert.AreEqual (-2147467259, ex.ErrorCode, "#G3");
+ Assert.IsNull (ex.InnerException, "#G4");
+ Assert.IsNotNull (ex.Message, "#G5");
+#endif
+ } finally {
+ AppDomain.Unload (dG);
+ }
+
+#if NET_2_0
+ AppDomain dH = AppDomain.CreateDomain ("New App Domain 2");
+ try {
+ dH.ExecuteAssemblyByName ("b");
+ Assert.Fail ("#H1");
+ } catch (MissingMethodException ex) {
+ // Entry point not found in assembly '...'
+ Assert.AreEqual (typeof (MissingMethodException),
ex.GetType (), "#H2");
+ Assert.IsNull (ex.InnerException, "#H3");
+ Assert.IsNotNull (ex.Message, "#H4");
+ Assert.IsTrue (ex.Message.IndexOf ("'b,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'") != -1, "#H5");
+ } finally {
+ AppDomain.Unload (dH);
+ }
+#endif
+
+ AppDomain dI = AppDomain.CreateDomain ("New App Domain");
+ try {
+ dI.ExecuteAssembly ("c.dll");
+ Assert.Fail ("#I1");
+ } catch (BadImageFormatException ex) {
+ // Could not load file or assembly '...' or one of its
+ // dependencies. The module was expected to contain an
+ // assembly manifest
+ Assert.AreEqual (typeof (BadImageFormatException),
ex.GetType (), "#I2");
+ Assert.IsNotNull (ex.FileName, "#I3");
+ Assert.IsTrue (ex.FileName.IndexOf ("c.dll") != -1,
"#I4");
+ Assert.IsNull (ex.InnerException, "#I5");
+ Assert.IsNotNull (ex.Message, "#I6");
+ Assert.IsTrue (ex.Message.IndexOf ("c.dll") != -1,
"#I7");
+ } finally {
+ AppDomain.Unload (dI);
+ }
+
+#if NET_2_0
+ AppDomain dJ = AppDomain.CreateDomain ("New App Domain 2");
+ try {
+ dJ.ExecuteAssemblyByName ("c");
+ Assert.Fail ("#J1");
+ } catch (BadImageFormatException ex) {
+ // Could not load file or assembly '...' or one of its
+ // dependencies. The module was expected to contain an
+ // assembly manifest
+ Assert.AreEqual (typeof (BadImageFormatException),
ex.GetType (), "#J2");
+ Assert.AreEqual ("c", ex.FileName, "#J3");
+ Assert.IsNull (ex.InnerException, "#J4");
+ Assert.IsNotNull (ex.Message, "#J5");
+ Assert.IsTrue (ex.Message.IndexOf ("'c'") != -1, "#J6");
+ } finally {
+ AppDomain.Unload (dJ);
+ }
+#endif
+
+ AppDomain dK = AppDomain.CreateDomain ("New App Domain");
+ try {
+ dK.ExecuteAssembly ("d.dll");
+ Assert.Fail ("#I1");
+ } catch (FileNotFoundException ex) {
+ // Could not load file or assembly '...' or one of its
+ // dependencies. The system cannot find the file
specified
+ Assert.AreEqual (typeof (FileNotFoundException),
ex.GetType (), "#K2");
+ Assert.IsNotNull (ex.FileName, "#K3");
+ Assert.IsTrue (ex.FileName.IndexOf ("d.dll") != -1,
"#K4");
+ Assert.IsNull (ex.InnerException, "#K5");
+ Assert.IsNotNull (ex.Message, "#K6");
+ Assert.IsTrue (ex.Message.IndexOf ("d.dll") != -1,
"#K7");
+ } finally {
+ AppDomain.Unload (dK);
+ }
+
+#if NET_2_0
+ AppDomain dL = AppDomain.CreateDomain ("New App Domain 2");
+ try {
+ dL.ExecuteAssemblyByName ("d");
+ Assert.Fail ("#L1");
+ } catch (FileNotFoundException ex) {
+ // Could not load file or assembly 'd' or one of its
+ // dependencies. The system cannot find the file
specified
+ Assert.AreEqual (typeof (FileNotFoundException),
ex.GetType (), "#L2");
+ Assert.AreEqual ("d", ex.FileName, "#L3");
+ Assert.IsNull (ex.InnerException, "#L4");
+ Assert.IsNotNull (ex.Message, "#L5");
+ Assert.IsTrue (ex.Message.IndexOf ("'d'") != -1, "#L6");
+ } finally {
+ AppDomain.Unload (dL);
+ }
+#endif
+ }
+}
Property changes on: trunk/gert/standalone/bug350530/test.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches