summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--testament/categories.nim75
-rw-r--r--testament/important_packages.nim175
2 files changed, 120 insertions, 130 deletions
diff --git a/testament/categories.nim b/testament/categories.nim
index 760c3c5be..07d35f6fb 100644
--- a/testament/categories.nim
+++ b/testament/categories.nim
@@ -452,15 +452,15 @@ type
     ppOne
     ppTwo
 
-iterator listPackages(part: PkgPart): tuple[name, url, cmd: string, hasDeps: bool, useHead: bool] =
+iterator listPackages(part: PkgPart): tuple[name, cmd, url: string, useHead: bool] =
   let packageList = parseFile(packageIndex)
   let importantList =
     case part
     of ppOne: important_packages.packages1
     of ppTwo: important_packages.packages2
-  for n, cmd, hasDeps, url, useHead in importantList.items:
+  for n, cmd, url, useHead in importantList.items:
     if url.len != 0:
-      yield (n, url, cmd, hasDeps, useHead)
+      yield (n, cmd, url, useHead)
     else:
       var found = false
       for package in packageList.items:
@@ -468,7 +468,7 @@ iterator listPackages(part: PkgPart): tuple[name, url, cmd: string, hasDeps: boo
         if name == n:
           found = true
           let pUrl = package["url"].str
-          yield (name, pUrl, cmd, hasDeps, useHead)
+          yield (name, cmd, pUrl, useHead)
           break
       if not found:
         raise newException(ValueError, "Cannot find package '$#'." % n)
@@ -479,16 +479,6 @@ proc makeSupTest(test, options: string, cat: Category): TTest =
   result.options = options
   result.startTime = epochTime()
 
-proc actionRetry(maxRetry: int, backoffDuration: float, action: proc: bool): bool =
-  ## retry `action` up to `maxRetry` times with exponential backoff and initial
-  ## duraton of `backoffDuration` seconds
-  var t = backoffDuration
-  for i in 0..<maxRetry:
-    if action(): return true
-    if i == maxRetry - 1: break
-    sleep(int(t * 1000))
-    t *= 2 # exponential backoff
-
 proc testNimblePackages(r: var TResults; cat: Category; packageFilter: string, part: PkgPart) =
   if nimbleExe == "":
     echo "[Warning] - Cannot run nimble tests: Nimble binary not found."
@@ -499,47 +489,48 @@ proc testNimblePackages(r: var TResults; cat: Category; packageFilter: string, p
 
   let packageFileTest = makeSupTest("PackageFileParsed", "", cat)
   let packagesDir = "pkgstemp"
+  createDir(packagesDir)
   var errors = 0
   try:
-    for name, url, cmd, hasDep, useHead in listPackages(part):
+    for name, cmd, url, useHead in listPackages(part):
       if packageFilter notin name:
         continue
       inc r.total
-      var test = makeSupTest(url, "", cat)
+      var test = makeSupTest(name, "", cat)
       let buildPath = packagesDir / name
+
       if not dirExists(buildPath):
-        if useHead:
-          let (installCmdLine, installOutput, installStatus) = execCmdEx2("git", ["clone", url, buildPath])
-          if installStatus != QuitSuccess:
-            let message = "git clone failed:\n$ " & installCmdLine & "\n" & installOutput
-            r.addResult(test, targetC, "", message, reInstallFailed)
+        let (cloneCmd, cloneOutput, cloneStatus) = execCmdEx2("git", ["clone", url, buildPath])
+        if cloneStatus != QuitSuccess:
+          r.addResult(test, targetC, "", cloneCmd & "\n" & cloneOutput, reInstallFailed)
+          continue
+
+        if not useHead:
+          let (fetchCmd, fetchOutput, fetchStatus) = execCmdEx2("git", ["fetch", "--tags"], workingDir = buildPath)
+          if fetchStatus != QuitSuccess:
+            r.addResult(test, targetC, "", fetchCmd & "\n" & fetchOutput, reInstallFailed)
             continue
 
-          if hasDep:
-            var message: string
-            if not actionRetry(maxRetry = 3, backoffDuration = 1.0,
-              proc: bool =
-                 let (outp, status) = execCmdEx("nimble install -y", workingDir = buildPath)
-                 if status != 0:
-                   message = "'$1' failed:\n$2" % [cmd, outp]
-                   false
-                 else: true
-              ):
-              r.addResult(test, targetC, "", message, reInstallFailed)
-              continue
-        else:
-          let (installCmdLine, installOutput, installStatus) = execCmdEx2("nimble", ["develop", name, "-y"])
-          if installStatus != QuitSuccess:
-            let message = "nimble develop failed:\n$ " & installCmdLine & "\n" & installOutput
-            r.addResult(test, targetC, "", message, reInstallFailed)
+          let (describeCmd, describeOutput, describeStatus) = execCmdEx2("git", ["describe", "--tags", "--abbrev=0"], workingDir = buildPath)
+          if describeStatus != QuitSuccess:
+            r.addResult(test, targetC, "", describeCmd & "\n" & describeOutput, reInstallFailed)
             continue
 
+          let (checkoutCmd, checkoutOutput, checkoutStatus) = execCmdEx2("git", ["checkout", describeOutput.strip], workingDir = buildPath)
+          if checkoutStatus != QuitSuccess:
+            r.addResult(test, targetC, "", checkoutCmd & "\n" & checkoutOutput, reInstallFailed)
+            continue
+
+        let (installDepsCmd, installDepsOutput, installDepsStatus) = execCmdEx2("nimble", ["install", "--depsOnly", "-y"], workingDir = buildPath)
+        if installDepsStatus != QuitSuccess:
+          r.addResult(test, targetC, "", "installing dependencies failed:\n$ " & installDepsCmd & "\n" & installDepsOutput, reInstallFailed)
+          continue
+
       let cmdArgs = parseCmdLine(cmd)
 
-      let (buildCmdLine, buildOutput, buildStatus) = execCmdEx2(cmdArgs[0], cmdArgs[1..^1], workingDir=buildPath)
-      if buildStatus != QuitSuccess:
-        let message = "package test failed\n$ " & buildCmdLine & "\n" & buildOutput
-        r.addResult(test, targetC, "", message, reBuildFailed)
+      let (buildCmd, buildOutput, status) = execCmdEx2(cmdArgs[0], cmdArgs[1..^1], workingDir = buildPath)
+      if status != QuitSuccess:
+        r.addResult(test, targetC, "", "package test failed\n$ " & buildCmd & "\n" & buildOutput, reBuildFailed)
       else:
         inc r.passed
         r.addResult(test, targetC, "", "", reSuccess)
diff --git a/testament/important_packages.nim b/testament/important_packages.nim
index 92d720e60..c94f3e98d 100644
--- a/testament/important_packages.nim
+++ b/testament/important_packages.nim
@@ -1,134 +1,133 @@
-template pkg1(name: string; hasDeps = false; cmd = "nimble test"; url = "", useHead = true): untyped =
-  packages1.add((name, cmd, hasDeps, url, useHead))
+template pkg1(name: string; cmd = "nimble test"; url = "", useHead = true): untyped =
+  packages1.add((name, cmd, url, useHead))
 
-template pkg2(name: string; hasDeps = false; cmd = "nimble test"; url = "", useHead = true): untyped =
-  packages2.add((name, cmd, hasDeps, url, useHead))
-
-var packages1*: seq[tuple[name, cmd: string; hasDeps: bool; url: string, useHead: bool]] = @[]
-var packages2*: seq[tuple[name, cmd: string; hasDeps: bool; url: string, useHead: bool]] = @[]
+template pkg2(name: string; cmd = "nimble test"; url = "", useHead = true): untyped =
+  packages2.add((name, cmd, url, useHead))
 
+var packages1*: seq[tuple[name, cmd: string; url: string, useHead: bool]] = @[]
+var packages2*: seq[tuple[name, cmd: string; url: string, useHead: bool]] = @[]
 
 # packages A-M
-# pkg1 "alea", true
+# pkg1 "alea"
 pkg1 "argparse"
-pkg1 "arraymancer", true, "nim c tests/tests_cpu.nim"
-#pkg1 "ast_pattern_matching", false, "nim c -r --oldgensym:on tests/test1.nim"
-pkg1 "awk", true
+pkg1 "arraymancer", "nim c tests/tests_cpu.nim"
+#pkg1 "ast_pattern_matching", "nim c -r --oldgensym:on tests/test1.nim"
+pkg1 "awk"
 pkg1 "bigints", url = "https://github.com/Araq/nim-bigints"
-pkg1 "binaryheap", false, "nim c -r binaryheap.nim"
+pkg1 "binaryheap", "nim c -r binaryheap.nim"
 pkg1 "BipBuffer"
-# pkg1 "blscurve", true # pending https://github.com/status-im/nim-blscurve/issues/39
-pkg1 "bncurve", true
-pkg1 "brainfuck", true, "nim c -d:release -r tests/compile.nim"
-pkg1 "bump", true, "nim c --gc:arc -r tests/tbump.nim", "https://github.com/disruptek/bump"
-pkg1 "c2nim", false, "nim c testsuite/tester.nim"
+# pkg1 "blscurve" # pending https://github.com/status-im/nim-blscurve/issues/39
+pkg1 "bncurve"
+pkg1 "brainfuck", "nim c -d:release -r tests/compile.nim"
+pkg1 "bump", "nim c --gc:arc -r tests/tbump.nim", "https://github.com/disruptek/bump"
+pkg1 "c2nim", "nim c testsuite/tester.nim"
 pkg1 "cascade"
-pkg1 "cello", true
+pkg1 "cello"
 pkg1 "chroma"
-pkg1 "chronicles", true, "nim c -o:chr -r chronicles.nim"
+pkg1 "chronicles", "nim c -o:chr -r chronicles.nim"
 when not defined(osx): # testdatagram.nim(560, 54): Check failed
-  pkg1 "chronos", true, "nim c -r -d:release tests/testall"
-pkg1 "cligen", false, "nim c -o:cligenn -r cligen.nim"
-pkg1 "combparser", false, "nimble test --gc:orc"
+  pkg1 "chronos", "nim c -r -d:release tests/testall"
+pkg1 "cligen", "nim c --path:. -r cligen.nim"
+pkg1 "combparser", "nimble test --gc:orc"
 pkg1 "compactdict"
-pkg1 "comprehension", false, "nimble test", "https://github.com/alehander42/comprehension"
-pkg1 "dashing", false, "nim c tests/functional.nim"
+pkg1 "comprehension", "nimble test", "https://github.com/alehander42/comprehension"
+pkg1 "dashing", "nim c tests/functional.nim"
 pkg1 "delaunay"
 pkg1 "docopt"
-pkg1 "easygl", true, "nim c -o:egl -r src/easygl.nim", "https://github.com/jackmott/easygl"
+pkg1 "easygl", "nim c -o:egl -r src/easygl.nim", "https://github.com/jackmott/easygl"
 pkg1 "elvis"
-pkg1 "fidget", true
-pkg1 "fragments", false, "nim c -r fragments/dsl.nim"
+pkg1 "fidget"
+pkg1 "fragments", "nim c -r fragments/dsl.nim"
 pkg1 "gara"
-pkg1 "ggplotnim", true, "nim c -d:noCairo -r tests/tests.nim"
-# pkg1 "gittyup", true, "nimble test", "https://github.com/disruptek/gittyup"
+pkg1 "ggplotnim", "nim c -d:noCairo -r tests/tests.nim"
+# pkg1 "gittyup", "nimble test", "https://github.com/disruptek/gittyup"
 # pkg1 "glob" # pending https://github.com/citycide/glob/issues/49
-pkg1 "gnuplot", false, "nim c gnuplot.nim"
-pkg1 "hts", false, "nim c -o:htss src/hts.nim"
-# pkg1 "httpauth", true
-pkg1 "illwill", false, "nimble examples"
-pkg1 "inim", true
-pkg1 "itertools", false, "nim doc src/itertools.nim"
+pkg1 "gnuplot", "nim c gnuplot.nim"
+pkg1 "hts", "nim c -o:htss src/hts.nim"
+# pkg1 "httpauth"
+pkg1 "illwill", "nimble examples"
+pkg1 "inim"
+pkg1 "itertools", "nim doc src/itertools.nim"
 pkg1 "iterutils"
 pkg1 "jstin"
-pkg1 "karax", false, "nim c -r tests/tester.nim"
-pkg1 "kdtree", false, "nimble test", "https://github.com/jblindsay/kdtree"
+pkg1 "karax", "nim c -r tests/tester.nim"
+pkg1 "kdtree", "nimble test", "https://github.com/jblindsay/kdtree"
 pkg1 "loopfusion"
 pkg1 "macroutils"
 pkg1 "markdown"
 pkg1 "memo"
-pkg1 "msgpack4nim", false, "nim c -r tests/test_spec.nim"
+pkg1 "msgpack4nim", "nim c -r tests/test_spec.nim"
 
 # these two are special snowflakes
-pkg1 "nimcrypto", false, "nim c -r tests/testall.nim"
-pkg1 "stint", false, "nim c -o:stintt -r stint.nim"
+pkg1 "nimcrypto", "nim c -r tests/testall.nim"
+pkg1 "stint", "nim c -o:stintt -r stint.nim"
 
 
 # packages N-Z
-pkg2 "nake", false, "nim c nakefile.nim"
-pkg2 "neo", true, "nim c -d:blas=openblas tests/all.nim"
-# pkg2 "nesm", false, "nimble tests" # notice plural 'tests'
-# pkg2 "nico", true
-pkg2 "nicy", false, "nim c -r src/nicy.nim"
-pkg2 "nigui", false, "nim c -o:niguii -r src/nigui.nim"
-pkg2 "NimData", true, "nim c -o:nimdataa src/nimdata.nim"
-pkg2 "nimes", true, "nim c src/nimes.nim"
-pkg2 "nimfp", true, "nim c -o:nfp -r src/fp.nim"
-pkg2 "nimgame2", true, "nim c nimgame2/nimgame.nim"
-pkg2 "nimgen", true, "nim c -o:nimgenn -r src/nimgen/runcfg.nim"
-pkg2 "nimlsp", true
-pkg2 "nimly", true, "nim c -r tests/test_readme_example.nim"
-# pkg2 "nimongo", true, "nimble test_ci"
-# pkg2 "nimph", true, "nimble test", "https://github.com/disruptek/nimph"
-pkg2 "nimpy", false, "nim c -r tests/nimfrompy.nim"
+pkg2 "nake", "nim c nakefile.nim"
+pkg2 "neo", "nim c -d:blas=openblas tests/all.nim"
+# pkg2 "nesm", "nimble tests" # notice plural 'tests'
+# pkg2 "nico"
+pkg2 "nicy", "nim c -r src/nicy.nim"
+pkg2 "nigui", "nim c -o:niguii -r src/nigui.nim"
+pkg2 "NimData", "nim c -o:nimdataa src/nimdata.nim"
+pkg2 "nimes", "nim c src/nimes.nim"
+pkg2 "nimfp", "nim c -o:nfp -r src/fp.nim"
+pkg2 "nimgame2", "nim c nimgame2/nimgame.nim"
+pkg2 "nimgen", "nim c -o:nimgenn -r src/nimgen/runcfg.nim"
+pkg2 "nimlsp"
+pkg2 "nimly", "nim c -r tests/test_readme_example.nim"
+# pkg2 "nimongo", "nimble test_ci"
+# pkg2 "nimph", "nimble test", "https://github.com/disruptek/nimph"
+pkg2 "nimpy", "nim c -r tests/nimfrompy.nim"
 pkg2 "nimquery"
-pkg2 "nimsl", true
+pkg2 "nimsl"
 pkg2 "nimsvg"
-pkg2 "nimterop", true, "nimble minitest"
-pkg2 "nimwc", true, "nim c nimwc.nim"
-# pkg2 "nimx", true, "nim c --threads:on test/main.nim"
-# pkg2 "nitter", true, "nim c src/nitter.nim", "https://github.com/zedeus/nitter"
-pkg2 "norm", true, "nim c -r tests/tsqliterows.nim"
-pkg2 "npeg", false, "nimble testarc"
-pkg2 "numericalnim", true, "nim c -r tests/test_integrate.nim"
+pkg2 "nimterop", "nimble minitest"
+pkg2 "nimwc", "nim c nimwc.nim"
+# pkg2 "nimx", "nim c --threads:on test/main.nim"
+# pkg2 "nitter", "nim c src/nitter.nim", "https://github.com/zedeus/nitter"
+pkg2 "norm", "nim c -r tests/tsqliterows.nim"
+pkg2 "npeg", "nimble testarc"
+pkg2 "numericalnim", "nim c -r tests/test_integrate.nim"
 pkg2 "optionsutils"
-pkg2 "ormin", true, "nim c -o:orminn ormin.nim"
+pkg2 "ormin", "nim c -o:orminn ormin.nim"
 pkg2 "parsetoml"
 pkg2 "patty"
-pkg2 "plotly", true, "nim c examples/all.nim"
+pkg2 "plotly", "nim c examples/all.nim"
 pkg2 "pnm"
 pkg2 "polypbren"
-pkg2 "prologue", true, "nimble tcompile"
-pkg2 "protobuf", true, "nim c -o:protobuff -r src/protobuf.nim"
+pkg2 "prologue", "nimble tcompile"
+pkg2 "protobuf", "nim c -o:protobuff -r src/protobuf.nim"
 pkg2 "pylib"
 pkg2 "rbtree"
-pkg2 "react", false, "nimble example"
-pkg2 "regex", true, "nim c src/regex"
-pkg2 "result", false, "nim c -r result.nim"
-pkg2 "RollingHash", false, "nim c -r tests/test_cyclichash.nim"
-pkg2 "rosencrantz", false, "nim c -o:rsncntz -r rosencrantz.nim"
-pkg2 "sdl1", false, "nim c -r src/sdl.nim"
-pkg2 "sdl2_nim", false, "nim c -r sdl2/sdl.nim"
-pkg2 "sigv4", true, "nim c --gc:arc -r sigv4.nim", "https://github.com/disruptek/sigv4"
-pkg2 "snip", false, "nimble test", "https://github.com/genotrance/snip"
+pkg2 "react", "nimble example"
+pkg2 "regex", "nim c src/regex"
+pkg2 "result", "nim c -r result.nim"
+pkg2 "RollingHash", "nim c -r tests/test_cyclichash.nim"
+pkg2 "rosencrantz", "nim c -o:rsncntz -r rosencrantz.nim"
+pkg2 "sdl1", "nim c -r src/sdl.nim"
+pkg2 "sdl2_nim", "nim c -r sdl2/sdl.nim"
+pkg2 "sigv4", "nim c --gc:arc -r sigv4.nim", "https://github.com/disruptek/sigv4"
+pkg2 "snip", "nimble test", "https://github.com/genotrance/snip"
 pkg2 "strslice"
-pkg2 "strunicode", true, "nim c -r src/strunicode.nim"
+pkg2 "strunicode", "nim c -r src/strunicode.nim"
 pkg2 "synthesis"
-pkg2 "telebot", true, "nim c -o:tbot -r src/telebot.nim"
+pkg2 "telebot", "nim c -o:tbot -r src/telebot.nim"
 pkg2 "tempdir"
 pkg2 "templates"
-pkg2 "tensordsl", false, "nim c -r tests/tests.nim", "https://krux02@bitbucket.org/krux02/tensordslnim.git"
-pkg2 "terminaltables", false, "nim c src/terminaltables.nim"
-pkg2 "termstyle", false, "nim c -r termstyle.nim"
+pkg2 "tensordsl", "nim c -r tests/tests.nim", "https://krux02@bitbucket.org/krux02/tensordslnim.git"
+pkg2 "terminaltables", "nim c src/terminaltables.nim"
+pkg2 "termstyle", "nim c -r termstyle.nim"
 pkg2 "timeit"
 pkg2 "timezones"
 pkg2 "tiny_sqlite"
-pkg2 "unicodedb", false, "nim c -d:release -r tests/tests.nim"
-pkg2 "unicodeplus", true, "nim c -d:release -r tests/tests.nim"
+pkg2 "unicodedb", "nim c -d:release -r tests/tests.nim"
+pkg2 "unicodeplus", "nim c -d:release -r tests/tests.nim"
 pkg2 "unpack"
-pkg2 "websocket", false, "nim c websocket.nim"
-# pkg2 "winim", true
+pkg2 "websocket", "nim c websocket.nim"
+# pkg2 "winim"
 pkg2 "with"
 pkg2 "ws"
-pkg2 "yaml", false, "nim build"
-pkg2 "zero_functional", false, "nim c -r -d:nimWorkaround14447 test.nim"
+pkg2 "yaml", "nim build"
+pkg2 "zero_functional", "nim c -r -d:nimWorkaround14447 test.nim"