Author: robertj
Date: 2007-11-01 16:26:27 -0500 (Thu, 01 Nov 2007)
New Revision: 88688

Modified:
   trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog
   trunk/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
Log:
2007-11-01  Robert Jordan  <[EMAIL PROTECTED]>

        * ProcessTest.cs (TestRedirectedOutputIsAsync):
        Replace the generated script with a simple one (command line based).
        Add additional assert for Process.ExitCode == 0.



Modified: trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog    2007-11-01 
21:22:37 UTC (rev 88687)
+++ trunk/mcs/class/System/Test/System.Diagnostics/ChangeLog    2007-11-01 
21:26:27 UTC (rev 88688)
@@ -1,3 +1,9 @@
+2007-11-01  Robert Jordan  <[EMAIL PROTECTED]>
+
+       * ProcessTest.cs (TestRedirectedOutputIsAsync):
+       Replace the generated script with a simple one (command line based).
+       Add additional assert for Process.ExitCode == 0.
+
 2007-10-30  Robert Jordan  <[EMAIL PROTECTED]>
 
        * ProcessTest.cs: Add tests for bug #319829.

Modified: trunk/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs       
2007-11-01 21:22:37 UTC (rev 88687)
+++ trunk/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs       
2007-11-01 21:26:27 UTC (rev 88688)
@@ -58,15 +58,8 @@
                        if (Path.DirectorySeparatorChar == '\\')
                                return;
                        
-                       // Create a SH script that emits "hello" after it slept 
for 2 secs.
-                       string script = Path.GetTempFileName ();
-                       TextWriter w = File.CreateText (script);
-                       w.WriteLine ("sleep 2");
-                       w.WriteLine ("echo hello");
-                       w.Close ();
-
                        Process p = new Process ();
-                       p.StartInfo = new ProcessStartInfo ("/bin/sh", script);
+                       p.StartInfo = new ProcessStartInfo ("/bin/sh", "-c 
\"sleep 2; echo hello\"");
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.UseShellExecute = false;
                        p.Start ();
@@ -82,9 +75,9 @@
 
                        Assert.IsTrue ((DateTime.Now - start).TotalMilliseconds 
< 1000, "#01 BeginRead was not async");
                        p.WaitForExit ();
-                       File.Delete (script);
+                       Assert.AreEqual (0, p.ExitCode, "#02 script failure");
 
-                       Assert.AreEqual ("hello", Encoding.Default.GetString 
(buffer, 0, 5), "#02");
+                       Assert.AreEqual ("hello", Encoding.Default.GetString 
(buffer, 0, 5), "#03");
                }
 
                void Read (IAsyncResult ar)

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

Reply via email to