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

ruby-changes:58594

From: Jun <ko1@a...>
Date: Thu, 7 Nov 2019 02:08:56 +0900 (JST)
Subject: [ruby-changes:58594] f5c7fc495a (master): Fix spawn_spec.rb for Travis arm64 environment.

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

From f5c7fc495a4b33db985f0d5286db2ec230e1ffb9 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@r...>
Date: Fri, 1 Nov 2019 16:27:34 +0100
Subject: Fix spawn_spec.rb for Travis arm64 environment.

The process group id (/proc/[pid]/stat 5th field) is 0
in the Travis arm64 environment.

This is a case where it is available.

$ cat /proc/4543/stat
4543 (ruby) S 4525 4525 1384 34818 4525 4194304 37443 1754841 0 0 366 105 2291 391 20 0 3 0 1381328 1428127744 11475 18446744073709551615 94195983785984 94195986670225 140728933833312 0 0 0 0 0 1107394127 0 0 0 17 2 0 0 1 0 0 94195987686512 94195987708942 94196017770496 140728933835483 140728933835595 140728933835595 140728933842904 0

This is a case where it is not available in Travis arm64 environment.

$ cat /proc/19179/stat
19179 (ruby) S 19160 0 0 0 -1 4194560 37618 1710547 313 163 770 665 5206 1439 20 0 2 0 17529566 1196347392 10319 18446744073709551615 187650811428864 187650815023116 281474602721280 0 0 0 0 4096 1107390031 0 0 0 17 22 0 0 0 0 0 187650815091456 187650815114064 187651414974464 281474602725080 281474602725211 281474602725211 281474602729420 0

See "man proc" for detail.

diff --git a/spec/ruby/core/process/spawn_spec.rb b/spec/ruby/core/process/spawn_spec.rb
index 46faced..06ad9a2 100644
--- a/spec/ruby/core/process/spawn_spec.rb
+++ b/spec/ruby/core/process/spawn_spec.rb
@@ -331,9 +331,19 @@ describe "Process.spawn" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/process/spawn_spec.rb#L331
 
     it "joins the specified process group if pgroup: pgid" do
       pgid = Process.getpgid(Process.pid)
-      -> do
-        Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: pgid)
-      end.should output_to_fd(pgid.to_s)
+      # The process group is not available on all platforms.
+      # See "man proc" - /proc/[pid]/stat - (5) pgrp
+      # In Travis arm64 environment, the value is 0.
+      #
+      # $ cat /proc/[pid]/stat
+      # 19179 (ruby) S 19160 0 0 ...
+      unless pgid.zero?
+        -> do
+          Process.wait Process.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), pgroup: pgid)
+        end.should output_to_fd(pgid.to_s)
+      else
+        skip "The process group is not available."
+      end
     end
 
     it "raises an ArgumentError if given a negative :pgroup option" do
-- 
cgit v0.10.2


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

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