* Working on OpenBSD CI * Condense steps into 2 steps to make output easier to follow. * Move up one directory after csources build. * Remove FreeBSD build manifest and add OpenBSD test ignores for coroutines and hot code reloading. * If runCI fails, run the test results script. * Add email trigger for build failure * Remove .git from repository URL * Disable SFML test on OpenBSD * Disable tgetaddrinfo on OpenBSD as only UDP and TCP protocols are supported. * Remove getFilePermissions as it causes CI test failures with NimScript. * Set clang as cc in nim.cfg and use gmake to build csources. * Add getCurrentDir to nimscript. * Remove duplicate getCurrentDir and check for not weirdTarget. * Add CI badge for OpenBSD. * Disable tests which allocate lots of memory for OpenBSD. * Use `CORO_BACKEND_SETJMP` on OpenBSD rather than ucontext. * Simplify building of koch * Disable t8657 on OpenBSD. See issue #13760. * Fix #12142 - tarray_of_channels fails on OpenBSD * Disable thhtpclient_ssl and tosprocterminate on OpenBSD. These tests can be enabled at a later date after fixing them. * Install libffi. * Set path to libc for openbsd. * Disable tevalffi for now. * Remove tevalffi.nim. * Use ncpuonline sysctl rather than ncpu. * Disable tacceptcloserace and tasynchttpserver on OpenBSD. * Enable tacceptcloserace and tasynchttpserver. * Fix #13775 as suggested by @alaviss - use /bin/cat on OpenBSD rather than /bin/sh. * Enable test on OpenBSD. * Disable tflowvar on OpenBSD.
148 lines
3.1 KiB
Nim
148 lines
3.1 KiB
Nim
discard """
|
|
disabled: "openbsd"
|
|
output: '''
|
|
fastcall_proc implementation #1 10
|
|
11
|
|
fastcall_proc implementation #2 20
|
|
22
|
|
fastcall_proc implementation #2 20
|
|
22
|
|
fastcall_proc implementation #3 30
|
|
33
|
|
fastcall_proc implementation #3 30
|
|
33
|
|
fastcall_proc implementation #3 30
|
|
33
|
|
fastcall_proc implementation #3 40
|
|
43
|
|
cdecl_proc implementation #1 10
|
|
11
|
|
cdecl_proc implementation #2 20
|
|
22
|
|
cdecl_proc implementation #2 20
|
|
22
|
|
cdecl_proc implementation #3 30
|
|
33
|
|
cdecl_proc implementation #3 30
|
|
33
|
|
cdecl_proc implementation #3 30
|
|
33
|
|
cdecl_proc implementation #3 40
|
|
43
|
|
stdcall_proc implementation #1 10
|
|
11
|
|
stdcall_proc implementation #2 20
|
|
22
|
|
stdcall_proc implementation #2 20
|
|
22
|
|
stdcall_proc implementation #3 30
|
|
33
|
|
stdcall_proc implementation #3 30
|
|
33
|
|
stdcall_proc implementation #3 30
|
|
33
|
|
stdcall_proc implementation #3 40
|
|
43
|
|
noconv_proc implementation #1 10
|
|
11
|
|
noconv_proc implementation #2 20
|
|
22
|
|
noconv_proc implementation #2 20
|
|
22
|
|
noconv_proc implementation #3 30
|
|
33
|
|
noconv_proc implementation #3 30
|
|
33
|
|
noconv_proc implementation #3 30
|
|
33
|
|
noconv_proc implementation #3 40
|
|
43
|
|
inline_proc implementation #1 10
|
|
11
|
|
inline_proc implementation #2 20
|
|
22
|
|
inline_proc implementation #2 20
|
|
22
|
|
inline_proc implementation #3 30
|
|
33
|
|
inline_proc implementation #3 30
|
|
33
|
|
inline_proc implementation #3 30
|
|
33
|
|
inline_proc implementation #3 40
|
|
43
|
|
'''
|
|
"""
|
|
|
|
import macros
|
|
|
|
macro carryOutTests(callingConv: untyped): untyped =
|
|
let
|
|
procName = $callingConv & "_proc"
|
|
globalName = $callingConv & "_global"
|
|
callingConv = callingConv
|
|
p1 = ident(procName & "1")
|
|
p2 = ident(procName & "2")
|
|
p3 = ident(procName & "3")
|
|
g1 = ident(globalName & "1")
|
|
g2 = ident(globalName & "2")
|
|
|
|
result = quote do:
|
|
var `g1`: pointer = nil
|
|
if hcrRegisterGlobal("dummy_module", `globalName`, sizeof(int), nil, addr `g1`):
|
|
cast[ptr int](`g1`)[] = 10
|
|
|
|
var `g2`: pointer = nil
|
|
if hcrRegisterGlobal("dummy_module", `globalName`, sizeof(int), nil, addr `g2`):
|
|
cast[ptr int](`g2`)[] = 20
|
|
|
|
doAssert `g1` == `g2` and cast[ptr int](`g1`)[] == 10
|
|
|
|
type
|
|
F = proc (x: int): int {.placeholder.}
|
|
|
|
proc `p1`(x: int): int {.placeholder.}=
|
|
echo `procName`, " implementation #1 ", x
|
|
return x + 1
|
|
|
|
let fp1 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p1`))
|
|
echo fp1(10)
|
|
|
|
proc `p2`(x: int): int {.placeholder.} =
|
|
echo `procName`, " implementation #2 ", x
|
|
return x + 2
|
|
|
|
let fp2 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p2`))
|
|
echo fp1(20)
|
|
echo fp2(20)
|
|
|
|
proc `p3`(x: int): int {.placeholder.} =
|
|
echo `procName`, " implementation #3 ", x
|
|
return x + 3
|
|
|
|
let fp3 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p3`))
|
|
echo fp1(30)
|
|
echo fp2(30)
|
|
echo fp3(30)
|
|
|
|
let fp4 = cast[F](hcrGetProc("dummy_module", `procName`))
|
|
echo fp4(40)
|
|
|
|
proc replacePlaceholderPragmas(n: NimNode) =
|
|
if n.kind == nnkPragma:
|
|
n[0] = callingConv
|
|
else:
|
|
for i in 0 ..< n.len:
|
|
replacePlaceholderPragmas n[i]
|
|
|
|
replacePlaceholderPragmas result
|
|
# echo result.treeRepr
|
|
|
|
hcrAddModule("dummy_module")
|
|
|
|
carryOutTests fastcall
|
|
carryOutTests cdecl
|
|
carryOutTests stdcall
|
|
carryOutTests noconv
|
|
carryOutTests inline
|
|
|