Author: gert
Date: 2007-05-15 15:04:15 -0400 (Tue, 15 May 2007)
New Revision: 77429
Added:
trunk/gert/standalone/bug75826/
trunk/gert/standalone/bug75826/default.build
trunk/gert/standalone/bug75826/test.cs
Log:
Added test for bug #75826.
Added: trunk/gert/standalone/bug75826/default.build
===================================================================
--- trunk/gert/standalone/bug75826/default.build 2007-05-15 18:58:03 UTC
(rev 77428)
+++ trunk/gert/standalone/bug75826/default.build 2007-05-15 19:04:15 UTC
(rev 77429)
@@ -0,0 +1,58 @@
+<project name="bug75826" 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/bug75826/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug75826/test.cs
===================================================================
--- trunk/gert/standalone/bug75826/test.cs 2007-05-15 18:58:03 UTC (rev
77428)
+++ trunk/gert/standalone/bug75826/test.cs 2007-05-15 19:04:15 UTC (rev
77429)
@@ -0,0 +1,55 @@
+using System;
+using System.Threading;
+using System.Net;
+using System.Net.Sockets;
+
+class Program
+{
+ static int Main ()
+ {
+ //the number of socket listeners
+ const int NUM_SOCKETS = 100;
+
+ //the wait events for each of the socket listeners
+ ManualResetEvent [] socketWaitEvents = new ManualResetEvent
[NUM_SOCKETS];
+
+ Socket [] sockets = new Socket [NUM_SOCKETS];
+
+ //initialize all the listeners and start them listening
+ for (int i = 0; i < sockets.Length; i++) {
+ Socket s = new Socket (AddressFamily.InterNetwork,
SocketType.Stream,
+ ProtocolType.Tcp);
+ s.Bind (new IPEndPoint (IPAddress.Parse ("0.0.0.0"),
0));
+ s.Listen (int.MaxValue);
+
+ sockets [i] = s;
+ socketWaitEvents [i] = new ManualResetEvent (false);
+ }
+
+ //start accepting incoming connections (even though we wont get
any)
+ for (int i = 0; i < sockets.Length; i++) {
+ sockets [i].BeginAccept (new AsyncCallback
(BeginAcceptCallback),
+ socketWaitEvents [i]);
+ }
+
+ //let the system digest everything we just told it to do
+ Thread.Sleep (50);
+
+ //close down all the listeners
+ for (int i = 0; i < sockets.Length; i++) {
+ sockets [i].Close ();
+ }
+
+ //make sure that we get the beginacceptcallback for all the
listeners
+ for (int i = 0; i < socketWaitEvents.Length; i++) {
+ if (!socketWaitEvents [i].WaitOne (100, false))
+ return 1;
+ }
+ return 0;
+ }
+
+ static void BeginAcceptCallback (IAsyncResult asyncResult)
+ {
+ ((ManualResetEvent) asyncResult.AsyncState).Set ();
+ }
+}
Property changes on: trunk/gert/standalone/bug75826/test.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches