@parameterized({'use_after_free_c': ('test_asan_use_after_free.c', ['AddressSanitizer: heap-use-after-free on address']), 'use_after_free_cpp': ('test_asan_use_after_free.cpp', ['AddressSanitizer: heap-use-after-free on address']), 'use_after_return': ('test_asan_use_after_return.c', ['AddressSanitizer: stack-use-after-return on address'], ['-Wno-return-stack-address']), 'static_buffer_overflow': ('test_asan_static_buffer_overflow.c', ['AddressSanitizer: global-buffer-overflow on address'], ['-fno-builtin-memset']), 'heap_buffer_overflow_c': ('test_asan_heap_buffer_overflow.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memset']), 'heap_buffer_overflow_cpp': ('test_asan_heap_buffer_overflow.cpp', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memset']), 'stack_buffer_overflow': ('test_asan_stack_buffer_overflow.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'stack_buffer_overflow_js': ('test_asan_stack_buffer_overflow_js.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_unround_size': ('test_asan_bitfield_unround_size.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_unround_offset': ('test_asan_bitfield_unround_offset.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_round': ('test_asan_bitfield_round.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'memset_null': ('test_asan_memset_null.c', ['AddressSanitizer: null-pointer-dereference on address 0x00000001'], ['-fno-builtin-memset']), 'memset_freed': ('test_asan_memset_freed.c', ['AddressSanitizer: heap-use-after-free on address'], ['-fno-builtin-memset']), 'strcpy': ('test_asan_strcpy.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-strcpy']), 'memcpy': ('test_asan_memcpy.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memcpy']), 'memchr': ('test_asan_memchr.c', ['AddressSanitizer: global-buffer-overflow on address'], ['-fno-builtin-memchr']), 'vector': ('test_asan_vector.cpp', ['AddressSanitizer: container-overflow on address'])})
@no_fastcomp('asan not supported on fastcomp')
def test_asan(self, name, expected_output, cflags=None):
    if ('-Oz' in self.emcc_args):
        self.skipTest('-Oz breaks source maps')
    if (not self.get_setting('WASM')):
        self.skipTest('wasm2js has no ASan support')
    self.emcc_args += ['-fsanitize=address', '-s', 'ALLOW_MEMORY_GROWTH=1']
    if cflags:
        self.emcc_args += cflags
    self.do_run(open(path_from_root('tests', 'core', name)).read(), basename=('src.c' if name.endswith('.c') else 'src.cpp'), expected_output=expected_output, assert_all=True, check_for_error=False, assert_returncode=None)
@parameterized({'use_after_free_c': ('test_asan_use_after_free.c', ['AddressSanitizer: heap-use-after-free on address']), 'use_after_free_cpp': ('test_asan_use_after_free.cpp', ['AddressSanitizer: heap-use-after-free on address']), 'use_after_return': ('test_asan_use_after_return.c', ['AddressSanitizer: stack-use-after-return on address'], ['-Wno-return-stack-address']), 'static_buffer_overflow': ('test_asan_static_buffer_overflow.c', ['AddressSanitizer: global-buffer-overflow on address'], ['-fno-builtin-memset']), 'heap_buffer_overflow_c': ('test_asan_heap_buffer_overflow.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memset']), 'heap_buffer_overflow_cpp': ('test_asan_heap_buffer_overflow.cpp', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memset']), 'stack_buffer_overflow': ('test_asan_stack_buffer_overflow.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'stack_buffer_overflow_js': ('test_asan_stack_buffer_overflow_js.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_unround_size': ('test_asan_bitfield_unround_size.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_unround_offset': ('test_asan_bitfield_unround_offset.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'bitfield_round': ('test_asan_bitfield_round.c', ['AddressSanitizer: stack-buffer-overflow'], ['-fno-builtin-memset']), 'memset_null': ('test_asan_memset_null.c', ['AddressSanitizer: null-pointer-dereference on address 0x00000001'], ['-fno-builtin-memset']), 'memset_freed': ('test_asan_memset_freed.c', ['AddressSanitizer: heap-use-after-free on address'], ['-fno-builtin-memset']), 'strcpy': ('test_asan_strcpy.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-strcpy']), 'memcpy': ('test_asan_memcpy.c', ['AddressSanitizer: heap-buffer-overflow on address'], ['-fno-builtin-memcpy']), 'memchr': ('test_asan_memchr.c', ['AddressSanitizer: global-buffer-overflow on address'], ['-fno-builtin-memchr']), 'vector': ('test_asan_vector.cpp', ['AddressSanitizer: container-overflow on address'])})
@no_fastcomp('asan not supported on fastcomp')
def test_asan(self, name, expected_output, cflags=None):
    if ('-Oz' in self.emcc_args):
        self.skipTest('-Oz breaks source maps')
    if (not self.get_setting('WASM')):
        self.skipTest('wasm2js has no ASan support')
    self.emcc_args += ['-fsanitize=address', '-s', 'ALLOW_MEMORY_GROWTH=1']
    if cflags:
        self.emcc_args += cflags
    self.do_run(open(path_from_root('tests', 'core', name)).read(), basename=('src.c' if name.endswith('.c') else 'src.cpp'), expected_output=expected_output, assert_all=True, check_for_error=False, assert_returncode=None)