[前][次][番号順一覧][スレッド一覧]

ruby-changes:72664

From: Nobuyoshi <ko1@a...>
Date: Sun, 24 Jul 2022 18:42:03 +0900 (JST)
Subject: [ruby-changes:72664] e0a7e5e131 (master): Kill bundled gem tests when interrupted

https://git.ruby-lang.org/ruby.git/commit/?id=e0a7e5e131

From e0a7e5e13141a06103673b9d4ff21ca864ec38f9 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 24 Jul 2022 16:35:38 +0900
Subject: Kill bundled gem tests when interrupted

---
 common.mk                 |  2 +-
 tool/test-bundled-gems.rb | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/common.mk b/common.mk
index b4b00bdd46..aeb87dfb55 100644
--- a/common.mk
+++ b/common.mk
@@ -1407,7 +1407,7 @@ no-test-bundled-gems: https://github.com/ruby/ruby/blob/trunk/common.mk#L1407
 
 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:
diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb
index 6312e1872d..1bdf2fa95a 100644
--- a/tool/test-bundled-gems.rb
+++ b/tool/test-bundled-gems.rb
@@ -71,15 +71,23 @@ File.foreach("#{gem_dir}/bundled_gems") do |line| https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L71
       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
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]