Skip to content

Commit

Permalink
nimble test keeps git status clean; prevents accidental checking in…
Browse files Browse the repository at this point in the history
… of binaries etc (#786)

* * try as much as possible to build test artifacts under a single dir (can be improved later)
* simplify gitignore logic

* fixup after rebase

* fix test
  • Loading branch information
timotheecour authored Mar 16, 2021
1 parent 40ce315 commit 686555c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 33 deletions.
26 changes: 16 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ignore files wo extension (posix binaries)
*
!*.*
!*/


# Any path
*.swp
*~
Expand All @@ -7,15 +13,6 @@ nimcache/
/src/babel
/src/nimble

# executables from test and build
/nimble
src/nimblepkg/cli
src/nimblepkg/packageinfo
src/nimblepkg/packageparser
src/nimblepkg/reversedeps
src/nimblepkg/version
src/nimblepkg/download

# Windows executables
*.exe
*.dll
Expand All @@ -31,4 +28,13 @@ src/nimblepkg/download
*.orig

# Test procedure artifacts
nimble_*.nims
/buildTests

# executables from test and build (already gitignored but keeping for documentation)
# /nimble
# src/nimblepkg/cli
# src/nimblepkg/packageinfo
# src/nimblepkg/packageparser
# src/nimblepkg/reversedeps
# src/nimblepkg/version
# src/nimblepkg/download
37 changes: 15 additions & 22 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
tester
# ideally this shouldn't even be needed and all generated files would go under ../buildTests/

# tester
/nimble-test
/buildDir
/binaryPackage/v1/binaryPackage
/binaryPackage/v2/binaryPackage
/develop/dependent/src/dependent
/issue27/issue27
/issue206/issue/issue206bin
/issue289/issue289
/issue428/nimbleDir/
/nimbleDir/
/packageStructure/c/c
/packageStructure/y/y
/testCommand/testOverride/myTester
/testCommand/testsFail/tests/a
/testCommand/testsFail/tests/b
/testCommand/testsPass/tests/one
/testCommand/testsPass/tests/three
/testCommand/testsPass/tests/two
/nimscript/nimscript
/packageStructure/validBinary/y
/testCommand/testsFail/tests/t2
/passNimFlags/passNimFlags
/issue799/issue799
/issue308515/v1/binname.out
/issue308515/v2/binname.out
/localdeps/nimbledeps/
/multi/
/packagea/


# occurs on multiple levels
nimbleDir/

# generated nims files
*_*.nims
4 changes: 4 additions & 0 deletions tests/config.nims
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this also doesn't work (even in nims): --outdir:"$nimcache/buildTests"
import os
let buildDir = currentSourcePath().parentDir.parentDir / "buildTests"
switch("outdir", buildDir)
4 changes: 3 additions & 1 deletion tests/tester.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import osproc, unittest, strutils, os, sequtils, sugar, strformat
let rootDir = getCurrentDir().parentDir()
let nimblePath = rootDir / "src" / addFileExt("nimble", ExeExt)
let installDir = rootDir / "tests" / "nimbleDir"
let buildTests = rootDir / "buildTests"
const path = "../src/nimble"
const stringNotFound = -1

Expand Down Expand Up @@ -962,8 +963,9 @@ suite "issues":
cd "issue727":
var (output, exitCode) = execNimbleYes("c", "src/abc")
check exitCode == QuitSuccess
check fileExists("src/abc".addFileExt(ExeExt))
check fileExists(buildTests / "abc".addFileExt(ExeExt))
check not fileExists("src/def".addFileExt(ExeExt))
check not fileExists(buildTests / "def".addFileExt(ExeExt))

(output, exitCode) = execNimbleYes("uninstall", "-i", "timezones")
check exitCode == QuitSuccess
Expand Down

0 comments on commit 686555c

Please sign in to comment.