summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2020-07-17 17:01:47 +0800
committerGitHub <noreply@github.com>2020-07-17 11:01:47 +0200
commitc2f80de1c74c673ab9d3459d1f86fb9fe4366f61 (patch)
tree38db522385ba7b7b5db185fd9d7102072bfc4b83
parentc62513049cd7dcbd5b339c2078856a31c498b4aa (diff)
downloadNim-c2f80de1c74c673ab9d3459d1f86fb9fe4366f61.tar.gz
fix #14822 copy test into var in matrix process, so can reset startTime before actully run (#15000)
* TTest pass by ref , so can reset startTime before actully run

* change TTest to ref type

* clone test in matrix process
-rw-r--r--testament/testament.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/testament/testament.nim b/testament/testament.nim
index 109ce4ed9..baa340139 100644
--- a/testament/testament.nim
+++ b/testament/testament.nim
@@ -58,7 +58,6 @@ type
   TResults = object
     total, passed, skipped: int
     data: string
-
   TTest = object
     name: string
     cat: Category
@@ -425,8 +424,9 @@ proc checkDisabled(r: var TResults, test: TTest): bool =
 
 var count = 0
 
-proc testSpecHelper(r: var TResults, test: TTest, expected: TSpec,
+proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
                     target: TTarget, nimcache: string, extraOptions = "") =
+  test.startTime = epochTime()
   case expected.action
   of actionCompile:
     var given = callCompiler(expected.getCmd, test.name, test.options, nimcache, target,
@@ -496,7 +496,8 @@ proc targetHelper(r: var TResults, test: TTest, expected: TSpec, extraOptions =
       echo "testSpec count: ", count, " expected: ", expected
     else:
       let nimcache = nimcacheDir(test.name, test.options, target)
-      testSpecHelper(r, test, expected, target, nimcache, extraOptions)
+      var testClone = test
+      testSpecHelper(r, testClone, expected, target, nimcache, extraOptions)
 
 proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
   var expected = test.spec
@@ -521,7 +522,8 @@ proc testSpecWithNimcache(r: var TResults, test: TTest; nimcache: string) =
   if not checkDisabled(r, test): return
   for target in test.spec.targets:
     inc(r.total)
-    testSpecHelper(r, test, test.spec, target, nimcache)
+    var testClone = test
+    testSpecHelper(r, testClone, test.spec, target, nimcache)
 
 proc testC(r: var TResults, test: TTest, action: TTestAction) =
   # runs C code. Doesn't support any specs, just goes by exit code.