merge revision(s) 56884,56892: [Backport #12910]

test_fileutils.rb: Use primary group too

	* test/fileutils/test_fileutils.rb (TestFileUtils#setup): Use
  primary group as well as supplementary groups.  based on the
  patch by Vit Ondruch at [ruby-core:78053].  [Bug #12910]

	It might happen in certain environments (systemd-nspawn) that
	process has no supplementary groups, but primary groups should be
	enough to pass most of the tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@57223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-12-27 11:43:07 +00:00
parent 9d693b181c
commit 244096b9a1
2 changed files with 17 additions and 4 deletions

View file

@ -17,8 +17,11 @@ class TestFileUtils < Test::Unit::TestCase
fu.instance_variable_set(:@fileutils_output, write) fu.instance_variable_set(:@fileutils_output, write)
th = Thread.new { read.read } th = Thread.new { read.read }
th2 = Thread.new { th2 = Thread.new {
begin
yield yield
ensure
write.close write.close
end
} }
th_value, _ = assert_join_threads([th, th2]) th_value, _ = assert_join_threads([th, th2])
lines = th_value.lines.map {|l| l.chomp } lines = th_value.lines.map {|l| l.chomp }
@ -136,7 +139,7 @@ class TestFileUtils < Test::Unit::TestCase
def setup def setup
@prevdir = Dir.pwd @prevdir = Dir.pwd
@groups = Process.groups if have_file_perm? @groups = [Process.gid] | Process.groups if have_file_perm?
tmproot = TMPROOT tmproot = TMPROOT
mymkdir tmproot unless File.directory?(tmproot) mymkdir tmproot unless File.directory?(tmproot)
Dir.chdir tmproot Dir.chdir tmproot
@ -208,6 +211,16 @@ class TestFileUtils < Test::Unit::TestCase
# Test Cases # Test Cases
# #
def test_assert_output_lines
assert_raise(MiniTest::Assertion) {
Timeout.timeout(0.1) {
assert_output_lines([]) {
raise "ok"
}
}
}
end
def test_pwd def test_pwd
check_singleton :pwd check_singleton :pwd

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.7" #define RUBY_VERSION "2.2.7"
#define RUBY_RELEASE_DATE "2016-12-27" #define RUBY_RELEASE_DATE "2016-12-27"
#define RUBY_PATCHLEVEL 413 #define RUBY_PATCHLEVEL 414
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 12 #define RUBY_RELEASE_MONTH 12