tests/GDBDebuggerTestCase.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 23 Jan 2019 21:38:06 +0000
changeset 170 6cf990ac2cad
parent 152 fab425b52c21
child 208 b0d2028189fa
permissions -rw-r--r--
Add `GDBDebugger >> #waitForAllEventsProcessed` and `#waitForAllCommandsProcessed` These methods are meant mainly for synchronization in tests, NOT for normal user code. Uses should avoid calling these.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     1
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     2
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     3
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     4
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     5
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     7
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     8
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
     9
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    10
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    13
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    14
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    16
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    18
"
56
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'jv:libgdbs/tests' }"
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: Smalltalk }"
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
TestCase subclass:#GDBDebuggerTestCase
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:'debugger'
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    25
	classVariableNames:'DebuggerSetupBlock'
56
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'GDB-Core-Tests'
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
91
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    30
!GDBDebuggerTestCase class methodsFor:'documentation'!
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    31
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    32
copyright
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    33
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    34
jv:libgdbs - GNU Debugger Interface Library
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    35
Copyright (C) 2015-now Jan Vrany
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    36
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    37
This library is free software; you can redistribute it and/or
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    39
License as published by the Free Software Foundation; either
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    40
version 2.1 of the License. 
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    41
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    42
This library is distributed in the hope that it will be useful,
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    45
Lesser General Public License for more details.
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    46
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    48
License along with this library; if not, write to the Free Software
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    50
"
472a4841a8b6 License this package under 'GNU Lesser General Public License'
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 77
diff changeset
    51
! !
77
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    52
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    53
!GDBDebuggerTestCase class methodsFor:'accessing'!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    54
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    55
resources
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    56
    ^ Array with: GDBDebuggeesResource
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    57
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    58
    "Created: / 28-02-2015 / 00:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    59
! !
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    60
56
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
!GDBDebuggerTestCase class methodsFor:'queries'!
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
isAbstract
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    "Return if this class is an abstract class.
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
     True is returned here for myself only; false for subclasses.
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
     Abstract subclasses must redefine again."
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    ^ self == GDBDebuggerTestCase.
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
! !
20989de12cfb More work on variables + tests
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    71
!GDBDebuggerTestCase methodsFor:'running'!
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    72
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    73
setUp
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    74
    super setUp.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    75
    debugger := DebuggerSetupBlock notNil ifTrue:[ DebuggerSetupBlock value ] ifFalse:[ GDBDebugger new ].
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    76
    self assert:(debugger isKindOf: GDBDebugger).
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    77
    self assert: debugger isConnected.
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    78
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    79
    "Created: / 18-10-2018 / 10:34:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    80
    "Modified (format): / 19-10-2018 / 09:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    81
!
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    82
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    83
tearDown
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    84
    (debugger notNil and:[ debugger isConnected ]) ifTrue:[ 
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    85
        debugger send: 'quit' andWait: false.
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    86
    ].
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    87
    super tearDown.
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    88
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    89
    "Created: / 19-01-2018 / 09:18:42 / jv"
152
fab425b52c21 Refactor `GDBProcess` hierarchy to improve portability
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 95
diff changeset
    90
    "Modified: / 18-10-2018 / 10:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
95
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    91
! !
f417138e9c48 Win32: initial support for Windows
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 91
diff changeset
    92
77
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    93
!GDBDebuggerTestCase class methodsFor:'documentation'!
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    94
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    95
version_HG
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    96
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    97
    ^ '$Changeset: <not expanded> $'
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    98
! !
305094ae9fd9 Removed simulated test - as the interface to GDB changes, recorded sessions are no longer valid.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 63
diff changeset
    99