feat: introduce some changes/additions from test/use-cases branch
But without introducing the use cases tests themselves nor their dependencies in vendor.
This commit is contained in:
parent
b2442ecba8
commit
a87f3f85be
|
@ -81,7 +81,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" V=1 test
|
make -j${NPROC} NIMFLAGS="--parallelBuild:${NPROC}" V=1 test
|
||||||
|
|
||||||
- name: Build and run channel_helgrind
|
- name: Build and run helgrind tasks
|
||||||
if: matrix.platform.os == 'ubuntu'
|
if: matrix.platform.os == 'ubuntu'
|
||||||
run: |
|
run: |
|
||||||
./env.sh nimble channel_helgrind
|
./env.sh nimble achannels_helgrind
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -9,6 +9,7 @@ BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
||||||
.PHONY: \
|
.PHONY: \
|
||||||
all \
|
all \
|
||||||
clean \
|
clean \
|
||||||
|
clean-build-dirs \
|
||||||
deps \
|
deps \
|
||||||
test \
|
test \
|
||||||
update
|
update
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||||
# MIT license (LICENSE-MIT)
|
# MIT license (LICENSE-MIT)
|
||||||
import ./task_runner/achannels
|
import ./task_runner/achannels, ./task_runner/sys
|
||||||
|
|
||||||
export achannels
|
export achannels, sys
|
||||||
|
|
|
@ -26,6 +26,7 @@ proc buildAndRunTest(name: string,
|
||||||
" --debugger:native" &
|
" --debugger:native" &
|
||||||
" --define:chronicles_line_numbers" &
|
" --define:chronicles_line_numbers" &
|
||||||
" --define:debug" &
|
" --define:debug" &
|
||||||
|
" --define:ssl" &
|
||||||
" --linetrace:on" &
|
" --linetrace:on" &
|
||||||
" --nimcache:nimcache/test/" & name &
|
" --nimcache:nimcache/test/" & name &
|
||||||
" --out:" & outDir & name &
|
" --out:" & outDir & name &
|
||||||
|
@ -43,13 +44,13 @@ proc buildAndRunTest(name: string,
|
||||||
task tests, "Run all tests":
|
task tests, "Run all tests":
|
||||||
buildAndRunTest "test_all"
|
buildAndRunTest "test_all"
|
||||||
|
|
||||||
task channel_helgrind, "Run channel implementation through helgrind to detect threading or lock errors":
|
task achannels_helgrind, "Run channel implementation through helgrind to detect threading or lock errors":
|
||||||
rmDir "test/build/"
|
rmDir "test/build/"
|
||||||
mkDir "test/build/"
|
mkDir "test/build/"
|
||||||
var commands = [
|
var commands = [
|
||||||
"nim c" &
|
"nim c" &
|
||||||
" --define:useMalloc" &
|
" --define:useMalloc" &
|
||||||
" --nimcache:nimcache/test/channel_helgrind" &
|
" --nimcache:nimcache/test/achannels_helgrind" &
|
||||||
" --out:test/build/test_achannels" &
|
" --out:test/build/test_achannels" &
|
||||||
" --threads:on" &
|
" --threads:on" &
|
||||||
" --tlsEmulation:off" &
|
" --tlsEmulation:off" &
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
type
|
||||||
|
ThreadSafeString* = distinct cstring
|
||||||
|
|
||||||
|
proc safe*(input: string): ThreadSafeString =
|
||||||
|
var res = cast[cstring](allocShared(input.len + 1))
|
||||||
|
copyMem(res, input.cstring, input.len)
|
||||||
|
res[input.len] = '\0'
|
||||||
|
res.ThreadSafeString
|
||||||
|
|
||||||
|
proc `$`*(input: ThreadSafeString): string =
|
||||||
|
result = $(input.cstring)
|
||||||
|
deallocShared input.cstring
|
|
@ -0,0 +1,12 @@
|
||||||
|
import chronos, unittest
|
||||||
|
|
||||||
|
template asyncTest*(name, body: untyped) =
|
||||||
|
test name:
|
||||||
|
proc scenario {.async.} = body
|
||||||
|
waitFor scenario()
|
||||||
|
|
||||||
|
template procSuite*(name, body: untyped) =
|
||||||
|
proc suitePayload =
|
||||||
|
suite name:
|
||||||
|
body
|
||||||
|
suitePayload()
|
|
@ -1 +1 @@
|
||||||
Subproject commit 53870bc6bccf0f09f9c50a923d1fa1fb235d2db0
|
Subproject commit e7694f16ceccd7c98ecb6870263025018b7d37b3
|
Loading…
Reference in New Issue