summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorMathias Stearn <redbeard0531@gmail.com>2018-01-14 09:22:48 -0500
committerAndreas Rumpf <rumpf_a@web.de>2018-01-14 15:22:48 +0100
commit6db1b492e12490be976c3aeda3a54eddf59cdc04 (patch)
treebc9d9ba724531d71d52229b9ea4f37e190d70f32 /tests
parent38fde80b35d866ca36db680498c0f32936369c7e (diff)
downloadNim-6db1b492e12490be976c3aeda3a54eddf59cdc04.tar.gz
Include target in tester nimcache hash (#7053)
Diffstat (limited to 'tests')
-rw-r--r--tests/testament/categories.nim11
-rw-r--r--tests/testament/tester.nim11
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 42e19d3dd..06decfa3c 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -17,11 +17,12 @@ const
   rodfilesDir = "tests/rodfiles"
 
 proc delNimCache(filename, options: string) =
-  let dir = nimcacheDir(filename, options)
-  try:
-    removeDir(dir)
-  except OSError:
-    echo "[Warning] could not delete: ", dir
+  for target in low(TTarget)..high(TTarget):
+    let dir = nimcacheDir(filename, options, target)
+    try:
+      removeDir(dir)
+    except OSError:
+      echo "[Warning] could not delete: ", dir
 
 proc runRodFiles(r: var TResults, cat: Category, options: string) =
   template test(filename: string, clearCacheFirst=false) =
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index 870f9f865..918de881f 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -71,13 +71,14 @@ proc getFileDir(filename: string): string =
   if not result.isAbsolute():
     result = getCurrentDir() / result
 
-proc nimcacheDir(filename, options: string): string =
+proc nimcacheDir(filename, options: string, target: TTarget): string =
   ## Give each test a private nimcache dir so they don't clobber each other's.
-  return "nimcache" / (filename & '_' & options.getMD5)
+  let hashInput = options & $target
+  return "nimcache" / (filename & '_' & hashInput.getMD5)
 
 proc callCompiler(cmdTemplate, filename, options: string,
                   target: TTarget, extraOptions=""): TSpec =
-  let nimcache = nimcacheDir(filename, options)
+  let nimcache = nimcacheDir(filename, options, target)
   let options = options & " --nimCache:" & nimcache.quoteShell & extraOptions
   let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
                        "options", options, "file", filename.quoteShell,
@@ -231,7 +232,7 @@ proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest, target: TTarg
 proc generatedFile(test: TTest, target: TTarget): string =
   let (_, name, _) = test.name.splitFile
   let ext = targetToExt[target]
-  result = nimcacheDir(test.name, test.options) /
+  result = nimcacheDir(test.name, test.options, target) /
     (if target == targetJS: "" else: "compiler_") &
     name.changeFileExt(ext)
 
@@ -334,7 +335,7 @@ proc testSpec(r: var TResults, test: TTest, target = targetC) =
       var exeFile: string
       if isJsTarget:
         let (_, file, _) = splitFile(tname)
-        exeFile = nimcacheDir(test.name, test.options) / file & ".js"
+        exeFile = nimcacheDir(test.name, test.options, target) / file & ".js"
       else:
         exeFile = changeFileExt(tname, ExeExt)