Add tests for conan, recurse implies preprocess
This commit is contained in:
parent
6d256d1271
commit
c63d82bf77
5 changed files with 77 additions and 10 deletions
|
|
@ -17,10 +17,12 @@ var
|
|||
cmd = "nim c -f --hints:off -d:FLAGS=\"-f:ast2\" -d:checkAbi"
|
||||
lrcmd = " -r lzma.nim"
|
||||
zrcmd = " -r zlib.nim"
|
||||
sshcmd = " -r libssh2.nim"
|
||||
lexp = "liblzma version = "
|
||||
zexp = "zlib version = "
|
||||
|
||||
testCall(cmd & lrcmd, "No build files found", 1)
|
||||
testCall(cmd & " -d:libssh2Conan" & sshcmd, "Need version for Conan uri", 1)
|
||||
|
||||
when defined(posix):
|
||||
# stdlib
|
||||
|
|
@ -35,6 +37,9 @@ when defined(posix):
|
|||
testCall(cmd & " -d:lzmaGit -d:lzmaSetVer=v5.2.0" & lrcmd, lexp & "5.2.0", 0)
|
||||
testCall(cmd & " -d:lzmaGit -d:lzmaStatic -d:lzmaSetVer=v5.2.0" & lrcmd, lexp & "5.2.0", 0, delete = false)
|
||||
|
||||
# conan static
|
||||
testCall(cmd & " -d:libssh2Conan -d:libssh2SetVer=1.9.0 -d:libssh2Static" & sshcmd, zexp, 0)
|
||||
|
||||
# git
|
||||
testCall(cmd & " -d:envTest" & zrcmd, zexp, 0)
|
||||
testCall(cmd & " -d:envTestStatic" & zrcmd, zexp, 0, delete = false)
|
||||
|
|
@ -51,3 +56,6 @@ testCall(cmd & " -d:lzmaDL -d:lzmaStatic -d:lzmaSetVer=5.2.4" & lrcmd, lexp & "5
|
|||
# dl
|
||||
testCall(cmd & " -d:zlibDL -d:zlibSetVer=1.2.11" & zrcmd, zexp & "1.2.11", 0)
|
||||
testCall(cmd & " -d:zlibDL -d:zlibStatic -d:zlibSetVer=1.2.11" & zrcmd, zexp & "1.2.11", 0, delete = false)
|
||||
|
||||
# conan
|
||||
testCall(cmd & " -d:libssh2Conan -d:libssh2SetVer=1.9.0" & sshcmd, zexp, 0)
|
||||
|
|
|
|||
46
tests/libssh2.nim
Normal file
46
tests/libssh2.nim
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import nimterop/[build, cimport]
|
||||
|
||||
const
|
||||
outdir = getProjectCacheDir("libssh2")
|
||||
|
||||
getHeader(
|
||||
header = "libssh2.h",
|
||||
conanuri = "libssh2/$1",
|
||||
outdir = outdir
|
||||
)
|
||||
|
||||
cOverride:
|
||||
type
|
||||
stat = object
|
||||
stat64 = object
|
||||
SOCKET = object
|
||||
|
||||
when not libssh2Static:
|
||||
cImport(libssh2Path, recurse = true, dynlib = "libssh2LPath", flags = "-f:ast2 -c -E_ -F_")
|
||||
|
||||
when not defined(Windows):
|
||||
proc zlibVersion(): cstring {.importc, dynlib: libssh2LPath.}
|
||||
else:
|
||||
cImport(libssh2Path, recurse = true, flags = "-f:ast2 -c -E_ -F_")
|
||||
|
||||
when not defined(Windows):
|
||||
proc zlibVersion(): cstring {.importc.}
|
||||
|
||||
{.passL: "-lpthread".}
|
||||
|
||||
assert libssh2_init(0) == 0
|
||||
|
||||
let
|
||||
session = libssh2_session_init_ex(nil, nil, nil, nil)
|
||||
|
||||
if session == nil:
|
||||
quit(1)
|
||||
|
||||
libssh2_session_set_blocking(session, 0.cint)
|
||||
|
||||
echo "zlib version = " & (block:
|
||||
when not defined(Windows):
|
||||
$zlibVersion()
|
||||
else:
|
||||
""
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue