-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #15631 #15632
fix #15631 #15632
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests without -d:useMalloc
should be removed as they only really test that we don't use malloc or that valgrind can only detect leaks via malloc (not something we should test or rely on); we also don't need seperate tests for orc/arc in this case IMO.
What is the best way to get the Valgrind tests to pass on non-Linux hosts in the pipelines? One way could be to rewrite the tests to look like discard """
# Testament configs
# Testament configs
# Testament configs
"""
when defined(linux) and sizeof(int) == 8:
# original test code
discard alloc(1)
else:
# simulate the expected failed valgrind output
echo " definitely lost: 7 bytes in 2 blocks"
# exit with the same code as --error-exitcode=1
quit(1) which follows the example set here: Line 308 in d6160ef
and fakes the output expected in test cases like
but this does not seem like a great solution. |
Oh, this looks like it will be much better: Lines 317 to 325 in d6160ef
Lines 339 to 341 in d6160ef
|
|
is redundant because we already have an ARC test
As to not test implementation details (or bug)
Since this tests/shoulfail/tvalgrind.nim was specified here to fail this test itself fails since it will be skipped on non-linux CI
Sorry for force-pushing to your branch @n5m , I thought that a rebase would solve the errors. |
Quite all right, @Clyybber. Happy to have helped with this PR. I am interested, however, in seeing tvalgrind.nim added back into the codebase. My rationale is that while tleak_arc.nim tests that memory leaks are found, tvalgrind.nim tests Testament, itself. It also nicely parallels the remaining tests in Would you be opposed to a tvalgrind.nim like this? discard """
valgrind: enabled
cmd: "nim $target --gc:arc -d:useMalloc $options $file"
disabled: "freebsd"
disabled: "macosx"
disabled: "openbsd"
disabled: "windows"
disabled: "32bit"
"""
when defined(linux) and sizeof(int) == 8:
# test that a memory leak is caught by valgrind, but valgrind only
# runs on 64-bit Linux machines...
discard alloc(1)
else:
# ...so on all other OS/architectures, simulate the same exit code
# that valgrind would have thrown for this test case
quit(1) # chosen from --error-exit=1 |
@n5m Oh, yeah that looks fine. |
* trigger valgrind failure on memory leak * remove non-malloc tests * remove ORC test is redundant because we already have an ARC test * only run valgrind tests on 64-bit Linux * disable freebsd and openbsd * Remove tleak_refc As to not test implementation details (or bug) * Fix test failures by removing redundant test Since this tests/shoulfail/tvalgrind.nim was specified here to fail this test itself fails since it will be skipped on non-linux CI * Remove test, reason detailed in the previous commit * Remove redundant disables * Revert removing disables * Add and use valgrind: leaks * Fix Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: n5m (cherry picked from commit 436e1fa)
* trigger valgrind failure on memory leak * remove non-malloc tests * remove ORC test is redundant because we already have an ARC test * only run valgrind tests on 64-bit Linux * disable freebsd and openbsd * Remove tleak_refc As to not test implementation details (or bug) * Fix test failures by removing redundant test Since this tests/shoulfail/tvalgrind.nim was specified here to fail this test itself fails since it will be skipped on non-linux CI * Remove test, reason detailed in the previous commit * Remove redundant disables * Revert removing disables * Add and use valgrind: leaks * Fix Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: n5m
* trigger valgrind failure on memory leak * remove non-malloc tests * remove ORC test is redundant because we already have an ARC test * only run valgrind tests on 64-bit Linux * disable freebsd and openbsd * Remove tleak_refc As to not test implementation details (or bug) * Fix test failures by removing redundant test Since this tests/shoulfail/tvalgrind.nim was specified here to fail this test itself fails since it will be skipped on non-linux CI * Remove test, reason detailed in the previous commit * Remove redundant disables * Revert removing disables * Add and use valgrind: leaks * Fix Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: n5m
fix #15631