3636 $TestsToRun = ' libponyrt.tests,libponyc.tests,libponyc.run.tests.debug,libponyc.run.tests.release,stdlib-debug,stdlib-release,grammar'
3737)
3838
39+ # Function to extract process exit code from LLDB output
40+ function Get-ProcessExitCodeFromLLDB {
41+ param (
42+ [string []]$LLDBOutput
43+ )
44+
45+ $processExitMatch = $LLDBOutput | Select-String - Pattern ' Process \d+ exited with status = (\d+)'
46+ if ($processExitMatch.Matches.Count -gt 0 ) {
47+ return [int ]$processExitMatch.Matches [0 ].Groups[1 ].Value
48+ } else {
49+ # If we can't find the pattern, return LLDB's exit code
50+ return $LastExitCode
51+ }
52+ }
53+
3954$srcDir = Split-Path $script :MyInvocation.MyCommand.Path
4055
4156switch ($Version )
@@ -256,7 +271,7 @@ switch ($Command.ToLower())
256271 Write-Output " $lldbcmd $lldbargs $outDir \libponyrt.tests.exe --gtest_shuffle"
257272 $lldboutput = & $lldbcmd $lldbargs $outDir \libponyrt.tests.exe -- gtest_shuffle
258273 Write-Output $lldboutput
259- $err = ( $lldboutput | Select-String - Pattern ' exited with status = (\S+) ' ).Matches[ 0 ].Groups[ 1 ].Value
274+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
260275 }
261276 else
262277 {
@@ -283,7 +298,7 @@ switch ($Command.ToLower())
283298 Write-Output " $lldbcmd $lldbargs $outDir \libponyc.tests.exe --gtest_shuffle"
284299 $lldboutput = & $lldbcmd $lldbargs $outDir \libponyc.tests.exe -- gtest_shuffle
285300 Write-Output $lldboutput
286- $err = ( $lldboutput | Select-String - Pattern ' exited with status = (\S+) ' ).Matches[ 0 ].Groups[ 1 ].Value
301+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
287302 }
288303 else
289304 {
@@ -344,7 +359,7 @@ switch ($Command.ToLower())
344359 Write-Output " $lldbcmd $lldbargs $outDir \stdlib-debug.exe --sequential --exclude=`" net/`" "
345360 $lldboutput = & $lldbcmd $lldbargs $outDir \stdlib-debug.exe -- sequential -- exclude= " net/"
346361 Write-Output $lldboutput
347- $err = ( $lldboutput | Select-String - Pattern ' exited with status = (\S+) ' ).Matches[ 0 ].Groups[ 1 ].Value
362+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
348363 }
349364 else
350365 {
@@ -380,7 +395,7 @@ switch ($Command.ToLower())
380395 Write-Output " $lldbcmd $lldbargs $outDir \stdlib-release.exe --sequential --exclude=`" net/`" "
381396 $lldboutput = & $lldbcmd $lldbargs $outDir \stdlib-release.exe -- sequential -- exclude= " net/"
382397 Write-Output $lldboutput
383- $err = ( $lldboutput | Select-String - Pattern ' exited with status = (\S+) ' ).Matches[ 0 ].Groups[ 1 ].Value
398+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
384399 }
385400 else
386401 {
@@ -472,7 +487,7 @@ switch ($Command.ToLower())
472487
473488 & $outDir \ponyc.exe -- bin- name= ubench -- output= $outDir test\rt- stress\string- message- ubench
474489 & $lldbcmd $lldbargs $outDir \ubench.exe -- pingers 320 -- initial- pings 5 -- report- count 40 -- report- interval 300 -- ponynoscale -- ponynoblock
475- $err = $LastExitCode
490+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
476491 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
477492 break
478493 }
@@ -483,7 +498,7 @@ switch ($Command.ToLower())
483498
484499 & $outDir \ponyc.exe -- bin- name= ubench -- output= $outDir test\rt- stress\string- message- ubench
485500 & $lldbcmd $lldbargs $outDir \ubench.exe -- pingers 320 -- initial- pings 5 -- report- count 40 -- report- interval 300 -- ponynoscale
486- $err = $LastExitCode
501+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
487502 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
488503 break
489504 }
@@ -494,7 +509,7 @@ switch ($Command.ToLower())
494509
495510 & $outDir \ponyc.exe -- debug -- bin- name= ubench -- output= $outDir test\rt- stress\string- message- ubench
496511 & $lldbcmd $lldbargs $outDir \ubench.exe -- pingers 320 -- initial- pings 5 -- report- count 40 -- report- interval 300 -- ponynoscale -- ponynoblock
497- $err = $LastExitCode
512+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
498513 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
499514 break
500515 }
@@ -505,7 +520,7 @@ switch ($Command.ToLower())
505520
506521 & $outDir \ponyc.exe -- debug -- bin- name= ubench -- output= $outDir test\rt- stress\string- message- ubench
507522 & $lldbcmd $lldbargs $outDir \ubench.exe -- pingers 320 -- initial- pings 5 -- report- count 40 -- report- interval 300 -- ponynoscale
508- $err = $LastExitCode
523+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
509524 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
510525 break
511526 }
@@ -516,7 +531,7 @@ switch ($Command.ToLower())
516531
517532 & $outDir \ponyc.exe -- bin- name= open-close -- output= $outDir test\rt- stress\tcp- open-close
518533 & $lldbcmd $lldbargs $outDir \open-close.exe -- ponynoblock 1000
519- $err = $LastExitCode
534+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
520535 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
521536 break
522537 }
@@ -527,7 +542,7 @@ switch ($Command.ToLower())
527542
528543 & $outDir \ponyc.exe -- bin- name= open-close -- output= $outDir test\rt- stress\tcp- open-close
529544 & $lldbcmd $lldbargs $outDir \open-close.exe 1000
530- $err = $LastExitCode
545+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
531546 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
532547 break
533548 }
@@ -538,7 +553,7 @@ switch ($Command.ToLower())
538553
539554 & $outDir \ponyc.exe -- debug -- bin- name= open-close -- output= $outDir test\rt- stress\tcp- open-close
540555 & $lldbcmd $lldbargs $outDir \open-close.exe -- ponynoblock 1000
541- $err = $LastExitCode
556+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
542557 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
543558 break
544559 }
@@ -549,7 +564,7 @@ switch ($Command.ToLower())
549564
550565 & $outDir \ponyc.exe -- debug -- bin- name= open-close -- output= $outDir test\rt- stress\tcp- open-close
551566 & $lldbcmd $lldbargs $outDir \open-close.exe 1000
552- $err = $LastExitCode
567+ $err = Get-ProcessExitCodeFromLLDB - LLDBOutput $lldboutput
553568 if ($err -ne 0 ) { throw " Stress test failed: exit code $err " }
554569 break
555570 }
0 commit comments