rakelib/test.rake
changeset 121 dd6b76197aa0
parent 93 650412e81596
child 137 e665031cade7
--- a/rakelib/test.rake	Tue Jan 31 12:47:19 2017 +0000
+++ b/rakelib/test.rake	Tue Jan 31 13:01:09 2017 +0000
@@ -102,14 +102,28 @@
   project.packages.each do | pkg |
     if pkg.test
       task "test:package:#{pkg.name}" => [ 'stx:goodies/builder/reports', REPORT_DIR ] do
-        if pkg.coverage
-          run_report(app, [ pkg.name ], TESTREPORT_CLASS,  '', '--coverage')
-        else
-          run_report(app, [ pkg.name ], TESTREPORT_CLASS)
-	      end
-        # Extract summary from XML report and keep it. Yeah, parsing XML
-        # using regexps is a bad thing, but it's quick and lot less code!
         report_file = File.expand_path(REPORT_DIR) / "#{pkg.name_components.join('_')}-#{BUILD_ID}-Test.xml"
+        # Sigh, sigh. On CI server, sometimes it happen that tests are simply not run. 
+        # I was not able to debug the issue anyhow, any attempt to attach a debugger,
+        # add a debug print or run it manually failed as the problem did not manifest.
+        # 
+        # This is a feeble and horrible attempt to just cover up the problem by
+        # trying multiple times. I don't want to spend more time chasing issues
+        # like this. Sorry. 
+        #
+        # Let's see if it helps. 
+        for i in 1..5 do
+          if pkg.coverage
+            run_report(app, [ pkg.name ], TESTREPORT_CLASS,  '', '--coverage')
+          else
+            run_report(app, [ pkg.name ], TESTREPORT_CLASS)
+          end
+          # Extract summary from XML report and keep it. Yeah, parsing XML
+          # using regexps is a bad thing, but it's quick and lot less code!          
+          if File.exist? report_file then            
+            break
+          end          
+        end
         report_summary = TestReportSummary.new(pkg.name, report_file);
         TestReportSummary::SUMMARIES << report_summary    
       end