Files
Nim/tests/system/talloc2.nim
Euan 7828199827 #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.
2020-04-21 15:05:21 +02:00

47 lines
950 B
Nim

discard """
disabled: "windows"
disabled: "openbsd"
joinable: false
disabled: 32bit
"""
# no point to test this on system with smaller address space
# appveyor is "out of memory"
const
nmax = 2*1024*1024*1024
proc test(n: int) =
var a = alloc0(9999)
var t = cast[ptr UncheckedArray[int8]](alloc(n))
var b = alloc0(9999)
t[0] = 1
t[1] = 2
t[n-2] = 3
t[n-1] = 4
dealloc(a)
dealloc(t)
dealloc(b)
# allocator adds 48 bytes to BigChunk
# BigChunk allocator edges at 2^n * (1 - s) for s = [1..32]/64
proc test2(n: int) =
let d = n div 256 # cover edges and more
for i in countdown(128,1):
for j in [-4096, -64, -49, -48, -47, -32, 0, 4096]:
let b = n + j - i*d
if b>0 and b<=nmax:
test(b)
#echo b, ": ", getTotalMem(), " ", getOccupiedMem(), " ", getFreeMem()
proc test3 =
var n = 1
while n <= nmax:
test2(n)
n *= 2
n = nmax
while n >= 1:
test2(n)
n = n div 2
test3()