Skip to content

Commit

Permalink
Merge pull request #55 from janvrany/pr/randomize-qemu-debug-stub-port
Browse files Browse the repository at this point in the history
Randomize port number for QEMU's debug stub
  • Loading branch information
janvrany committed Sep 3, 2024
2 parents 12ff5ea + 471552c commit f9b0872
Showing 1 changed file with 21 additions and 3 deletions.
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

0 comments on commit f9b0872

Please sign in to comment.