diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 11:43:07 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 11:43:07 +0000 |
commit | 244096b9a14f576de0f68ac4b26556ff09eafc3d (patch) | |
tree | 5847137f2d1b9f7a9cd9b4c17812ee32362a786a /test | |
parent | 9d693b181ce3bbd7553be36f604f5b694f8e9fea (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/fileutils/test_fileutils.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 295fbfd960..5d029c919c 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -17,8 +17,11 @@ class TestFileUtils < Test::Unit::TestCase fu.instance_variable_set(:@fileutils_output, write) th = Thread.new { read.read } th2 = Thread.new { - yield - write.close + begin + yield + ensure + write.close + end } th_value, _ = assert_join_threads([th, th2]) lines = th_value.lines.map {|l| l.chomp } @@ -136,7 +139,7 @@ class TestFileUtils < Test::Unit::TestCase def setup @prevdir = Dir.pwd - @groups = Process.groups if have_file_perm? + @groups = [Process.gid] | Process.groups if have_file_perm? tmproot = TMPROOT mymkdir tmproot unless File.directory?(tmproot) Dir.chdir tmproot @@ -208,6 +211,16 @@ class TestFileUtils < Test::Unit::TestCase # Test Cases # + def test_assert_output_lines + assert_raise(MiniTest::Assertion) { + Timeout.timeout(0.1) { + assert_output_lines([]) { + raise "ok" + } + } + } + end + def test_pwd check_singleton :pwd |