Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomize port number for QEMU's debug stub #55

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/Tinyrossa-Tests/TRCompilationTestShellQEMU.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,34 @@ Class {
#instVars : [
'qemu'
],
#classVars : [
'QemuDebugPortRandom'
],
#category : #'Tinyrossa-Tests-Shells'
}

{ #category : #initialization }
TRCompilationTestShellQEMU class >> initialize [
QemuDebugPortRandom := Random new seed: 1234
]

{ #category : #running }
TRCompilationTestShellQEMU >> setUp [
| qemuCmd |
| qemuDebugPort qemuCmd |

super setUp.

qemuCmd := target qemu, ' -g 1234 ', binary pathString.
"Randomize port where QEMU's debug stub is listening.
This is to allow running tests simultaneously on both
Smalltalk/X and Pharo (as they take some time to finish)."

Smalltalk isSmalltalkX ifTrue: [
qemuDebugPort := 30000 + (QemuDebugPortRandom nextInt: 1000).
] ifFalse: [
qemuDebugPort := 31000 + (QemuDebugPortRandom nextInt: 1000).
].

qemuCmd := target qemu, ' -g ', qemuDebugPort printString, ' ', binary pathString.

"First, start QEMU... "
qemu := OSProcess new command: qemuCmd.
Expand All @@ -22,7 +40,7 @@ TRCompilationTestShellQEMU >> setUp [
(Delay forSeconds: 1) wait.

"...then setup debugger object (using either libgdbs or ULD)"
self setUpDebuggerOnHost: 'localhost' port: 1234.
self setUpDebuggerOnHost: 'localhost' port: qemuDebugPort.
]

{ #category : #running }
Expand Down
Loading