mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
Include target in tester nimcache hash (#7053)
This commit is contained in:
committed by
Andreas Rumpf
parent
38fde80b35
commit
6db1b492e1
@@ -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) =
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user