RegressionTests__PipeStreamTest.st
changeset 121 3e9313b9af20
child 170 247b3696e4cd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RegressionTests__PipeStreamTest.st	Tue Dec 11 16:35:21 2001 +0100
@@ -0,0 +1,149 @@
+"{ Package: 'exept:regression' }"
+
+"{ NameSpace: RegressionTests }"
+
+TestCase subclass:#PipeStreamTest
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Tests-Regression'
+!
+
+
+!PipeStreamTest methodsFor:'tests'!
+
+testReadCheckPipe4
+    "readCheck a pipe.
+     Do this and interrupt the reading thread heavily"
+
+    | s p count nLoop|
+
+    nLoop := 1000.
+
+    self createTestFile.
+
+    s := PipeStream readingFrom:'sleep 5'.
+
+    p := [
+        s readWait.
+        'readWait finished' printCR.
+    ] forkAt:7.
+
+    count := 0.
+    [p isDead] whileFalse:[
+        Delay waitForMilliseconds:5.
+        p interruptWith:[count := count + 1].
+    ].
+    ('readWait interrupted <1p> times' expandMacrosWith:count) printCR.
+
+    s close.
+
+    "
+     self new testReadCheckPipe4
+    "
+
+    "Modified: / 12.8.1998 / 13:42:13 / cg"
+!
+
+testReadCheckPipe5
+    "readCheck a pipe.
+     Do this and interrupt the reading thread heavily"
+
+    | s p count nLoop|
+
+    nLoop := 1000.
+
+    self createTestFile.
+
+    s := PipeStream readingFrom:'sleep 5; echo hello'.
+
+    p := [
+        s readWait.
+        'readWait finished' printCR.
+    ] forkAt:7.
+
+    count := 0.
+    [p isDead] whileFalse:[
+        Delay waitForMilliseconds:5.
+        p interruptWith:[count := count + 1].
+    ].
+    ('readWait interrupted <1p> times' expandMacrosWith:count) printCR.
+
+    s close.
+
+    "
+     self new testReadCheckPipe5
+    "
+
+    "Modified: / 12.8.1998 / 13:42:13 / cg"
+!
+
+testReadPipe6
+    "read a pipe.
+     Do this and interrupt the reading thread heavily"
+
+    | s p count nLoop|
+
+    nLoop := 1000.
+
+    self createTestFile.
+
+    s := PipeStream readingFrom:'sleep 5'.
+
+    p := [
+        'read: ' print. s nextLine printCR.
+    ] forkAt:7.
+
+    count := 0.
+    [p isDead] whileFalse:[
+        Delay waitForMilliseconds:5.
+        p interruptWith:[count := count + 1].
+    ].
+    ('read interrupted <1p> times' expandMacrosWith:count) printCR.
+
+    s close.
+
+    "
+     self new testReadPipe6
+    "
+
+    "Modified: / 12.8.1998 / 13:42:13 / cg"
+!
+
+testReadPipe7
+    "read a pipe.
+     Do this and interrupt the reading thread heavily"
+
+    |sz s p count nLoop|
+
+    nLoop := 1000.
+
+    self createTestFile.
+
+    s := PipeStream readingFrom:'sleep 5; echo hello'.
+
+    p := [
+        'read: ' print. s nextLine printCR.
+    ] forkAt:7.
+
+    count := 0.
+    [p isDead] whileFalse:[
+        Delay waitForMilliseconds:5.
+        p interruptWith:[count := count + 1].
+    ].
+    ('read interrupted <1p> times' expandMacrosWith:count) printCR.
+
+    s close.
+
+    "
+     self test7
+    "
+
+    "Modified: / 12.8.1998 / 13:42:13 / cg"
+! !
+
+!PipeStreamTest class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+! !