summary refs log tree commit diff stats
path: root/tests/testament/tester.nim
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2015-10-07 16:42:08 -0700
committerAman Gupta <aman@tmm1.net>2015-10-07 16:42:08 -0700
commit582c5054a11a3d91264a5875bed8463cbed29776 (patch)
treeda8245955cfd390a54e744cdf71d9a3fbfd8e5e8 /tests/testament/tester.nim
parentb418153899ae5c0a9cd53376e8684f32292bb0e1 (diff)
downloadNim-582c5054a11a3d91264a5875bed8463cbed29776.tar.gz
report duration to appveyor runner
Diffstat (limited to 'tests/testament/tester.nim')
-rw-r--r--tests/testament/tester.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index 8c8d63da7..4d4bade00 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -12,7 +12,7 @@
 import
   parseutils, strutils, pegs, os, osproc, streams, parsecfg, json,
   marshal, backend, parseopt, specs, htmlgen, browsers, terminal,
-  algorithm, compiler/nodejs, re
+  algorithm, compiler/nodejs, re, times
 
 const
   resultsFile = "testresults.html"
@@ -47,6 +47,7 @@ type
     options: string
     target: TTarget
     action: TTestAction
+    startTime: float
 
 # ----------------------------------------------------------------------------
 
@@ -143,6 +144,7 @@ proc `$`(x: TResults): string =
 proc addResult(r: var TResults, test: TTest,
                expected, given: string, success: TResultEnum) =
   let name = test.name.extractFilename & test.options
+  let duration = epochTime() - test.startTime
   backend.writeTestResult(name = name,
                           category = test.cat.string,
                           target = $test.target,
@@ -172,7 +174,7 @@ proc addResult(r: var TResults, test: TTest,
         ("Skipped", "")
       else:
         ("Failed", "Expected:\n" & expected & "\n\n" & "Gotten:\n" & given)
-    discard execProcess("appveyor", args=["AddTest", test.name & test.options, "-FileName", test.cat.string, "-Outcome", outcome, "-ErrorMessage", msg], options={poStdErrToStdOut, poUsePath})
+    discard execProcess("appveyor", args=["AddTest", test.name & test.options, "-FileName", test.cat.string, "-Outcome", outcome, "-ErrorMessage", msg, "-Duration", $(duration*1000).int], options={poStdErrToStdOut, poUsePath})
 
 proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) =
   if strip(expected.msg) notin strip(given.msg):
@@ -366,7 +368,7 @@ proc makeTest(test, options: string, cat: Category, action = actionCompile,
               target = targetC, env: string = ""): TTest =
   # start with 'actionCompile', will be overwritten in the spec:
   result = TTest(cat: cat, name: test, options: options,
-                 target: target, action: action)
+                 target: target, action: action, startTime: epochTime())
 
 include categories
 
'#n230'>230 231 232 233 234 235 236 237 238 239 240