diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e437f1..9d76d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,4 +158,4 @@ jobs: nim --version nimble --version nimble install -y --depsOnly - env TEST_LANG="c" nimble test + env NIMLANG="c" nimble test diff --git a/.gitignore b/.gitignore index fa19c26..0e5fc52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ nimcache/ *.exe -gen nimble.develop nimble.paths +/build/ + +gen diff --git a/bearssl.nimble b/bearssl.nimble index 39186e8..31cd779 100644 --- a/bearssl.nimble +++ b/bearssl.nimble @@ -1,27 +1,41 @@ -import os, strutils +mode = ScriptMode.Verbose -# Package +packageName = "bearssl" version = "0.1.5" author = "Status Research & Development GmbH" description = "BearSSL wrapper" license = "MIT or Apache License 2.0" -mode = ScriptMode.Verbose +skipDirs = @["tests"] -# Dependencies requires "nim >= 1.2.0", - "unittest2" + "unittest2" -### Helper functions -proc test(env, path: string) = - # Compilation language is controlled by TEST_LANG - exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & env & - " -d:bearsslSplitAbi -rf --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error " & path +let nimc = getEnv("NIMC", "nim") # Which nim compiler to use +let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js) +let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler +let verbose = getEnv("V", "") notin ["", "0"] + +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 --outdir:build --nimcache:build/nimcache -f" + +proc build(args, path: string) = + exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path + +proc run(args, path: string) = + build args & " -r", path + +import strutils task test, "Run tests": - for path in listFiles(thisDir() / "tests"): - if path.split(".")[^1] != "nim": - continue - test "-d:debug", path - test "-d:release", path - test "--gc:arc -d:release", path - rmFile(path[0..^5].toExe()) + for path in listFiles("tests"): + if not path.endsWith ".nim": continue + + for args in [ + "-d:debug", + "-d:release", + "-d:bearsslSplitAbi -d:debug", + "-d:bearsslSplitAbi -d:release", + ]: run args, path diff --git a/bearssl/abi/bearssl_ssl.nim b/bearssl/abi/bearssl_ssl.nim index 4bb57b3..547a829 100644 --- a/bearssl/abi/bearssl_ssl.nim +++ b/bearssl/abi/bearssl_ssl.nim @@ -1132,11 +1132,11 @@ type hashCV_len* {.importc: "hash_CV_len".}: uint hashCV_id* {.importc: "hash_CV_id".}: cint -proc sslSessionCacheLruInit*(cc: var SslSessionCacheLru; store: ptr cuchar; +proc sslSessionCacheLruInit*(cc: var SslSessionCacheLru; store: ptr byte; storeLen: int) {.importcFunc, importc: "br_ssl_session_cache_lru_init", header: "bearssl_ssl.h".} -proc sslSessionCacheLruForget*(cc: var SslSessionCacheLru; id: ptr cuchar) {.importcFunc, +proc sslSessionCacheLruForget*(cc: var SslSessionCacheLru; id: ptr byte) {.importcFunc, importc: "br_ssl_session_cache_lru_forget", header: "bearssl_ssl.h".} diff --git a/regenerate.sh b/regenerate.sh old mode 100644 new mode 100755