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

ruby-changes:51818

From: k0kubun <ko1@a...>
Date: Tue, 24 Jul 2018 21:19:52 +0900 (JST)
Subject: [ruby-changes:51818] k0kubun:r64032 (trunk): test_jit.rb: give up debugging cc1 issue

k0kubun	2018-07-24 21:19:47 +0900 (Tue, 24 Jul 2018)

  New Revision: 64032

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64032

  Log:
    test_jit.rb: give up debugging cc1 issue
    
    in a short term, and add retries to prevent random CI failures by it.
    
    I remember this and will address it later for sure.

  Modified files:
    trunk/test/ruby/test_jit.rb
Index: test/ruby/test_jit.rb
===================================================================
--- test/ruby/test_jit.rb	(revision 64031)
+++ test/ruby/test_jit.rb	(revision 64032)
@@ -730,19 +730,6 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L730
     out, err = eval_with_jit(script, verbose: 1, min_calls: min_calls)
     actual = err.scan(/^#{JIT_SUCCESS_PREFIX}:/).size
 
-    # Debugging on CI
-    if err.include?("error trying to exec 'cc1': execvp: No such file or directory") && RbConfig::CONFIG['CC'].start_with?('gcc')
-      $stderr.puts "\ntest/ruby/test_jit.rb: DEBUG OUTPUT:"
-      cc1 = %x`gcc -print-prog-name=cc1`.rstrip
-      if $?.success?
-        $stderr.puts "cc1 path: #{cc1}"
-        $stderr.puts "executable?: #{File.executable?(cc1)}"
-        $stderr.puts "ls:\n#{IO.popen(['ls', '-la', File.dirname(cc1)], &:read)}"
-      else
-        $stderr.puts 'Failed to fetch cc1 path'
-      end
-    end
-
     # Make sure that the script has insns expected to be tested
     used_insns = method_insns(script)
     insns.each do |insn|
@@ -799,11 +786,22 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L786
   # Run Ruby script with --jit-wait (Synchronous JIT compilation).
   # Returns [stdout, stderr]
   def eval_with_jit(env = nil, script, **opts)
-    stdout, stderr, status = super
-    assert_equal(true, status.success?, "Failed to run script with JIT:\n#{code_block(script)}\nstdout:\n#{code_block(stdout)}\nstderr:\n#{code_block(stderr)}")
+    stdout, stderr = nil, nil
+    # retry 3 times while cc1 error happens.
+    3.times do |i|
+      stdout, stderr, status = super
+      assert_equal(true, status.success?, "Failed to run script with JIT:\n#{code_block(script)}\nstdout:\n#{code_block(stdout)}\nstderr:\n#{code_block(stderr)}")
+      break unless retried_stderr?(stderr)
+    end
     [stdout, stderr]
   end
 
+  # We're retrying cc1 not found error on gcc, which should be solved in the future but ignored for now.
+  def retried_stderr?(stderr)
+    RbConfig::CONFIG['CC'].start_with?('gcc') &&
+      stderr.include?("error trying to exec 'cc1': execvp: No such file or directory")
+  end
+
   def code_block(code)
     "```\n#{code}\n```\n\n"
   end

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

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