From 1582bd9382f202b45c11c874c8c26ca8727276de Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 10 Jul 2025 13:12:03 -0700 Subject: [PATCH] Add Timeout message when bootstraptest times out --- bootstraptest/runner.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 24bbdafe8e..a8e67f3496 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -625,6 +625,8 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc) end end + class Timeout < StandardError; end + def get_result_string(opt = '', timeout: BT.timeout, **argh) if BT.ruby timeout = BT.apply_timeout_scale(timeout) @@ -634,7 +636,11 @@ class Assertion < Struct.new(:src, :path, :lineno, :proc) out = IO.popen("#{BT.ruby} -W0 #{opt} #{filename}", **kw) pid = out.pid th = Thread.new {out.read.tap {Process.waitpid(pid); out.close}} - th.value if th.join(timeout) + if th.join(timeout) + th.value + else + Timeout.new("timed out after #{timeout} seconds") + end ensure raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]