Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip assert_no_memory_leak when ASAN is enabled
ASAN greatly increases the memory footprint of Ruby, so these static thresholds are not appropriate. There's no real need to run these tests under ASAN. [Bug #20274]
- Loading branch information
1 parent
47b46fd
commit fe0b704
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "ruby/ruby.h" | ||
|
||
static VALUE | ||
asan_enabled_p(VALUE self) | ||
{ | ||
#if defined(__has_feature) | ||
/* clang uses __has_feature for determining asan */ | ||
return __has_feature(address_sanitizer) ? Qtrue : Qfalse; | ||
#elif defined(__SANITIZE_ADDRESS__) | ||
/* GCC sets __SANITIZE_ADDRESS__ for determining asan */ | ||
return Qtrue; | ||
#else | ||
return Qfalse; | ||
#endif | ||
} | ||
|
||
void | ||
Init_asan(void) | ||
{ | ||
VALUE m = rb_define_module("Test"); | ||
VALUE c = rb_define_class_under(m, "ASAN", rb_cObject); | ||
rb_define_singleton_method(c, "enabled?", asan_enabled_p, 0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'mkmf' | ||
create_makefile('-test-/asan') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters