From aba51f1d292323c40c56ea11b58b3feb4e60e419 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 21 Nov 2022 11:02:24 +0100 Subject: [PATCH] normalise nimble file (#158) * normalise nimble file * loop args --- .github/workflows/ci.yml | 2 +- .gitignore | 3 ++- stew.nimble | 13 +++++++------ tests/test_io2.nim | 14 ++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5aeef3..2227526 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' runs-on: ${{ matrix.builder }} - continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }} + continue-on-error: ${{ matrix.branch == 'devel' }} steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index f2e7e9b..db41c85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -nimcache +nimcache/ *.exe nimble.develop nimble.paths +/build/ diff --git a/stew.nimble b/stew.nimble index 15979d3..72761e1 100644 --- a/stew.nimble +++ b/stew.nimble @@ -4,7 +4,7 @@ packageName = "stew" version = "0.1.0" author = "Status Research & Development GmbH" description = "Backports, standard library candidates and small utilities that don't yet deserve their own repository" -license = "Apache License 2.0" +license = "MIT or Apache License 2.0" skipDirs = @["tests"] requires "nim >= 1.2.0", @@ -19,7 +19,7 @@ let styleCheckStyle = if (NimMajor, NimMinor) < (1, 6): "hint" else: "error" let cfg = " --styleCheck:usages --styleCheck:" & styleCheckStyle & (if verbose: "" else: " --verbosity:0 --hints:off") & - " --skipParentCfg --skipUserCfg" + " --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f" proc build(args, path: string) = exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path @@ -29,7 +29,8 @@ proc run(args, path: string) = task test, "Run all tests": build "", "tests/test_helper" - run "--threads:off", "tests/all_tests" - run "--threads:on -d:nimTypeNames", "tests/all_tests" - run "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians", - "tests/all_tests" + for args in [ + "--threads:off", + "--threads:on -d:nimTypeNames", + "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians" + ]: run args, "tests/all_tests" diff --git a/tests/test_io2.nim b/tests/test_io2.nim index 488f06b..7a9f565 100644 --- a/tests/test_io2.nim +++ b/tests/test_io2.nim @@ -10,6 +10,8 @@ import unittest2 import std/[osproc, strutils] import ../stew/io2 +from os import getAppDir + when defined(posix): from std/posix import EAGAIN @@ -540,31 +542,27 @@ suite "OS Input/Output procedures test suite": proc lockTest(path: string, flags: set[OpenFlags], lockType: LockType): IoResult[array[3, TestResult]] = - const HelperPath = - when defined(windows): - "test_helper " - else: - "tests/test_helper " + let helperPath = getAppDir() & "/test_helper " let handle = ? openFile(path, flags) lock = ? lockFile(handle, lockType) let res1 = try: - execCmdEx(HelperPath & path) + execCmdEx(helperPath & path) except CatchableError as exc: echo "Exception happens [", $exc.name, "]: ", $exc.msg ("", -1) ? unlockFile(lock) let res2 = try: - execCmdEx(HelperPath & path) + execCmdEx(helperPath & path) except CatchableError as exc: echo "Exception happens [", $exc.name, "]: ", $exc.msg ("", -1) ? closeFile(handle) let res3 = try: - execCmdEx(HelperPath & path) + execCmdEx(helperPath & path) except CatchableError as exc: echo "Exception happens [", $exc.name, "]: ", $exc.msg ("", -1)