diff options
Diffstat (limited to 'test/rake/test_rake_functional.rb')
-rw-r--r-- | test/rake/test_rake_functional.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/rake/test_rake_functional.rb b/test/rake/test_rake_functional.rb index d540e2ab29..23249b97fb 100644 --- a/test/rake/test_rake_functional.rb +++ b/test/rake/test_rake_functional.rb @@ -438,9 +438,10 @@ class TestRakeFunctional < Rake::TestCase end def test_failing_test_sets_exit_status + skip if uncertain_exit_status? rakefile_failing_test_task rake - assert_equal 1, @exit.exitstatus + assert @exit.exitstatus > 0, "should be non-zero" end def test_stand_alone_filelist @@ -449,11 +450,19 @@ class TestRakeFunctional < Rake::TestCase run_ruby @ruby_options + ["stand_alone_filelist.rb"] assert_match(/^stand_alone_filelist\.rb$/, @out) - assert_equal 0, @exit.exitstatus + assert_equal 0, @exit.exitstatus unless uncertain_exit_status? end private + # We are unable to accurately verify that Rake returns a proper + # error exit status using popen3 in Ruby 1.8.7 and JRuby. This + # predicate function can be used to skip tests or assertions as + # needed. + def uncertain_exit_status? + RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION) + end + # Run a shell Ruby command with command line options (using the # default test options). Output is captured in @out and @err def ruby(*option_list) @@ -474,9 +483,9 @@ class TestRakeFunctional < Rake::TestCase inn, out, err, wait = Open3.popen3(RUBY, *option_list) inn.close + @exit = wait ? wait.value : $? @out = out.read @err = err.read - @exit = wait.value puts "OUTPUT: [#{@out}]" if @verbose puts "ERROR: [#{@err}]" if @verbose |