expect valgrind test failure on memory leak (#15669)
* expect valgrind test failure on memory leak * alloc 1 instead of 0
This commit is contained in:
parent
e47c3987c1
commit
8da0e01769
2 changed files with 19 additions and 0 deletions
17
testament/tests/shouldfail/tvalgrind.nim
Normal file
17
testament/tests/shouldfail/tvalgrind.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
discard """
|
||||
valgrind: true
|
||||
cmd: "nim $target --gc:arc -d:useMalloc $options $file"
|
||||
"""
|
||||
|
||||
# this is the same check used by testament/specs.nim whether or not valgrind
|
||||
# tests are supported
|
||||
when defined(linux) and sizeof(int) == 8:
|
||||
# discarding this allocation will cause valgrind to fail (which is what we
|
||||
# want), but valgrind only runs on 64-bit Linux machines...
|
||||
discard alloc(1)
|
||||
else:
|
||||
# ...so on all other OS/architectures, simulate any non-zero exit code to
|
||||
# mimic how valgrind would have failed on this test. We cannot use things like
|
||||
# `disabled: "freebsd"` in the Testament configs above or else the tests will
|
||||
# be SKIP-ed rather than FAIL-ed
|
||||
quit(1) # choose 1 to match valgrind's `--error-exit=1`, but could be anything
|
||||
Loading…
Add table
Add a link
Reference in a new issue