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

ruby-changes:60457

From: nagachika <ko1@a...>
Date: Fri, 20 Mar 2020 23:31:34 +0900 (JST)
Subject: [ruby-changes:60457] f2ba3a0c45 (ruby_2_6): merge revision(s) c6633f21a49c90ab7c37076d79c286bbf3438c1f:

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

From f2ba3a0c45fd83daa326cc28b6410760691c0e54 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Fri, 20 Mar 2020 14:31:10 +0000
Subject: merge revision(s) c6633f21a49c90ab7c37076d79c286bbf3438c1f:

	Update some syslog tests to absurb the format change of FreeBSD
	 syslog

	FreeBSD

	```
	$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
	rubyspec 78462 - - Hello
	```

	Linux

	```
	$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
	rubyspec: Hello
	```

	https://github.com/freebsd/freebsd/commit/591ef7c8076109cff3c41f9bb50da996a34121e9

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/spec/ruby/library/syslog/log_spec.rb b/spec/ruby/library/syslog/log_spec.rb
index f92f69e..11b0e05 100644
--- a/spec/ruby/library/syslog/log_spec.rb
+++ b/spec/ruby/library/syslog/log_spec.rb
@@ -20,7 +20,7 @@ platform_is_not :windows do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/log_spec.rb#L20
             s.log(Syslog::LOG_ALERT, "Hello")
             s.log(Syslog::LOG_CRIT, "World")
           end
-        }.should output_to_fd("rubyspec: Hello\nrubyspec: World\n", $stderr)
+        }.should output_to_fd(/\Arubyspec(?::| \d+ - -) Hello\nrubyspec(?::| \d+ - -) World\n\z/, $stderr)
       end
 
       it "accepts undefined priorites" do
@@ -29,7 +29,7 @@ platform_is_not :windows do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/log_spec.rb#L29
             s.log(1337, "Hello")
           end
           # use a regex since it'll output unknown facility/priority messages
-        }.should output_to_fd(/rubyspec: Hello/, $stderr)
+        }.should output_to_fd(/rubyspec(?::| \d+ - -) Hello\n\z/, $stderr)
       end
 
       it "fails with TypeError on nil log messages" do
@@ -49,7 +49,7 @@ platform_is_not :windows do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/log_spec.rb#L49
           Syslog.open("rubyspec", Syslog::LOG_PERROR) do |s|
             s.log(Syslog::LOG_ALERT, "%s x %d", "chunky bacon", 2)
           end
-        }.should output_to_fd("rubyspec: chunky bacon x 2\n", $stderr)
+        }.should output_to_fd(/rubyspec(?::| \d+ - -) chunky bacon x 2\n\z/, $stderr)
       end
     end
   end
diff --git a/spec/ruby/library/syslog/shared/log.rb b/spec/ruby/library/syslog/shared/log.rb
index 6d0d3a3..b8b812a 100644
--- a/spec/ruby/library/syslog/shared/log.rb
+++ b/spec/ruby/library/syslog/shared/log.rb
@@ -13,7 +13,7 @@ describe :syslog_log, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/shared/log.rb#L13
         Syslog.open("rubyspec", Syslog::LOG_PERROR) do
           Syslog.send(@method, "Hello")
         end
-      }.should output_to_fd("rubyspec: Hello\n", $stderr)
+      }.should output_to_fd(/\Arubyspec(?::| \d+ - -) Hello\n\z/, $stderr)
     end
 
     it "accepts sprintf arguments" do
@@ -22,7 +22,7 @@ describe :syslog_log, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/shared/log.rb#L22
           Syslog.send(@method, "Hello %s", "world")
           Syslog.send(@method, "%d dogs", 2)
         end
-      }.should output_to_fd("rubyspec: Hello world\nrubyspec: 2 dogs\n", $stderr)
+      }.should output_to_fd(/\Arubyspec(?::| \d+ - -) Hello world\nrubyspec(?::| \d+ - -) 2 dogs\n\z/, $stderr)
     end
 
     it "works as an alias for Syslog.log" do
@@ -34,7 +34,7 @@ describe :syslog_log, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/syslog/shared/log.rb#L34
           Syslog.log(level, "Hello")
         end
         # make sure the same thing is written to $stderr.
-      }.should output_to_fd(response * 2, $stderr)
+      }.should output_to_fd(/\A(?:rubyspec(?::| \d+ - -) Hello\n){2}\z/, $stderr)
     end
   end
 end
diff --git a/test/test_syslog.rb b/test/test_syslog.rb
index c66e5f5..2a74761 100644
--- a/test/test_syslog.rb
+++ b/test/test_syslog.rb
@@ -113,7 +113,7 @@ class TestSyslog < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_syslog.rb#L113
   end
 
   def syslog_line_regex(ident, message)
-    /(?:^| )#{Regexp.quote(ident)}(?:\[([1-9][0-9]*)\])?(?: |[: ].* )#{Regexp.quote(message)}$/
+    /(?:^| )#{Regexp.quote(ident)}(?:\[([1-9][0-9]*)\])?(?: | ([1-9][0-9]*) - - ||[: ].* )#{Regexp.quote(message)}$/
   end
 
   def test_log
@@ -168,8 +168,9 @@ class TestSyslog < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_syslog.rb#L168
         end
         m = re.match(line)
         assert_not_nil(m)
-        assert_not_nil(m[1])
-        assert_equal(pid, m[1].to_i)
+        output_pid = m[1] || m[2]
+        assert_not_nil(output_pid)
+        assert_equal(pid, output_pid.to_i)
       }
     }
   end
diff --git a/version.h b/version.h
index 97b395a..3389f3b 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.6"
 #define RUBY_RELEASE_DATE "2020-03-20"
-#define RUBY_PATCHLEVEL 142
+#define RUBY_PATCHLEVEL 143
 
 #define RUBY_RELEASE_YEAR 2020
 #define RUBY_RELEASE_MONTH 3
-- 
cgit v0.10.2


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

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