normalise nimble file (#158)

* normalise nimble file

* loop args
This commit is contained in:
Jacek Sieka 2022-11-21 11:02:24 +01:00 committed by GitHub
parent 66c16920a6
commit aba51f1d29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View File

@ -43,7 +43,7 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }} continue-on-error: ${{ matrix.branch == 'devel' }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
nimcache nimcache/
*.exe *.exe
nimble.develop nimble.develop
nimble.paths nimble.paths
/build/

View File

@ -4,7 +4,7 @@ packageName = "stew"
version = "0.1.0" version = "0.1.0"
author = "Status Research & Development GmbH" author = "Status Research & Development GmbH"
description = "Backports, standard library candidates and small utilities that don't yet deserve their own repository" 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"] skipDirs = @["tests"]
requires "nim >= 1.2.0", requires "nim >= 1.2.0",
@ -19,7 +19,7 @@ let styleCheckStyle = if (NimMajor, NimMinor) < (1, 6): "hint" else: "error"
let cfg = let cfg =
" --styleCheck:usages --styleCheck:" & styleCheckStyle & " --styleCheck:usages --styleCheck:" & styleCheckStyle &
(if verbose: "" else: " --verbosity:0 --hints:off") & (if verbose: "" else: " --verbosity:0 --hints:off") &
" --skipParentCfg --skipUserCfg" " --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f"
proc build(args, path: string) = proc build(args, path: string) =
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
@ -29,7 +29,8 @@ proc run(args, path: string) =
task test, "Run all tests": task test, "Run all tests":
build "", "tests/test_helper" build "", "tests/test_helper"
run "--threads:off", "tests/all_tests" for args in [
run "--threads:on -d:nimTypeNames", "tests/all_tests" "--threads:off",
run "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians", "--threads:on -d:nimTypeNames",
"tests/all_tests" "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians"
]: run args, "tests/all_tests"

View File

@ -10,6 +10,8 @@ import unittest2
import std/[osproc, strutils] import std/[osproc, strutils]
import ../stew/io2 import ../stew/io2
from os import getAppDir
when defined(posix): when defined(posix):
from std/posix import EAGAIN from std/posix import EAGAIN
@ -540,31 +542,27 @@ suite "OS Input/Output procedures test suite":
proc lockTest(path: string, flags: set[OpenFlags], proc lockTest(path: string, flags: set[OpenFlags],
lockType: LockType): IoResult[array[3, TestResult]] = lockType: LockType): IoResult[array[3, TestResult]] =
const HelperPath = let helperPath = getAppDir() & "/test_helper "
when defined(windows):
"test_helper "
else:
"tests/test_helper "
let let
handle = ? openFile(path, flags) handle = ? openFile(path, flags)
lock = ? lockFile(handle, lockType) lock = ? lockFile(handle, lockType)
let res1 = let res1 =
try: try:
execCmdEx(HelperPath & path) execCmdEx(helperPath & path)
except CatchableError as exc: except CatchableError as exc:
echo "Exception happens [", $exc.name, "]: ", $exc.msg echo "Exception happens [", $exc.name, "]: ", $exc.msg
("", -1) ("", -1)
? unlockFile(lock) ? unlockFile(lock)
let res2 = let res2 =
try: try:
execCmdEx(HelperPath & path) execCmdEx(helperPath & path)
except CatchableError as exc: except CatchableError as exc:
echo "Exception happens [", $exc.name, "]: ", $exc.msg echo "Exception happens [", $exc.name, "]: ", $exc.msg
("", -1) ("", -1)
? closeFile(handle) ? closeFile(handle)
let res3 = let res3 =
try: try:
execCmdEx(HelperPath & path) execCmdEx(helperPath & path)
except CatchableError as exc: except CatchableError as exc:
echo "Exception happens [", $exc.name, "]: ", $exc.msg echo "Exception happens [", $exc.name, "]: ", $exc.msg
("", -1) ("", -1)