make nimble packages testing more robust (#10984)

* better tests for the existing packages
* enable testing for packages not in packages.json
* add new packages
This commit is contained in:
Miran 2019-04-09 19:38:50 +02:00 • committed by Andreas Rumpf
commit a4883b8426
2 changed files with 79 additions and 44 deletions

View file

@ -470,15 +470,22 @@ proc getPackageDir(package: string): string =
iterator listPackages(): tuple[name, url, cmd: string, hasDeps: bool] = iterator listPackages(): tuple[name, url, cmd: string, hasDeps: bool] =
let defaultCmd = "nimble test" let defaultCmd = "nimble test"
let packageList = parseFile(packageIndex) let packageList = parseFile(packageIndex)
for n, cmd, commit, hasDeps in important_packages.packages.items: for n, cmd, hasDeps, url in important_packages.packages.items:
let cmd = if cmd.len == 0: defaultCmd else: cmd
if url.len != 0:
if hasDeps:
# use url instead of name, so we can do 'nimble install'
yield (url, url, cmd, hasDeps)
else:
yield (n, url, cmd, hasDeps)
else:
var found = false var found = false
for package in packageList.items: for package in packageList.items:
let name = package["name"].str let name = package["name"].str
if name == n: if name == n:
found = true found = true
let url = package["url"].str let p_url = package["url"].str
let cmd = if cmd.len == 0: defaultCmd else: cmd yield (name, p_url, cmd, hasDeps)
yield (name, url, cmd, hasDeps)
break break
if not found: if not found:
raise newException(ValueError, "Cannot find package '$#'." % n) raise newException(ValueError, "Cannot find package '$#'." % n)

View file

@ -1,50 +1,78 @@
import strutils import strutils
template pkg(name: string; cmd = "nimble test"; version = ""; hasDeps = false): untyped = template pkg(name: string; cmd = "nimble test"; hasDeps = false; url = ""): untyped =
packages.add((name, cmd, version, hasDeps)) packages.add((name, cmd, hasDeps, url))
var packages*: seq[tuple[name, cmd, version: string; hasDeps: bool]] = @[] var packages*: seq[tuple[name, cmd: string; hasDeps: bool; url: string]] = @[]
pkg "arraymancer", "nim c src/arraymancer.nim", "", true pkg "argparse"
pkg "ast_pattern_matching", "nim c tests/test1.nim" pkg "arraymancer", "nim c -r src/arraymancer.nim", true
pkg "blscurve", "", "", true pkg "ast_pattern_matching", "nim c -r tests/test1.nim"
pkg "bncurve", "nim c tests/tarith.nim", "", true pkg "binaryheap", "nim c -r binaryheap.nim"
pkg "blscurve", "", true
pkg "bncurve", "", true
pkg "c2nim", "nim c testsuite/tester.nim" pkg "c2nim", "nim c testsuite/tester.nim"
pkg "chronicles", "nim c -o:chr chronicles.nim", "", true pkg "cascade"
# pkg "chronos", "nim c tests/teststream.nim" pkg "chroma"
pkg "cligen", "nim c -o:cligenn cligen.nim" pkg "chronicles", "nim c -o:chr -r chronicles.nim", true
pkg "compactdict", "nim c tests/test1.nim" pkg "chronos"
pkg "cligen", "nim c -o:cligenn -r cligen.nim"
pkg "combparser"
pkg "compactdict"
pkg "comprehension", "", false, "https://github.com/alehander42/comprehension"
pkg "criterion" pkg "criterion"
pkg "dashing", "nim c tests/functional.nim"
pkg "docopt" pkg "docopt"
pkg "gara", "nim c tests/test_gara.nim" pkg "fragments", "nim c -r fragments/dsl.nim"
pkg "gara"
pkg "glob" pkg "glob"
pkg "gnuplot" pkg "gnuplot"
pkg "hts", "nim c tests/all.nim" # pkg "godot", "nim c -r godot/godot.nim" # not yet compatible with Nim 0.19
pkg "hts", "nim c -o:htss -r src/hts.nim"
pkg "inim" pkg "inim"
pkg "itertools", "nim doc src/itertools.nim" pkg "itertools", "nim doc src/itertools.nim"
pkg "iterutils" pkg "iterutils"
pkg "karax", "nim c tests/tester.nim" pkg "jstin"
pkg "karax", "nim c -r tests/tester.nim"
pkg "loopfusion" pkg "loopfusion"
pkg "msgpack4nim"
pkg "nake", "nim c nakefile.nim" pkg "nake", "nim c nakefile.nim"
pkg "neo", "nim c -d:blas=openblas tests/all.nim", "", true pkg "neo", "nim c -d:blas=openblas tests/all.nim", true
pkg "nigui", "nim c -o:niguii src/nigui.nim" # pkg "nico", "", true
pkg "nimcrypto", "nim c tests/testapi.nim" pkg "nicy", "nim c src/nicy.nim"
pkg "NimData", "nim c -o:nimdataa src/nimdata.nim", "", true pkg "nigui", "nim c -o:niguii -r src/nigui.nim"
pkg "nimes", "nim c src/nimes.nim", "", true pkg "nimcrypto", "nim c -r tests/testapi.nim"
pkg "nimgame2", "nim c nimgame2/nimgame.nim", "", true pkg "NimData", "nim c -o:nimdataa src/nimdata.nim", true
pkg "nimongo", "nimble test_ci", "", true pkg "nimes", "nim c src/nimes.nim", true
pkg "nimpy", "nim c tests/nimfrompy.nim" pkg "nimfp", "nim c -o:nfp -r src/fp.nim", true
pkg "nimsl", "nim c test.nim" pkg "nimgame2", "nim c nimgame2/nimgame.nim", true
pkg "nimgen", "nim c -o:nimgenn -r src/nimgen/runcfg.nim", true
# pkg "nimlsp", "", true
pkg "nimly", "nim c -r tests/test_nimly", true
pkg "nimongo", "nimble test_ci", true
pkg "nimpy", "nim c -r tests/nimfrompy.nim"
pkg "nimquery"
pkg "nimsl", "", true
pkg "nimsvg" pkg "nimsvg"
# pkg "nimx", "nim c --threads:on test/main.nim", "", true pkg "nimx", "nim c --threads:on test/main.nim", true
pkg "norm", "nim c -o:normm src/norm.nim"
pkg "npeg"
pkg "ormin", "nim c -o:orminn ormin.nim", true
pkg "parsetoml" pkg "parsetoml"
pkg "patty" pkg "patty"
pkg "plotly", "nim c examples/all.nim", "", true pkg "plotly", "nim c examples/all.nim", true
pkg "protobuf", "nim c -o:protobuff src/protobuf.nim", "", true pkg "protobuf", "nim c -o:protobuff -r src/protobuf.nim", true
pkg "regex", "nim c src/regex" pkg "regex", "nim c src/regex", true
pkg "rosencrantz", "nim c -o:rsncntz rosencrantz.nim" pkg "result", "nim c -r result.nim"
pkg "sdl1", "nim c src/sdl.nim" pkg "rosencrantz", "nim c -o:rsncntz -r rosencrantz.nim"
pkg "sdl2_nim", "nim c sdl2/sdl.nim" pkg "sdl1", "nim c -r src/sdl.nim"
pkg "stint", "nim c -o:stintt stint.nim" pkg "sdl2_nim", "nim c -r sdl2/sdl.nim"
pkg "zero_functional", "nim c test.nim" pkg "stint", "nim c -o:stintt -r stint.nim"
pkg "strunicode", "nim c -r src/strunicode.nim", true
pkg "tiny_sqlite"
pkg "unicodedb"
pkg "unicodeplus", "", true
pkg "unpack"
pkg "yaml"
pkg "zero_functional", "nim c -r test.nim"