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

ruby-changes:52781

From: k0kubun <ko1@a...>
Date: Wed, 10 Oct 2018 20:58:45 +0900 (JST)
Subject: [ruby-changes:52781] k0kubun:r64993 (trunk): spec/.../ole_method.rb: retry WIN32OLERuntimeError

k0kubun	2018-10-10 20:58:40 +0900 (Wed, 10 Oct 2018)

  New Revision: 64993

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

  Log:
    spec/.../ole_method.rb: retry WIN32OLERuntimeError
    
    This part sometimes causes random failure like:
    https://ci.appveyor.com/project/ruby/ruby/builds/19382723/job/bedc33p4nolcqkp6
    
    Let me retry this to make CI stable.

  Modified files:
    trunk/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
Index: spec/ruby/library/win32ole/win32ole/shared/ole_method.rb
===================================================================
--- spec/ruby/library/win32ole/win32ole/shared/ole_method.rb	(revision 64992)
+++ spec/ruby/library/win32ole/win32ole/shared/ole_method.rb	(revision 64993)
@@ -5,7 +5,20 @@ platform_is :windows do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb#L5
 
   describe :win32ole_ole_method, shared: true do
     before :each do
-      @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
+      # This part is unstable, so retrying 3 times.
+      tries = 0
+      begin
+        @ie = WIN32OLESpecs.new_ole('InternetExplorer.Application')
+      rescue WIN32OLERuntimeError => e
+        # WIN32OLERuntimeError: failed to create WIN32OLE object from `InternetExplorer.Application'
+        #     HRESULT error code:0x800704a6
+        #       A system shutdown has already been scheduled.
+        if tries < 3
+          tries += 1
+          $stderr.puts "win32ole_ole_method retry (#{tries}): #{e.class}: #{e.message}"
+          retry
+        end
+      end
     end
 
     after :each do

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

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