Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cb9b7ba
Hybrid test runner: testament for isolatable tests, tester.nim for sh…
bung87 May 31, 2026
e7ed998
fixup: run tester.nim from tests/ dir, skip it in testament, convert …
bung87 May 31, 2026
61c4b6d
fixup: correct output path check in issue 727 test
bung87 May 31, 2026
0566892
fixup: isolate issue 727 test, correct output path check
bung87 May 31, 2026
d6f30d3
Replace nimlangserver downloads with local fixtures in tdeclarativepa…
bung87 May 31, 2026
fc30e7c
Remove tdeclarativeparser from tester.nim and skip.txt (now standalone)
bung87 May 31, 2026
a26c4f4
Fix tnimbledump: ignore nimDir in exact output comparison (varies whe…
bung87 May 31, 2026
e94b99e
Isolate tmoduletests and tforgeinstall from tester.nim
bung87 May 31, 2026
1b5058c
Isolate ttwobinaryversions from tester.nim
bung87 May 31, 2026
8e19a86
Skip tgetpaths.nim in testament (getPaths() broken in nimble core sin…
bung87 May 31, 2026
9c07732
Isolate issue 953 (refresh package list + install fusion) from tissue…
bung87 May 31, 2026
d6f118d
Isolate issue 126 and issue 1158 from tissues.nim
bung87 May 31, 2026
86b1b49
Isolate more tests from tester.nim to standalone testament files
bung87 May 31, 2026
28e2e08
Fix tconfignewline: use absolute path for config.nims
bung87 May 31, 2026
1795446
Fix tmisctests: remove unused sequtils import
bung87 May 31, 2026
68d4131
testament: isolate pure SAT solver tests to tests/sat/tsat_solver.nim
bung87 May 31, 2026
e2c79d0
testament: isolate tasynctools.nim from tester.nim
bung87 May 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
hg --version
- name: Install dependencies
run: nimble install -y
- name: Run nim c -r tester
- name: Run tests
run: |
nimble test
- name: Install nimble
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ src/nimblepkg/version
# Test procedure artifacts
*.nims
/buildTests
/testresults/
/tests/**/.gitignore
/tests/**/nimble.lock
/tests/nimdep/localnimbledeps/
/tests/testresults/

# Nimble Guide files
nimble-guide/site/
Expand Down
20 changes: 8 additions & 12 deletions nimble.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ when defined(nimdistros):
before install:
exec "git submodule update --init"

proc runTester(extraFlags = "") =
var extraParams = ""
for i in 0 .. paramCount():
if "::" in paramStr(i):
extraParams = "test "
extraParams.addQuoted paramStr(i)

withDir "tests":
exec "nim c " & extraFlags & " -r tester " & extraParams

task test, "Run the Nimble tester!":
runTester()
exec "testament --directory:tests --megatest:off --skipFrom:skip.txt pattern t*.nim"
exec "testament --directory:tests/tissues --megatest:off pattern tissue_*.nim"
exec "testament --directory:tests/sat --megatest:off pattern t*.nim"
exec "cd tests && nim c -r tester.nim"

task cibenchmark, "Run tests with timing instrumentation":
runTester("-d:timedTests")
exec "testament --directory:tests --megatest:off --skipFrom:skip.txt pattern t*.nim -d:timedTests"
exec "testament --directory:tests/tissues --megatest:off pattern tissue_*.nim -d:timedTests"
exec "testament --directory:tests/sat --megatest:off pattern t*.nim -d:timedTests"
exec "cd tests && nim c -r -d:timedTests tester.nim"
18 changes: 11 additions & 7 deletions tests/testscommon.nim → tests/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{.used.}

import sequtils, strutils, strformat, os, osproc, sugar, unittest, macros
import sequtils, strutils, strformat, os, osproc, sugar, unittest, macros, std/times
import pkg/checksums/sha1

import nimblepkg/cli
Expand All @@ -21,7 +21,7 @@ const
pkgMultiBetaUrl* = &"{pkgMultiUrl}?subdir=beta"

let
rootDir = getCurrentDir().parentDir
rootDir = currentSourcePath().parentDir.parentDir
nimblePath* = rootDir / "src" / addFileExt("nimble", ExeExt)
nimbleCompilePath = rootDir / "src" / "nimble.nim"
installDir* = rootDir / "tests" / "nimbleDir"
Expand All @@ -39,7 +39,7 @@ proc execNimble*(args: varargs[string]): ProcessOutput =
quotedArgs.insert(nimblePath)
quotedArgs = quotedArgs.map((x: string) => x.quoteShell)

let path {.used.} = getCurrentDir().parentDir() / "src"
let path {.used.} = rootDir / "src"

var cmd =
when not defined(windows):
Expand Down Expand Up @@ -214,11 +214,15 @@ putEnv("NIMBLE_TEST_BINARY_PATH", nimblePath)
setVerbosity(MediumPriority)
setShowColor(false)

# Always recompile.
# Compile nimble if binary is missing or source is newer.
block:
# Verbose name is used for exit code so assert is clearer
let (output, nimbleCompileExitCode) = execCmdEx("nim c " & nimbleCompilePath)
doAssert nimbleCompileExitCode == QuitSuccess, output
let nimbleBin = rootDir / "src" / addFileExt("nimble", ExeExt)
let needsCompile = not nimbleBin.fileExists or
nimbleBin.getLastModificationTime < nimbleCompilePath.getLastModificationTime
if needsCompile:
# Verbose name is used for exit code so assert is clearer
let (output, nimbleCompileExitCode) = execCmdEx("nim c " & nimbleCompilePath)
doAssert nimbleCompileExitCode == QuitSuccess, output

# Test timing instrumentation — compile with -d:timedTests to enable
when defined(timedTests):
Expand Down
4 changes: 0 additions & 4 deletions tests/config.nims

This file was deleted.

14 changes: 14 additions & 0 deletions tests/declarativeparserfixture/declarativeparserfixture.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version = "0.1.0"
author = "test"
description = "Test fixture for declarative parser"
license = "MIT"
srcDir = "src"
bin = @["declarativeparserfixture"]

requires "nim >= 2.0.0"
requires "json_rpc"
requires "with"
requires "chronicles"
requires "serialization"
requires "stew"
requires "regex"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version = "0.1.0"
author = "test"
description = "Test fixture with nested requires"
license = "MIT"

when defined(windows):
requires "winapi"
else:
requires "posix"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const
NimMajor* = 1
NimMinor* = 6
NimPatch* = 12
8 changes: 8 additions & 0 deletions tests/declarativeparserfixture/nim_1_6_12/nim.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "1.6.12"
author = "Andreas Rumpf"
description = "Fixture mimicking nim nimble file"
license = "MIT"

include "compiler/compilation.nim"

requires "nim >= 1.6.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const
NimMajor* = 2
NimMinor* = 2
NimPatch* = 0
8 changes: 8 additions & 0 deletions tests/declarativeparserfixture/nim_2_2_0/nim.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "2.2.0"
author = "Andreas Rumpf"
description = "Fixture mimicking nim nimble file"
license = "MIT"

include "compiler/compilation.nim"

requires "nim >= 1.6.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "fixture"
Loading
Loading