RegressionTests__OperatingSystemTest.st
author Claus Gittinger <cg@exept.de>
Mon, 03 Feb 2003 09:45:57 +0100
changeset 181 a56517005229
parent 155 753c1750e225
child 1265 df1555a5fb95
permissions -rw-r--r--
category change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"{ Package: 'exept:regression' }"
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#OperatingSystemTest
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
181
a56517005229 category change
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
     9
	category:'tests-Regression'
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
!OperatingSystemTest methodsFor:'release'!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
tearDown
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
    '/tmp/lsOut' asFilename delete.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
! !
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!OperatingSystemTest methodsFor:'tests'!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
154
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    21
testActorStream
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    22
    |expected outStr errStr exitStatus|
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    23
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    24
    OperatingSystem executeCommand:'ls > /tmp/lsOut'.
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    25
    expected := '/tmp/lsOut' asFilename contentsOfEntireFile.
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    26
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    27
    outStr := ActorStream new.
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    28
    outStr nextPutLineBlock:[:line | Transcript normal; showCR:line ].
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    29
    errStr := ActorStream new.
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    30
    outStr nextPutLineBlock:[:line | Transcript bold; showCR:line ].
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    31
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    32
    OperatingSystem
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    33
        executeCommand:'ls'
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    34
        inputFrom:nil
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    35
        outputTo:outStr
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    36
        errorTo:errStr
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    37
        inDirectory:nil
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    38
        lineWise:true
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    39
        onError:[:status | exitStatus := status].
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    40
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    41
    "
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    42
     self new testActorStream
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    43
    "
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    44
!
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    45
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
testCommandOutput1
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    |expected outStr errStr exitStatus|
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    OperatingSystem executeCommand:'ls > /tmp/lsOut'.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    expected := '/tmp/lsOut' asFilename contentsOfEntireFile.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
154
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    52
    1 to:50 do:[:counter |
155
753c1750e225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    53
"/ Transcript show:counter; showCR:':'.
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
        outStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
        errStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        OperatingSystem
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
            executeCommand:'ls'
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
            inputFrom:nil
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
            outputTo:outStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
            errorTo:errStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
            onError:[:status | exitStatus := status].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        self assert:(outStr contents = expected).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
        self assert:(errStr contents isEmpty).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
        self assert:(exitStatus isNil).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    ].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
     self new testCommandOutput1
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
testCommandOutput2
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    |outStr errStr exitStatus|
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
154
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    75
    1 to:50 do:[:counter |
155
753c1750e225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    76
"/ Transcript show:counter; showCR:':'.
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
        outStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
        errStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
        OperatingSystem
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
            executeCommand:'ls /fooBar'
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
            inputFrom:nil
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
            outputTo:outStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
            errorTo:errStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
            onError:[:status | exitStatus := status].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
        self assert:(outStr contents isEmpty).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
        self assert:(errStr contents notEmpty).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
        self assert:(exitStatus success not).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
        self assert:(exitStatus stillAlive not).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
        self assert:(exitStatus couldNotExecute not).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
     self new testCommandOutput2
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
testInvalidCommand
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    |outStr errStr exitStatus|
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
154
e67b3e320bc0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   100
    1 to:50 do:[:counter |
155
753c1750e225 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
   101
"/ Transcript show:counter; showCR:':'.
153
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
        outStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
        errStr := '' writeStream.
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
        OperatingSystem
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
            executeCommand:'blabla /fooBar'
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
            inputFrom:nil
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
            outputTo:outStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
            errorTo:errStr
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
            onError:[:status | exitStatus := status].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
        self assert:(exitStatus success not).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
        self assert:(exitStatus stillAlive not).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
        self assert:(exitStatus couldNotExecute).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        self assert:(outStr contents isEmpty).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        self assert:(errStr contents notEmpty).
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    ].
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
     self new testInvalidCommand
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    "
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
! !
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
!OperatingSystemTest class methodsFor:'documentation'!
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
version
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    ^ '$Header$'
5aff06c4818d initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
! !