Author: gert
Date: 2007-06-09 11:30:40 -0400 (Sat, 09 Jun 2007)
New Revision: 79055
Added:
trunk/gert/standalone/bug81767/
trunk/gert/standalone/bug81767/default.build
trunk/gert/standalone/bug81767/test.cs
Modified:
trunk/gert/standalone/known-issues
Log:
Added test for bug #81767.
Added: trunk/gert/standalone/bug81767/default.build
===================================================================
--- trunk/gert/standalone/bug81767/default.build 2007-06-09 15:17:34 UTC
(rev 79054)
+++ trunk/gert/standalone/bug81767/default.build 2007-06-09 15:30:40 UTC
(rev 79055)
@@ -0,0 +1,51 @@
+<project name="bug81767" default="rebuild">
+ <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-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-2.0,net-2.0" />
+
+ <target name="clean">
+ <delete>
+ <fileset>
+ <include name="file.txt" />
+ <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/bug81767/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug81767/test.cs
===================================================================
--- trunk/gert/standalone/bug81767/test.cs 2007-06-09 15:17:34 UTC (rev
79054)
+++ trunk/gert/standalone/bug81767/test.cs 2007-06-09 15:30:40 UTC (rev
79055)
@@ -0,0 +1,51 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Text;
+
+class Program
+{
+ static int Main ()
+ {
+ locker = 0;
+ Thread t = new Thread (DeleteThread);
+ t.Start ();
+
+ using (FileStream fs = File.Open (path, FileMode.Create,
FileAccess.Write, FileShare.Delete)) {
+ Byte [] info = new UTF8Encoding (true).GetBytes ("This
is some text in the file.\r\n");
+ fs.Write (info, 0, info.Length);
+ fs.Write (info, 0, info.Length);
+ fs.Write (info, 0, info.Length);
+ fs.Write (info, 0, info.Length);
+ fs.Write (info, 0, info.Length);
+ }
+ locker = 1;
+
+ using (FileStream fs = File.Open (path, FileMode.Open,
FileAccess.ReadWrite, FileShare.Delete)) {
+ byte [] b = new byte [10];
+ UTF8Encoding temp = new UTF8Encoding (true);
+
+ while (fs.Read (b, 0, b.Length) > 0) {
+ temp.GetString (b);
+ Thread.Sleep (1000);
+ }
+ }
+ t.Join ();
+
+ if (File.Exists (path))
+ return 1;
+ return 0;
+ }
+
+ static void DeleteThread ()
+ {
+ while (locker == 0) {
+ Thread.Sleep (100);
+ }
+ File.Delete (path);
+ }
+
+ static byte locker;
+ static string path = Path.Combine
(AppDomain.CurrentDomain.BaseDirectory,
+ "file.txt");
+}
Property changes on: trunk/gert/standalone/bug81767/test.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues 2007-06-09 15:17:34 UTC (rev 79054)
+++ trunk/gert/standalone/known-issues 2007-06-09 15:30:40 UTC (rev 79055)
@@ -20,6 +20,7 @@
bug81697/**
bug81748/**
bug81757/**
+bug81767/**
bug81807/**
bug81815/**
bug81818/**
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches