Author: gert
Date: 2007-05-17 04:02:40 -0400 (Thu, 17 May 2007)
New Revision: 77524

Added:
   trunk/gert/standalone/bug77208/
   trunk/gert/standalone/bug77208/default.build
   trunk/gert/standalone/bug77208/test1.cs
   trunk/gert/standalone/bug77208/test2.cs
   trunk/gert/standalone/bug81646/
   trunk/gert/standalone/bug81646/default.build
   trunk/gert/standalone/bug81646/test.cs
Modified:
   trunk/gert/standalone/known-issues
Log:
Added tests for bug #81646 and #77208.


Added: trunk/gert/standalone/bug77208/default.build
===================================================================
--- trunk/gert/standalone/bug77208/default.build        2007-05-17 08:00:36 UTC 
(rev 77523)
+++ trunk/gert/standalone/bug77208/default.build        2007-05-17 08:02:40 UTC 
(rev 77524)
@@ -0,0 +1,66 @@
+<project name="bug77208" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+       
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="out" />
+                               <include name="test1.exe" />
+                               <include name="test2.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <csc target="exe" define="${csc.defines}" output="test1.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test1.cs" />
+                       </sources>
+               </csc>
+               <csc target="exe" define="${csc.defines}" output="test2.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test2.cs" />
+                       </sources>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec program="test1.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}">#1</fail>
+               <exec program="test2.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}">#2</fail>
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/standalone/bug77208/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug77208/test1.cs
===================================================================
--- trunk/gert/standalone/bug77208/test1.cs     2007-05-17 08:00:36 UTC (rev 
77523)
+++ trunk/gert/standalone/bug77208/test1.cs     2007-05-17 08:02:40 UTC (rev 
77524)
@@ -0,0 +1,38 @@
+using System;
+using System.Threading;
+
+class Program
+{
+       static int _progress = 0;
+
+       static int Main ()
+       {
+               Thread t = new Thread (new ThreadStart (Oops));
+               t.Start ();
+               Thread.Sleep (1000);
+               t.Abort ();
+               t.Join ();
+#if NET_2_0
+               return _progress == 23 ? 0 : _progress;
+#else
+               return _progress == 27 ? 0 : _progress;
+#endif
+       }
+
+       static void Oops ()
+       {
+               try {
+                       try {
+                               _progress += 1;
+                       } finally {
+                               _progress += 2;
+                               Thread.Sleep (5000);
+                               _progress += 4;
+                       }
+               } catch (ThreadAbortException) {
+                       _progress += 8;
+               } finally {
+                       _progress += 16;
+               }
+       }
+}


Property changes on: trunk/gert/standalone/bug77208/test1.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug77208/test2.cs
===================================================================
--- trunk/gert/standalone/bug77208/test2.cs     2007-05-17 08:00:36 UTC (rev 
77523)
+++ trunk/gert/standalone/bug77208/test2.cs     2007-05-17 08:02:40 UTC (rev 
77524)
@@ -0,0 +1,41 @@
+using System;
+using System.Threading;
+
+class Program
+{
+       static int _progress = 0;
+
+       static int Main ()
+       {
+               try {
+                       try {
+                               _progress += 1;
+                               Thread.CurrentThread.Interrupt ();
+                       } finally {
+                               _progress += 2;
+                               Thread.Sleep (100);
+                               _progress += 4;
+                       }
+
+                       try {
+                               throw new Exception ();
+                       } catch (Exception) {
+                               _progress += 8;
+                               Thread.Sleep (100);
+                               _progress += 16;
+                       }
+
+                       _progress += 32;
+                       Thread.Sleep (100);
+                       _progress += 64;
+               } catch (ThreadInterruptedException) {
+                       _progress += 128;
+               }
+
+#if NET_2_0
+               return _progress == 191 ? 0 : _progress;
+#else
+               return _progress == 131 ? 0 : _progress;
+#endif
+       }
+}


Property changes on: trunk/gert/standalone/bug77208/test2.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81646/default.build
===================================================================
--- trunk/gert/standalone/bug81646/default.build        2007-05-17 08:00:36 UTC 
(rev 77523)
+++ trunk/gert/standalone/bug81646/default.build        2007-05-17 08:02:40 UTC 
(rev 77524)
@@ -0,0 +1,58 @@
+<project name="bug81646" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+       
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <csc target="exe" define="${csc.defines}" output="test.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="test.cs" />
+                       </sources>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/standalone/bug81646/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug81646/test.cs
===================================================================
--- trunk/gert/standalone/bug81646/test.cs      2007-05-17 08:00:36 UTC (rev 
77523)
+++ trunk/gert/standalone/bug81646/test.cs      2007-05-17 08:02:40 UTC (rev 
77524)
@@ -0,0 +1,69 @@
+using System;
+using System.Collections;
+using System.Threading;
+
+class Program
+{
+       static readonly ArrayList _actions = new ArrayList ();
+       static readonly object _lock1 = new object ();
+       static readonly object _lock2 = new object ();
+
+       static int Main ()
+       {
+               lock (_lock2) {
+                       Thread t1;
+
+                       lock (_lock1) {
+                               t1 = new Thread (new ThreadStart(T1));
+                               t1.Start ();
+                               Monitor.Wait (_lock1);
+                       }
+                       Thread.Sleep (100);
+                       _actions.Add ("Main: interrupting T1");
+                       t1.Interrupt ();
+               }
+
+#if NET_2_0
+               if (_actions.Count != 3) {
+#else
+               if (_actions.Count != 3) {
+#endif
+                       Console.WriteLine ("#1: " + _actions.Count);
+                       return 1;
+               }
+
+               if ((string) _actions [0] != "T1: started") {
+                       Console.WriteLine ("#2: " + (string) _actions [0]);
+                       return 2;
+               }
+
+               if ((string) _actions [1] != "T1: trying Lock1") {
+                       Console.WriteLine ("#3: " + (string) _actions [1]);
+                       return 3;
+               }
+
+               if ((string) _actions [2] != "Main: interrupting T1") {
+                       Console.WriteLine ("#4: " + (string) _actions [2]);
+                       return 4;
+               }
+
+               return 0;
+       }
+
+       static void T1 ()
+       {
+               _actions.Add ("T1: started");
+               lock (_lock1) {
+                       Monitor.Pulse (_lock1);
+               }
+
+               try {
+                       _actions.Add ("T1: trying Lock1");
+                       lock (_lock2) {
+                               _actions.Add ("T1: got Lock1");
+                       }
+               } catch (Exception) {
+                       _actions.Add ("T1: interrupted");
+               }
+       }
+}


Property changes on: trunk/gert/standalone/bug81646/test.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2007-05-17 08:00:36 UTC (rev 77523)
+++ trunk/gert/standalone/known-issues  2007-05-17 08:02:40 UTC (rev 77524)
@@ -1,4 +1,5 @@
 bug57612/**
+bug77208/**
 bug78455/**
 bug81563/**
 bug81601/**
@@ -6,3 +7,4 @@
 bug81571/**
 bug81633/**
 bug81642/**
+bug81646/**

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to