[PATCH 1/2] gst-sunit: Allow to execute a subset of tests provided by a package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] gst-sunit: Allow to execute a subset of tests provided by a package

Holger Freyther
Using "gst-sunit -p PACKAGE" will execute all tests of the package.
Make it possible to pass a different test script on the command line
and in this case none of the default tests will be executed. This
can be used when just trying to understand a single regression.

2014-05-01  Holger Hans Peter Freyther  <[hidden email]>

        * scripts/Test.st: Introduce pkgScript variable and
        use it.
---
 ChangeLog       |  5 +++++
 NEWS            |  3 +++
 scripts/Test.st | 10 ++++++----
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7369612..4384e2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-01  Holger Hans Peter Freyther  <[hidden email]>
+
+ * scripts/Test.st: Introduce pkgScript variable and
+ use it.
+
 2014-03-31  Gwenael Casaccio  <[hidden email]>
 
  * kernel/Object.st: Make Object>>FinalizableObjects thread safe.
diff --git a/NEWS b/NEWS
index d66e099..e1920c8 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,9 @@ o   gst-sunit now understands the -d/--debug parameter. In case of an
 
 o   The Netlink module has been added for Linux.
 
+o   gst-sunit -p package.xml TestClass will execute only the tests of
+    the TestClass now.
+
 -----------------------------------------------------------------------------
 
 NEWS FROM 3.2.4 to 3.2.5
diff --git a/scripts/Test.st b/scripts/Test.st
index 11e1ae0..28409bb 100644
--- a/scripts/Test.st
+++ b/scripts/Test.st
@@ -77,12 +77,13 @@ Object subclass: SUnitUnhandledDebugger [
 
 PackageLoader fileInPackage: 'SUnit'!
 
-| helpString verbose script suite result quiet debug |
+| helpString verbose pkgScript script suite result quiet debug |
 quiet := false.
 verbose := false.
 debug := false.
 FileStream verbose: false.
 script := ''.
+pkgScript := ''.
 
 helpString :=
 'Usage:
@@ -141,10 +142,10 @@ Smalltalk
                     tmp := PackageLoader loadPackageFromFile: Directory working / arg.
                     PackageLoader insertPackage: tmp. tmp ]
  ifFalse: [ PackageLoader packageAt: arg ].
-    script := script, ' ', pkg sunitScript.
+    pkgScript := pkgScript, ' ', pkg sunitScript.
     pkg test notNil ifTrue: [
  pkg := pkg test.
-        script := script, ' ', pkg sunitScript ].
+        pkgScript := pkgScript, ' ', pkg sunitScript ].
     pkg fileIn ]
     ifCurtailed: [ ObjectMemory quit: 2 ] ].
 
@@ -159,7 +160,8 @@ Smalltalk
  helpString displayOn: stderr.
  ObjectMemory quit: 1 ].
 
-script isEmpty ifTrue: [ ObjectMemory quit ].
+(script isEmpty and: [pkgScript isEmpty]) ifTrue: [ ObjectMemory quit ].
+script isEmpty ifTrue: [script := pkgScript].
 
 FileStream verbose: false.
 (PackageLoader packageAt: #SUnit) loaded
--
1.9.1


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] visualgst: Avoid live-lock on single-step debugging

Holger Freyther
Debugging "3 negated" and pressing "F7" could result in a
live-lock. While the dispatch routine of the mainloop was
ran the call-in process could wait on the "finalSemaphore"
and the "idle" process would be selected to execute as the
only process that remained runnable. This live-lock would
never be exited.

The underlying issue is that VisualGST is running in the
same image and can be impacted by the execution of the
debugged process. The only thing we can do right now is
to skip dangerous routines.

Currently the dangerous routines are related to the handling
of finalizers as the Glib/Gtk+ bindings create a lot of to
be finalized objects.

2014-05-05  Holger Hans Peter Freyther  <[hidden email]>

        * Debugger/GtkDebugger.st: Introduce >>#finishDangerousContexts
        and call it from >>#debugWith:.
---
 packages/visualgst/ChangeLog               |  5 +++++
 packages/visualgst/Debugger/GtkDebugger.st | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/packages/visualgst/ChangeLog b/packages/visualgst/ChangeLog
index 330b439..4451f6e 100644
--- a/packages/visualgst/ChangeLog
+++ b/packages/visualgst/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-05  Holger Hans Peter Freyther  <[hidden email]>
+
+ * Debugger/GtkDebugger.st: Introduce >>#finishDangerousContexts
+ and call it from >>#debugWith:.
+
 2014-02-10  Gwenael Casaccio  <[hidden email]>
 
  * Source/ClassHeaderSource.st: Display instance side and class side pragmas.
diff --git a/packages/visualgst/Debugger/GtkDebugger.st b/packages/visualgst/Debugger/GtkDebugger.st
index 7c6983d..cea52c5 100644
--- a/packages/visualgst/Debugger/GtkDebugger.st
+++ b/packages/visualgst/Debugger/GtkDebugger.st
@@ -303,12 +303,30 @@ GtkBrowsingTool subclass: GtkDebugger [
         self debugWith: [ debugger finish ]
     ]
 
+    finishDangerousContexts [
+        | methods |
+        "VisualGST is running in the same image as the to be de-bugged
+        processed. If the process is suspended in a critical section
+        VisualGST might end up in a live-lock. As long as VisualGST is
+        running in the same image there is no way we can avoid this."
+
+        "Nothing is suspended."
+        debugger suspendedContext ifNil: [^self].
+
+        "Methods we need to finish or bad things will happen."
+        methods := {Object>>#removeToBeFinalized. Object>>#addToBeFinalized}.
+
+        (methods includes: debugger suspendedContext method)
+            ifTrue: [debugger finish].
+    ]
+
     debugWith: aBlock [
         <category: 'execute events'>
 
         TaskQueue uniqueInstance add: [
             self isLastContextSelected ifFalse: [ self stepToSelectedContext ].
             aBlock value.
+            self finishDangerousContexts.
             self updateContextWidget ]
     ]
 
--
1.9.1


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk