Skip to content

Commit 7828199

Browse files
authored
#12103 - CI for OpenBSD (#12105)
* 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.
1 parent 89e6a7a commit 7828199

20 files changed

+56
-15
lines changed

.builds/openbsd.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
image: openbsd/latest
2+
packages:
3+
- gmake
4+
- sqlite3
5+
- node
6+
- boehm-gc
7+
- pcre
8+
- sfml
9+
- sdl2
10+
- libffi
11+
sources:
12+
- https://github.com/nim-lang/Nim
13+
environment:
14+
CC: /usr/bin/clang
15+
tasks:
16+
- setup: |
17+
cd Nim
18+
git clone --depth 1 -q https://github.com/nim-lang/csources.git
19+
gmake -C csources -j $(sysctl -n hw.ncpuonline)
20+
bin/nim c koch
21+
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
22+
- test: |
23+
cd Nim
24+
if ! ./koch runCI; then
25+
nim c -r tools/ci_testresults.nim
26+
exit 1
27+
fi
28+
triggers:
29+
- action: email
30+
condition: failure
31+
to: Andreas Rumpf <rumpf_a@web.de>

compiler/evalffi.nim

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ when defined(windows):
1717
const libcDll = "msvcrt.dll"
1818
elif defined(linux):
1919
const libcDll = "libc.so(.6|.5|)"
20+
elif defined(openbsd):
21+
const libcDll = "/usr/lib/libc.so(.95.1|)"
2022
elif defined(bsd):
2123
const libcDll = "/lib/libc.so.7"
2224
elif defined(osx):

config/nim.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ path="$lib/pure"
167167
@end
168168
@end
169169

170-
@if macosx or freebsd:
170+
@if macosx or freebsd or openbsd:
171171
cc = clang
172172
tlsEmulation:on
173173
gcc.options.always = "-w"

lib/pure/coro.nim

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ when defined(windows):
4848
{.warning: "ucontext coroutine backend is not available on windows, defaulting to fibers.".}
4949
when defined(nimCoroutinesSetjmp):
5050
{.warning: "setjmp coroutine backend is not available on windows, defaulting to fibers.".}
51-
elif defined(haiku):
51+
elif defined(haiku) or defined(openbsd):
5252
const coroBackend = CORO_BACKEND_SETJMP
5353
when defined(nimCoroutinesUcontext):
5454
{.warning: "ucontext coroutine backend is not available on haiku, defaulting to setjmp".}

lib/pure/os.nim

+3-10
Original file line numberDiff line numberDiff line change
@@ -2818,11 +2818,7 @@ when not weirdTarget and (defined(linux) or defined(solaris) or defined(bsd) or
28182818
len = readlink(procPath, result, len)
28192819
setLen(result, len)
28202820

2821-
when defined(openbsd):
2822-
proc isExecutable(path: string): bool =
2823-
let p = getFilePermissions(path)
2824-
result = fpUserExec in p and fpGroupExec in p and fpOthersExec in p
2825-
2821+
when not weirdTarget and defined(openbsd):
28262822
proc getApplOpenBsd(): string =
28272823
# similar to getApplHeuristic, but checks current working directory
28282824
when declared(paramStr):
@@ -2846,15 +2842,12 @@ when defined(openbsd):
28462842
break
28472843

28482844
if len(result) > 0:
2849-
if isExecutable(result):
2850-
return expandFilename(result)
2851-
2852-
return ""
2845+
return expandFilename(result)
28532846

28542847
# search in path
28552848
for p in split(string(getEnv("PATH")), {PathSep}):
28562849
var x = joinPath(p, exePath)
2857-
if existsFile(x) and isExecutable(x):
2850+
if existsFile(x):
28582851
return expandFilename(x)
28592852
else:
28602853
result = ""

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img src="https://raw.githubusercontent.com/nim-lang/assets/master/Art/logo-crown.png" height="28px"/> Nim [![Build Status][badge-nim-travisci]][nim-travisci] [![builds.sr.ht freebsd status](https://builds.sr.ht/~araq/nim/freebsd.yml.svg)](https://builds.sr.ht/~araq/nim/freebsd.yml?)
1+
# <img src="https://raw.githubusercontent.com/nim-lang/assets/master/Art/logo-crown.png" height="28px"/> Nim [![Build Status][badge-nim-travisci]][nim-travisci] [![builds.sr.ht freebsd status](https://builds.sr.ht/~araq/nim/freebsd.yml.svg)](https://builds.sr.ht/~araq/nim/freebsd.yml?) [![builds.sr.ht openbsd status](https://builds.sr.ht/~araq/nim/openbsd.yml.svg)](https://builds.sr.ht/~araq/nim/openbsd.yml?)
22

33
This repository contains the Nim compiler, Nim's stdlib, tools and documentation.
44
For more information about Nim, including downloads and documentation for

testament/specs.nim

+2
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ proc parseSpec*(filename: string): TSpec =
237237
when defined(freebsd): result.err = reDisabled
238238
of "arm64":
239239
when defined(arm64): result.err = reDisabled
240+
of "openbsd":
241+
when defined(openbsd): result.err = reDisabled
240242
else:
241243
result.parseErrors.addLine "cannot interpret as a bool: ", e.value
242244
of "cmd":

tests/coroutines/tgc.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
discard """
22
target: "c"
3+
disabled: "openbsd"
34
"""
45

56
import coro

tests/coroutines/twait.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
discard """
22
output: "Exit 1\nExit 2"
33
disabled: "macosx"
4+
disabled: "openbsd"
45
target: "c"
56
"""
67
import coro

tests/dll/nimhcr_integration.nim

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
discard """
2+
disabled: "openbsd"
23
disabled: "macosx"
34
output: '''
45
main: HELLO!
@@ -151,4 +152,4 @@ update 0
151152
update 1
152153
update 2
153154

154-
echo "done"
155+
echo "done"

tests/dll/nimhcr_unit.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
discard """
2+
disabled: "openbsd"
23
output: '''
34
fastcall_proc implementation #1 10
45
11

tests/exception/t9657.nim

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ discard """
22
action: run
33
exitcode: 1
44
target: "c"
5+
disabled: "openbsd"
56
"""
67
# todo: remove `target: "c"` workaround once #10343 is properly fixed
78
close stdmsg

tests/niminaction/Chapter8/sfml/sfml_test.nim

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ discard """
22
action: compile
33
disabled: "windows"
44
disabled: "freebsd"
5+
disabled: "openbsd"
56
"""
67

78
import sfml, os

tests/parallel/tarray_of_channels.nim

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test
88
test
99
test
1010
'''
11+
disabled: "openbsd"
1112
"""
1213

1314
# bug #2257

tests/parallel/tflowvar.nim

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ bazbearbazbear
44
55
1'''
66
cmd: "nim $target --threads:on $options $file"
7+
disabled: "openbsd"
78
"""
89

910
import threadpool

tests/stdlib/tgetaddrinfo.nim

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ block DGRAM_UDP:
1515
doAssert aiList.ai_next == nil
1616
freeAddrInfo aiList
1717

18-
when defined(posix) and not defined(haiku) and not defined(freebsd):
18+
when defined(posix) and not defined(haiku) and not defined(freebsd) and not defined(openbsd):
1919

2020
block RAW_ICMP:
2121
# the port will be ignored

tests/stdlib/thttpclient_ssl.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
discard """
22
cmd: "nim $target --threads:on -d:ssl $options $file"
3+
disabled: "openbsd"
34
"""
45

56
# Nim - Basic SSL integration tests

tests/stdlib/tosprocterminate.nim

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import os, osproc, times, std / monotimes
88

99
when defined(Windows):
1010
const ProgramWhichDoesNotEnd = "notepad"
11+
elif defined(openbsd):
12+
const ProgramWhichDoesNotEnd = "/bin/cat"
1113
else:
1214
const ProgramWhichDoesNotEnd = "/bin/sh"
1315

tests/system/talloc2.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
discard """
22
disabled: "windows"
3+
disabled: "openbsd"
34
joinable: false
45
disabled: 32bit
56
"""

tests/system/trealloc.nim

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
discard """
22
output: '''success'''
33
joinable: false
4+
disabled: "openbsd"
45
"""
56

67
# bug #4818

0 commit comments

Comments
 (0)