make runnableExamples use a private nimcache so that they can be tested in parallel (#8281)
* make runnableExamples use a private nimcache so that they can be tested in parallel
This commit is contained in:
parent
231a83a6b1
commit
6de52d2b74
1 changed files with 9 additions and 2 deletions
|
|
@ -610,14 +610,21 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
|
||||||
proc testExamples(c: PContext) =
|
proc testExamples(c: PContext) =
|
||||||
let inp = toFullPath(c.config, c.module.info)
|
let inp = toFullPath(c.config, c.module.info)
|
||||||
let outp = inp.changeFileExt"" & "_examples.nim"
|
let outp = inp.changeFileExt"" & "_examples.nim"
|
||||||
|
let nimcache = outp.changeFileExt"" & "_nimcache"
|
||||||
renderModule(c.runnableExamples, inp, outp)
|
renderModule(c.runnableExamples, inp, outp)
|
||||||
let backend = if isDefined(c.config, "js"): "js"
|
let backend = if isDefined(c.config, "js"): "js"
|
||||||
elif isDefined(c.config, "cpp"): "cpp"
|
elif isDefined(c.config, "cpp"): "cpp"
|
||||||
elif isDefined(c.config, "objc"): "objc"
|
elif isDefined(c.config, "objc"): "objc"
|
||||||
else: "c"
|
else: "c"
|
||||||
if os.execShellCmd(os.getAppFilename() & " " & backend & " -r " & outp) != 0:
|
if os.execShellCmd(os.getAppFilename() & " " & backend & " --nimcache:" & nimcache & " -r " & outp) != 0:
|
||||||
quit "[Examples] failed"
|
quit "[Examples] failed"
|
||||||
|
else:
|
||||||
removeFile(outp)
|
removeFile(outp)
|
||||||
|
removeFile(outp.changeFileExt(ExeExt))
|
||||||
|
try:
|
||||||
|
removeDir(nimcache)
|
||||||
|
except OSError:
|
||||||
|
discard
|
||||||
|
|
||||||
proc myClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode =
|
proc myClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode =
|
||||||
var c = PContext(context)
|
var c = PContext(context)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue