Author: martin
Date: 2007-01-16 13:23:15 -0500 (Tue, 16 Jan 2007)
New Revision: 71161

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/test/testsuite/NUnit.cs
   trunk/debugger/test/testsuite/TestAttach.cs
   trunk/debugger/test/testsuite/TestExec.cs
   trunk/debugger/test/testsuite/testnativeexec.cs
   trunk/debugger/test/testsuite/testnativefork.cs
Log:
2007-01-16  Martin Baulig  <[EMAIL PROTECTED]>

        * test/testsuite/: Updated the testsuite to reflect the latest
        threading changes.      



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-01-16 18:22:43 UTC (rev 71160)
+++ trunk/debugger/ChangeLog    2007-01-16 18:23:15 UTC (rev 71161)
@@ -1,5 +1,10 @@
 2007-01-16  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * test/testsuite/: Updated the testsuite to reflect the latest
+       threading changes.      
+
+2007-01-16  Martin Baulig  <[EMAIL PROTECTED]>
+
        * frontend/Interpreter.cs
        (Interpreter.CheckLastEvent): New method.
        (Interpreter.WaitAll): Correctly implement this.

Modified: trunk/debugger/test/testsuite/NUnit.cs
===================================================================
--- trunk/debugger/test/testsuite/NUnit.cs      2007-01-16 18:22:43 UTC (rev 
71160)
+++ trunk/debugger/test/testsuite/NUnit.cs      2007-01-16 18:23:15 UTC (rev 
71161)
@@ -47,6 +47,27 @@
                }
        }
 
+       public class StyleNUnit : StyleCLI
+       {
+               public readonly NUnitInterpreter NUnit;
+
+               public StyleNUnit (NUnitInterpreter nunit)
+                       : base (nunit)
+               {
+                       this.NUnit = nunit;
+               }
+
+               public event TargetEventHandler TargetEventEvent;
+
+               public override void TargetEvent (Thread thread, 
TargetEventArgs args)
+               {
+                       if (TargetEventEvent != null)
+                               TargetEventEvent (thread, args);
+
+                       base.TargetEvent (thread, args);
+               }
+       }
+
        public class NUnitInterpreter : Interpreter
        {
                internal NUnitInterpreter (DebuggerConfiguration config, 
DebuggerOptions options,
@@ -58,9 +79,15 @@
 
                        queue = Queue.Synchronized (new Queue ());
                        wait_event = new ST.ManualResetEvent (false);
+
+                       Style = style_nunit = new StyleNUnit (this);
+                       style_nunit.TargetEventEvent += delegate (Thread 
thread, TargetEventArgs args) {
+                               AddEvent (new DebuggerEvent 
(DebuggerEventType.TargetEvent, thread, args));
+                       };
                }
 
                Queue queue;
+               StyleNUnit style_nunit;
                ST.ManualResetEvent wait_event;
                LineReader inferior_stdout, inferior_stderr;
 
@@ -92,12 +119,6 @@
                        }
                }
 
-               protected override void OnTargetEvent (Thread thread, 
TargetEventArgs args)
-               {
-                       base.OnTargetEvent (thread, args);
-                       AddEvent (new DebuggerEvent 
(DebuggerEventType.TargetEvent, thread, args));
-               }
-
                protected override void OnThreadCreated (Thread thread)
                {
                        base.OnThreadCreated (thread);

Modified: trunk/debugger/test/testsuite/TestAttach.cs
===================================================================
--- trunk/debugger/test/testsuite/TestAttach.cs 2007-01-16 18:22:43 UTC (rev 
71160)
+++ trunk/debugger/test/testsuite/TestAttach.cs 2007-01-16 18:23:15 UTC (rev 
71161)
@@ -53,8 +53,6 @@
                        AssertThreadCreated ();
 
                        AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
 
                        StackFrame frame = process.MainThread.CurrentFrame;
                        Assert.IsNotNull (frame);
@@ -78,8 +76,6 @@
                        AssertThreadCreated ();
 
                        AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
 
                        StackFrame frame = process.MainThread.CurrentFrame;
                        Assert.IsNotNull (frame);
@@ -103,8 +99,6 @@
                        AssertThreadCreated ();
 
                        AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
-                       AssertStopped (null, null, -1);
 
                        StackFrame frame = process.MainThread.CurrentFrame;
                        Assert.IsNotNull (frame);

Modified: trunk/debugger/test/testsuite/TestExec.cs
===================================================================
--- trunk/debugger/test/testsuite/TestExec.cs   2007-01-16 18:22:43 UTC (rev 
71160)
+++ trunk/debugger/test/testsuite/TestExec.cs   2007-01-16 18:23:15 UTC (rev 
71161)
@@ -16,7 +16,7 @@
                { }
 
                const int line_main = 8;
-               const int line_main_2 = 10;
+               const int line_main_3 = 12;
 
                int bpt_main;
 
@@ -30,12 +30,9 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "X.Main(System.String[])", 
line_main);
-                       bpt_main = AssertBreakpoint ("-local " + line_main_2);
-                       AssertExecute ("continue");
-                       AssertHitBreakpoint (thread, bpt_main, 
"X.Main(System.String[])", line_main_2);
+                       bpt_main = AssertBreakpoint ("-local " + line_main_3);
+                       AssertExecute ("continue -wait");
 
-                       AssertExecute ("next");
-
                        Thread child = AssertProcessCreated ();
                        Thread execd_child = null;
 
@@ -74,7 +71,8 @@
                                        TargetEventArgs args = 
(TargetEventArgs) e.Data2;
 
                                        if ((e_thread == thread) &&
-                                           (args.Type == 
TargetEventType.TargetStopped)) {
+                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                           ((int) args.Data == bpt_main)) {
                                                stopped = true;
                                                continue;
                                        } else if ((e_thread == execd_child) &&
@@ -87,12 +85,9 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "X.Main(System.String[])", 
line_main_2 + 1);
-                       AssertExecute ("next");
-                       AssertTargetOutput ("Hello World!");
-                       AssertStopped (thread, "X.Main(System.String[])", 
line_main_2 + 2);
+                       AssertFrame (thread, "X.Main(System.String[])", 
line_main_3);
                        AssertPrint (thread, "process.ExitCode", 
"(System.Int32) 0");
-
+                       AssertTargetOutput ("Hello World!");
                        AssertExecute ("continue");
                        AssertTargetExited (thread.Process);
                }
@@ -112,11 +107,8 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "X.Main(System.String[])", 
line_main);
-                       AssertExecute ("continue");
-                       AssertHitBreakpoint (thread, bpt_main, 
"X.Main(System.String[])", line_main_2);
+                       AssertExecute ("continue -wait");
 
-                       AssertExecute ("next");
-
                        Thread child = AssertProcessCreated ();
                        Thread execd_child = null;
 
@@ -155,7 +147,8 @@
                                        TargetEventArgs args = 
(TargetEventArgs) e.Data2;
 
                                        if ((e_thread == thread) &&
-                                           (args.Type == 
TargetEventType.TargetStopped)) {
+                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                           ((int) args.Data == bpt_main)) {
                                                stopped = true;
                                                continue;
                                        } else if ((e_thread == execd_child) &&
@@ -168,12 +161,9 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "X.Main(System.String[])", 
line_main_2 + 1);
-                       AssertExecute ("next");
-                       AssertTargetOutput ("Hello World");
-                       AssertStopped (thread, "X.Main(System.String[])", 
line_main_2 + 2);
+                       AssertFrame (thread, "X.Main(System.String[])", 
line_main_3);
                        AssertPrint (thread, "process.ExitCode", 
"(System.Int32) 0");
-
+                       AssertTargetOutput ("Hello World");
                        AssertExecute ("continue");
                        AssertTargetExited (thread.Process);
                }

Modified: trunk/debugger/test/testsuite/testnativeexec.cs
===================================================================
--- trunk/debugger/test/testsuite/testnativeexec.cs     2007-01-16 18:22:43 UTC 
(rev 71160)
+++ trunk/debugger/test/testsuite/testnativeexec.cs     2007-01-16 18:23:15 UTC 
(rev 71161)
@@ -18,6 +18,8 @@
                const int LineWaitpid = 24;
                const int LineChild = 19;
 
+               int bpt_waitpid;
+
                [Test]
                [Category("Fork")]
                public void Main ()
@@ -28,7 +30,8 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "main", LineMain);
-                       AssertExecute ("next");
+                       bpt_waitpid = AssertBreakpoint ("-local " + 
(LineWaitpid+1));
+                       AssertExecute ("continue -wait");
 
                        Thread child = AssertProcessCreated ();
 
@@ -69,7 +72,8 @@
                                        TargetEventArgs args = 
(TargetEventArgs) e.Data2;
 
                                        if ((e_thread == thread) &&
-                                           (args.Type == 
TargetEventType.TargetStopped)) {
+                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                           ((int) args.Data == bpt_waitpid)) {
                                                stopped = true;
                                                continue;
                                        } else if ((e_thread == execd_child) &&
@@ -82,17 +86,11 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "main", LineMain + 1);
-
+                       AssertFrame (thread, "main", LineWaitpid + 1);
                        AssertPrint (thread, "pid", String.Format ("(pid_t) 
{0}", child.PID));
-                       AssertExecute ("next");
-                       AssertStopped (thread, "main", LineWaitpid);
 
-                       AssertExecute ("next");
-                       AssertTargetOutput ("Hello World!");
-                       AssertStopped (thread, "main", LineWaitpid + 1);
-
                        AssertExecute ("continue");
+                       AssertTargetOutput ("Hello World!");
                        AssertTargetExited (thread.Process);
                }
 
@@ -107,7 +105,7 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "main", LineMain);
-                       AssertExecute ("next");
+                       AssertExecute ("continue -wait");
 
                        Thread child = AssertProcessCreated ();
 
@@ -148,7 +146,8 @@
                                        TargetEventArgs args = 
(TargetEventArgs) e.Data2;
 
                                        if ((e_thread == thread) &&
-                                           (args.Type == 
TargetEventType.TargetStopped)) {
+                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                           ((int) args.Data == bpt_waitpid)) {
                                                stopped = true;
                                                continue;
                                        } else if ((e_thread == execd_child) &&
@@ -161,8 +160,7 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "main", LineMain + 1);
-
+                       AssertFrame (thread, "main", LineWaitpid + 1);
                        AssertPrint (thread, "pid", String.Format ("(pid_t) 
{0}", child.PID));
                        AssertExecute ("continue");
 
@@ -181,14 +179,15 @@
 
                        AssertStopped (thread, "main", LineMain);
                        int child_bpt = AssertBreakpoint ("-global " + 
LineChild);
-                       AssertExecute ("next");
+                       int waitpit_bpt = AssertBreakpoint ("-local " + 
LineWaitpid);
+                       AssertExecute ("continue -bg");
 
                        Thread child = AssertProcessCreated ();
 
                        bool child_stopped = false;
-                       bool stopped = false;
+                       bool reached_waitpid = false;
 
-                       while (!child_stopped || !stopped) {
+                       while (!child_stopped || !reached_waitpid) {
                                DebuggerEvent e = AssertEvent ();
 
                                if (e.Type != DebuggerEventType.TargetEvent)
@@ -198,8 +197,9 @@
                                TargetEventArgs args = (TargetEventArgs) 
e.Data2;
 
                                if ((e_thread == thread) &&
-                                   (args.Type == 
TargetEventType.TargetStopped)) {
-                                       stopped = true;
+                                   (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                   ((int) args.Data == waitpit_bpt)) {
+                                       reached_waitpid = true;
                                        continue;
                                } else if ((e_thread == child) &&
                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
@@ -211,14 +211,14 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "main", LineMain + 1);
+                       AssertFrame (thread, "main", LineWaitpid);
                        AssertFrame (child, "main", LineChild);
 
                        AssertPrint (thread, "pid", String.Format ("(pid_t) 
{0}", child.PID));
                        AssertPrint (child, "pid", "(pid_t) 0");
 
                        AssertExecute ("background -thread " + child.ID);
-                       AssertExecute ("next");
+                       AssertExecute ("continue -wait");
 
                        Thread execd_child = null;
                        bool exited = false;
@@ -226,7 +226,7 @@
                        bool child_exited = false;
                        bool thread_created = false;
                        bool thread_exited = false;
-                       stopped = false;
+                       bool stopped = false;
 
                        while (!exited || !stopped || !child_execd || 
!thread_created ||
                               !child_exited || !thread_exited) {
@@ -256,7 +256,8 @@
                                        TargetEventArgs args = 
(TargetEventArgs) e.Data2;
 
                                        if ((e_thread == thread) &&
-                                           (args.Type == 
TargetEventType.TargetStopped)) {
+                                           (args.Type == 
TargetEventType.TargetHitBreakpoint) &&
+                                           ((int) args.Data == bpt_waitpid)) {
                                                stopped = true;
                                                continue;
                                        } else if ((e_thread == execd_child) &&
@@ -269,12 +270,8 @@
                                Assert.Fail ("Received unexpected event {0}", 
e);
                        }
 
-                       AssertFrame (thread, "main", LineWaitpid);
-
-                       AssertExecute ("next");
+                       AssertFrame (thread, "main", LineWaitpid + 1);
                        AssertTargetOutput ("Hello World!");
-                       AssertStopped (thread, "main", LineWaitpid + 1);
-
                        AssertExecute ("continue");
                        AssertTargetExited (thread.Process);
                }

Modified: trunk/debugger/test/testsuite/testnativefork.cs
===================================================================
--- trunk/debugger/test/testsuite/testnativefork.cs     2007-01-16 18:22:43 UTC 
(rev 71160)
+++ trunk/debugger/test/testsuite/testnativefork.cs     2007-01-16 18:23:15 UTC 
(rev 71161)
@@ -28,7 +28,7 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "main", LineMain);
-                       AssertExecute ("next");
+                       AssertExecute ("next -wait");
 
                        Thread child = AssertProcessCreated ();
 
@@ -72,13 +72,13 @@
 
                        AssertPrint (thread, "pid", String.Format ("(pid_t) 
{0}", child.PID));
 
-                       AssertExecute ("next");
+                       AssertExecute ("next -wait");
                        AssertStopped (thread, "main", LineWaitpid);
 
-                       AssertExecute ("next");
+                       AssertExecute ("next -wait");
                        AssertStopped (thread, "main", LineWaitpid + 1);
 
-                       AssertExecute ("continue");
+                       AssertExecute ("continue -wait");
                        AssertTargetExited (thread.Process);
                }
 
@@ -93,7 +93,7 @@
                        Thread thread = process.MainThread;
 
                        AssertStopped (thread, "main", LineMain);
-                       AssertExecute ("next");
+                       AssertExecute ("next -wait");
 
                        Thread child = AssertProcessCreated ();
 
@@ -136,7 +136,7 @@
                        AssertFrame (thread, "main", LineMain + 1);
                        AssertPrint (thread, "pid", String.Format ("(pid_t) 
{0}", child.PID));
 
-                       AssertExecute ("continue");
+                       AssertExecute ("continue -wait");
                        AssertTargetExited (thread.Process);
                }
 
@@ -152,7 +152,7 @@
                        AssertStopped (thread, "main", LineMain);
                        int child_bpt = AssertBreakpoint ("-global " + 
LineChild);
                        int waitpid_bpt = AssertBreakpoint ("-local " + 
(LineWaitpid + 1));
-                       AssertExecute ("next");
+                       AssertExecute ("next -wait");
 
                        Thread child = AssertProcessCreated ();
 
@@ -189,7 +189,7 @@
                        AssertPrint (child, "pid", "(pid_t) 0");
 
                        AssertExecute ("background -thread " + child.ID);
-                       AssertExecute ("continue");
+                       AssertExecute ("continue -wait");
 
                        bool exited = false;
                        bool child_exited = false;
@@ -230,7 +230,7 @@
 
                        AssertFrame (thread, "main", LineWaitpid + 1);
 
-                       AssertExecute ("continue -thread " + thread.ID);
+                       AssertExecute ("continue -wait -thread " + thread.ID);
                        AssertTargetExited (thread.Process);
                }
        }

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

Reply via email to