Skip to content

Commit

Permalink
Kill bundled gem tests when interrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jul 24, 2022
1 parent 114f85e commit e0a7e5e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.mk
Expand Up @@ -1407,7 +1407,7 @@ no-test-bundled-gems:

BUNDLED_GEMS =
test-bundled-gems-run: $(PREPARE_BUNDLED_GEMS)
$(Q) $(XRUBY) $(tooldir)/test-bundled-gems.rb $(BUNDLED_GEMS)
$(gnumake_recursive)$(Q) $(XRUBY) $(tooldir)/test-bundled-gems.rb $(BUNDLED_GEMS)

test-bundler-precheck: $(TEST_RUNNABLE)-test-bundler-precheck
no-test-bundler-precheck:
Expand Down
12 changes: 10 additions & 2 deletions tool/test-bundled-gems.rb
Expand Up @@ -71,15 +71,23 @@
break Timeout.timeout(sec) {Process.wait(pid)}
rescue Timeout::Error
end
rescue Interrupt
exit_code = Signal.list["INT"]
Process.kill("-KILL", pid)
Process.wait(pid)
break
end

unless $?.success?
puts "Tests failed with exit code #{$?.exitstatus}"

puts "Tests failed " +
($?.signaled? ? "by SIG#{Signal.signame($?.termsig)}" :
"with exit code #{$?.exitstatus}")
if allowed_failures.include?(gem)
puts "Ignoring test failures for #{gem} due to \$TEST_BUNDLED_GEMS_ALLOW_FAILURES"
else
failed << gem
exit_code = $?.exitstatus
exit_code = $?.exitstatus if $?.exitstatus
end
end
print "##[endgroup]\n" if github_actions
Expand Down

0 comments on commit e0a7e5e

Please sign in to comment.