summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorskilchen <skilchen@users.noreply.github.com>2018-07-12 11:06:20 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-12 11:06:20 +0200
commit6de52d2b747074e993707adca2f74143134ce127 (patch)
tree0491915272f9a1c49410b36b99bfb2d37d237535
parent231a83a6b108dc676b53ba5f906d51ff14aa5b51 (diff)
downloadNim-6de52d2b747074e993707adca2f74143134ce127.tar.gz
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
-rw-r--r--compiler/sem.nim11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index b242e4db6..0d484d276 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -610,14 +610,21 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
 proc testExamples(c: PContext) =
   let inp = toFullPath(c.config, c.module.info)
   let outp = inp.changeFileExt"" & "_examples.nim"
+  let nimcache = outp.changeFileExt"" & "_nimcache"
   renderModule(c.runnableExamples, inp, outp)
   let backend = if isDefined(c.config, "js"): "js"
                 elif isDefined(c.config, "cpp"): "cpp"
                 elif isDefined(c.config, "objc"): "objc"
                 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"
-  removeFile(outp)
+  else:
+    removeFile(outp)
+    removeFile(outp.changeFileExt(ExeExt))
+    try:
+      removeDir(nimcache)
+    except OSError:
+      discard
 
 proc myClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode =
   var c = PContext(context)