Merge
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 30 Aug 2018 10:06:05 +0100
changeset 254 70c9861ad62f
parent 250 86db38276922 (current diff)
parent 253 3747e4b3256b (diff)
child 255 6d6880749905
Merge
rakelib/setup.rake
rakelib/test.rake
--- a/rakelib/setup.rake	Fri Aug 24 13:34:05 2018 +0100
+++ b/rakelib/setup.rake	Thu Aug 30 10:06:05 2018 +0100
@@ -14,11 +14,21 @@
 # Guess the value of BUILD_TARGET for system on which we're currently 
 # running in form of GNU target triplet, such as `x86_64-pc-linux-gnu`.
 # Essentially a wrapper for config.guess used with autotools. 
-def build_target_guess()
-  return `./config.guess`.chop()
+def build_target_guess
+  target = `sh config.guess`.chop
+  # Workaround for MSYS2 / MINGW environment. When using MSYS2 environment to build 
+  # Smalltalk/X, GNU config.guess reports `x86_64-pc-msys` rather than `i686-pc-mingw32`
+  # or `x86_64-w64-mingw32` which are the values used by CI and/or third-party libraries. 
+  # Therefore we unify the value here (at least for now).
+  case target
+    when 'x86_64-pc-msys'
+      target = 'x86_64-w64-mingw32'
+  end  
+  # /Workaround
+  return target
 end
 
-unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess(); end
+unless defined? BUILD_TARGET; BUILD_TARGET = ENV['BUILD_TARGET'] || build_target_guess; end
 
 # "Guess" the current "branch".
 def build_branch_guess()
--- a/rakelib/test.rake	Fri Aug 24 13:34:05 2018 +0100
+++ b/rakelib/test.rake	Thu Aug 30 10:06:05 2018 +0100
@@ -5,9 +5,9 @@
 # A helper class to keep a summary of a test report
 class TestReportSummary
   SUMMARIES = []
-  PATTERN = /tests=\"(?<run>\d+)\".+failures=\"(?<failed>\d+)\" errors=\"(?<errors>\d+)\" skipped=\"(?<skipped>\d+)\"/
+  PATTERN = /tests="(?<run>\d+)".+failures="(?<failed>\d+)" errors="(?<errors>\d+)" skipped="(?<skipped>\d+)" time="(?<time>\d+\.\d+)"/
 
-  attr_reader :pkg, :run, :failed, :errors, :skipped
+  attr_reader :pkg, :run, :failed, :errors, :skipped, :time
 
   def passed
     @run - @failed - @errors - @skipped
@@ -16,6 +16,13 @@
   def outcome
     (@failed > 0 or @errors > 0) ? 'FAILED' : 'PASSED'
   end
+  
+  def execution_time
+    hours   = (@time/3600).floor
+    minutes = (@time/60).floor
+    seconds = (@time%60).round
+    "#{hours}h:#{minutes}m:#{seconds}s"
+  end
 
   # Creates a new summary for given package and report file.
   def initialize(pkg_name, report_file)
@@ -30,6 +37,7 @@
     @failed = matches['failed'].to_i
     @errors = matches['errors'].to_i
     @skipped = matches['skipped'].to_i
+    @time = matches['time'].to_f
   end
 end
 
@@ -151,18 +159,28 @@
 
   task :summary do
     outcome = 'PASSED'
+    # Detect if the test is run in ConEmu environment.  Running test suite in ConEmu
+    # yields often incorrect results due to some code injection and other techniques 
+    # used by ConEmu to fix bugs or other deficiencies in the MS code
+    if (ENV['ConEmuPID'])
+      puts
+      puts 'WARNING: Test was executed within ConEmu environment the test results are UNRELIABLE!'
+      puts 'Run the test suite directly in the cmd.exe or the powershell.exe.'
+      puts
+    end
     puts
     puts 'OVERALL SUMMARY'
     puts
     (TestReportSummary::SUMMARIES.sort { | a, b | a.pkg <=> b.pkg }).each do |test_summary|
-      puts "%-20s %s - %d run, %d passed, %d skipped, %d failed, %d errors" % [
+      puts "%-20s %s - %d run, %d passed, %d skipped, %d failed, %d errors, execution time: %s" % [
         test_summary.pkg,
         test_summary.outcome,
         test_summary.run,
         test_summary.passed,
         test_summary.skipped,
         test_summary.failed,
-        test_summary.errors
+        test_summary.errors,
+        test_summary.execution_time
       ]
       outcome = 'FAILED' if test_summary.failed > 0 or test_summary.errors > 0
     end