[PATCH 1/5] sunit: Fix TestCase new printString signals an exception

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

[PATCH 1/5] sunit: Fix TestCase new printString signals an exception

Holger Freyther
From: Holger Hans Peter Freyther <[hidden email]>

Use testSelector printString as this works when testSelector
is a String/Symbol or an UndefinedObject.

2012-08-03  Holger Hans Peter Freyther  <[hidden email]>

        * packages/sunit/SUnit.st: Use testSelector printString as
        the testSelector may be an UndefinedObject.
        * packages/sunit/SUnitTest.st: Add #testPrintString.
---
 packages/sunit/ChangeLog     |    6 ++++++
 packages/sunit/SUnit.st      |    2 +-
 packages/sunit/SUnitTests.st |    9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/packages/sunit/ChangeLog b/packages/sunit/ChangeLog
index 8449214..56a52cf 100644
--- a/packages/sunit/ChangeLog
+++ b/packages/sunit/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-03  Holger Hans Peter Freyther  <[hidden email]>
+
+ * packages/sunit/SUnit.st: Use testSelector printString as
+ the testSelector may be an UndefinedObject.
+ * packages/sunit/SUnitTest.st: Add #testPrintString.
+
 2010-12-04  Paolo Bonzini  <[hidden email]>
 
  * package.xml: Remove now superfluous <file> tags.
diff --git a/packages/sunit/SUnit.st b/packages/sunit/SUnit.st
index bb814f9..58b3ab0 100644
--- a/packages/sunit/SUnit.st
+++ b/packages/sunit/SUnit.st
@@ -1104,7 +1104,7 @@ When you are writing a test case method, send #assert: aBoolean when you want to
  aStream
     nextPutAll: self class printString;
     nextPutAll: '>>#';
-    nextPutAll: testSelector
+    nextPutAll: testSelector printString.
     ]
 ]
 
diff --git a/packages/sunit/SUnitTests.st b/packages/sunit/SUnitTests.st
index d1160a1..166ee89 100644
--- a/packages/sunit/SUnitTests.st
+++ b/packages/sunit/SUnitTests.st
@@ -276,6 +276,15 @@ if the tests are hard to write, something is probably wrong with the design".'>
     assert: aResult errorCount = anErrorCount
     ]
 
+    testPrintString [
+        <category: 'Testing'>
+        "Make sure that a new test can be printed"
+
+        self
+            shouldnt: [TestCase new printString] raise: Exception;
+            assert: TestCase new printString = 'TestCase>>#nil'.
+    ]
+
     isLogging [
  <category: 'Logging'>
  ^true
--
1.7.10.4


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

[PATCH 2/5] process: Set the priority directly instead of using the selector

Holger Freyther
From: Holger Hans Peter Freyther <[hidden email]>

The current priority might not be good enough when being passed
to the Process>>#priority: selector. I don't have an example of
when this happened right now.

2012-09-09  Holger Freyther  <[hidden email]>

        * kernel/CallinProcess.st: Copy the priority directly.
---
 ChangeLog               |    4 ++++
 kernel/CallinProcess.st |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 54f72d5..3f945d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-09  Holger Freyther  <[hidden email]>
+
+ * kernel/CallinProcess.st: Copy the priority directly.
+
 2012-02-22  Paolo Bonzini  <[hidden email]>
 
  * kernel/CallinProcess.st: Fix creation of cloned process, reported
diff --git a/kernel/CallinProcess.st b/kernel/CallinProcess.st
index 8094524..3be75ed 100644
--- a/kernel/CallinProcess.st
+++ b/kernel/CallinProcess.st
@@ -68,7 +68,7 @@ invoked me no longer exist).  I am otherwise equivalent to a Process.'>
             p instVarAt: i put: (self instVarAt: i) ].
 
         "Start executing the detached process from here."
-        p priority: self priority.
+        p instVarNamed: #priority put: priority.
         p suspendedContext: thisContext copy.
 
         Processor activeProcess == self ifTrue: [
--
1.7.10.4


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

[PATCH 3/5] delay: Name the delay process

Holger Freyther
In reply to this post by Holger Freyther
From: Holger Hans Peter Freyther <[hidden email]>

2012-09-09  Holger Freyther  <[hidden email]>

        * kernel/Delay.st: Name the delay process.
---
 ChangeLog       |    4 ++++
 kernel/Delay.st |    1 +
 2 files changed, 5 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 3f945d9..4c8caff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-09-09  Holger Freyther  <[hidden email]>
 
+ * kernel/Delay.st: Name the delay process.
+
+2012-09-09  Holger Freyther  <[hidden email]>
+
  * kernel/CallinProcess.st: Copy the priority directly.
 
 2012-02-22  Paolo Bonzini  <[hidden email]>
diff --git a/kernel/Delay.st b/kernel/Delay.st
index ba498fc..bab4112 100644
--- a/kernel/Delay.st
+++ b/kernel/Delay.st
@@ -181,6 +181,7 @@ created.'>
     sortBlock: [:d1 :d2 | d1 resumptionTime >= d2 resumptionTime].
  TimeoutSem := Semaphore new.
  DelayProcess := [self runDelayProcess] forkAt: Processor timingPriority.
+        DelayProcess name: 'delay process'.
         ObjectMemory addDependent: self.
         self update: #returnFromSnapshot
     ]
--
1.7.10.4


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

[PATCH 4/5] stinst: Make the result of STClassLoader be inspectable

Holger Freyther
In reply to this post by Holger Freyther
From: Holger Hans Peter Freyther <[hidden email]>

Looking at the result of the STClassLoader in VisualGST created
a DNU. Add an >>#article to the LoadedBehavior class.

2012-09-09  Holger Freyther  <[hidden email]>

        * tests/stcompiler.st: Add testcase for article.
        * tests/stcompiler.ok: Update the test result.

2012-09-09  Holger Freyther  <[hidden email]>

        * STLoaderObjs.st: Add LoadedBehavior>>#article.
---
 ChangeLog                              |    5 +++++
 packages/stinst/parser/ChangeLog       |    4 ++++
 packages/stinst/parser/STLoaderObjs.st |    4 ++++
 tests/stcompiler.ok                    |    3 +++
 tests/stcompiler.st                    |    8 ++++++++
 5 files changed, 24 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4c8caff..7353dcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-09-09  Holger Freyther  <[hidden email]>
 
+ * tests/stcompiler.st: Add testcase for article.
+ * tests/stcompiler.ok: Update the test result.
+
+2012-09-09  Holger Freyther  <[hidden email]>
+
  * kernel/Delay.st: Name the delay process.
 
 2012-09-09  Holger Freyther  <[hidden email]>
diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog
index ee88420..c49df53 100644
--- a/packages/stinst/parser/ChangeLog
+++ b/packages/stinst/parser/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-09  Holger Freyther  <[hidden email]>
+
+ * STLoaderObjs.st: Add LoadedBehavior>>#article.
+
 2011-11-10  Gwenael Casaccio  <[hidden email]>
             Paolo Bonzini  <[hidden email]>
 
diff --git a/packages/stinst/parser/STLoaderObjs.st b/packages/stinst/parser/STLoaderObjs.st
index 7fd4114..99688ce 100644
--- a/packages/stinst/parser/STLoaderObjs.st
+++ b/packages/stinst/parser/STLoaderObjs.st
@@ -977,6 +977,10 @@ instanceVariableNames: ivn
 
 superclass
     ^superclass
+!
+
+article
+    ^superclass article
 ! !
 
 !LoadedMetaclass methodsFor: 'printing'!
diff --git a/tests/stcompiler.ok b/tests/stcompiler.ok
index a07cebc..f3acb52 100644
--- a/tests/stcompiler.ok
+++ b/tests/stcompiler.ok
@@ -44,3 +44,6 @@ returned value is TextCollector new "<0>"
 
 Execution begins...
 returned value is OrderedSet new: 32 "<0>"
+
+Execution begins...
+returned value is 'an'
diff --git a/tests/stcompiler.st b/tests/stcompiler.st
index 7144867..ef44d8d 100644
--- a/tests/stcompiler.st
+++ b/tests/stcompiler.st
@@ -90,3 +90,11 @@ asParser
     with: STInST.SqueakFileInParser.
 ]
 
+Eval [
+    | classes |
+
+    classes := STInST.STClassLoader new
+                  parseSmalltalkStream: 'Object subclass: Foo []' readStream
+                  with: STInST.GSTFileInParser.
+    classes first article
+]
--
1.7.10.4


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

[PATCH 5/5] libgst: Fix a race when polling on a filedescriptor

Holger Freyther
In reply to this post by Holger Freyther
From: Paolo Bonzini <[hidden email]>

It is possible that data arrives after the initial poll
and before enabling SIGIO/SIGPOLL of the filedescriptor.
This would lead to a read on a sockey being blocked forever
even when data is available.

2012-09-09  Paolo Bonzini  <[hidden email]>

        * libgst/sysdep/posix/events.c: Register the fd with gst
        before polling.
---
 libgst/ChangeLog             |    5 +++++
 libgst/sysdep/posix/events.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index e04612c..31cd69a 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-09  Paolo Bonzini  <[hidden email]>
+
+ * libgst/sysdep/posix/events.c: Register the fd with gst
+ before polling.
+
 2012-07-15  Paolo Bonzini  <[hidden email]>
 
  * libgst/opt.c: Fix error in compute_jump_length that could lead
diff --git a/libgst/sysdep/posix/events.c b/libgst/sysdep/posix/events.c
index da3a784..2525b37 100644
--- a/libgst/sysdep/posix/events.c
+++ b/libgst/sysdep/posix/events.c
@@ -395,6 +395,10 @@ _gst_async_file_polling (int fd,
   polling_queue *new;
 
   index = num_used_pollfds++;
+
+  /* Enable async io on the fd before we poll as data could arrive after
+     the fd was polled and before the async io was enabled. */
+  set_file_interrupt (fd, file_polling_handler);
   result = _gst_sync_file_polling (fd, cond);
   if (result != 0)
     {
@@ -431,7 +435,6 @@ _gst_async_file_polling (int fd,
     }
   pollfds[index].revents = 0;
 
-  set_file_interrupt (fd, file_polling_handler);
 
   /* Even if I/O was made possible while setting up our machinery,
      the list will only be walked before the next bytecode, so there
--
1.7.10.4


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

Re: [PATCH 1/5] sunit: Fix TestCase new printString signals an exception

Paolo Bonzini-2
In reply to this post by Holger Freyther
Il 09/09/2012 23:56, Holger Hans Peter Freyther ha scritto:

> From: Holger Hans Peter Freyther <[hidden email]>
>
> Use testSelector printString as this works when testSelector
> is a String/Symbol or an UndefinedObject.
>
> 2012-08-03  Holger Hans Peter Freyther  <[hidden email]>
>
> * packages/sunit/SUnit.st: Use testSelector printString as
> the testSelector may be an UndefinedObject.
> * packages/sunit/SUnitTest.st: Add #testPrintString.
> ---
>  packages/sunit/ChangeLog     |    6 ++++++
>  packages/sunit/SUnit.st      |    2 +-
>  packages/sunit/SUnitTests.st |    9 +++++++++
>  3 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/packages/sunit/ChangeLog b/packages/sunit/ChangeLog
> index 8449214..56a52cf 100644
> --- a/packages/sunit/ChangeLog
> +++ b/packages/sunit/ChangeLog
> @@ -1,3 +1,9 @@
> +2012-08-03  Holger Hans Peter Freyther  <[hidden email]>
> +
> + * packages/sunit/SUnit.st: Use testSelector printString as
> + the testSelector may be an UndefinedObject.
> + * packages/sunit/SUnitTest.st: Add #testPrintString.
> +
>  2010-12-04  Paolo Bonzini  <[hidden email]>
>  
>   * package.xml: Remove now superfluous <file> tags.
> diff --git a/packages/sunit/SUnit.st b/packages/sunit/SUnit.st
> index bb814f9..58b3ab0 100644
> --- a/packages/sunit/SUnit.st
> +++ b/packages/sunit/SUnit.st
> @@ -1104,7 +1104,7 @@ When you are writing a test case method, send #assert: aBoolean when you want to
>   aStream
>      nextPutAll: self class printString;
>      nextPutAll: '>>#';
> -    nextPutAll: testSelector
> +    nextPutAll: testSelector printString.

Changed both class and testSelector printing to use #print:, and applied.

Paolo

>      ]
>  ]
>  
> diff --git a/packages/sunit/SUnitTests.st b/packages/sunit/SUnitTests.st
> index d1160a1..166ee89 100644
> --- a/packages/sunit/SUnitTests.st
> +++ b/packages/sunit/SUnitTests.st
> @@ -276,6 +276,15 @@ if the tests are hard to write, something is probably wrong with the design".'>
>      assert: aResult errorCount = anErrorCount
>      ]
>  
> +    testPrintString [
> +        <category: 'Testing'>
> +        "Make sure that a new test can be printed"
> +
> +        self
> +            shouldnt: [TestCase new printString] raise: Exception;
> +            assert: TestCase new printString = 'TestCase>>#nil'.
> +    ]
> +
>      isLogging [
>   <category: 'Logging'>
>   ^true
>


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