A lot of tests are disabled by using UNSUPPORTED. The plan is to remove UNSUPPORTED for tests that are fixed.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D142676
set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LSAN_TESTSUITES)
-
+
set(LSAN_TEST_ARCH ${LSAN_SUPPORTED_ARCH})
if(APPLE)
darwin_filter_host_archs(LSAN_SUPPORTED_ARCH LSAN_TEST_ARCH)
string(TOLOWER "-${arch}" LSAN_TEST_CONFIG_SUFFIX)
get_test_cc_for_arch(${arch} LSAN_TEST_TARGET_CC LSAN_TEST_TARGET_CFLAGS)
string(TOUPPER ${arch} ARCH_UPPER_CASE)
+
set(LSAN_LIT_TEST_MODE "Standalone")
set(CONFIG_NAME ${ARCH_UPPER_CASE}LsanConfig)
-
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
set(CONFIG_NAME ${ARCH_UPPER_CASE}AsanConfig)
set(LSAN_LIT_TEST_MODE "AddressSanitizer")
-
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+
+ # Fixme: make this generic 64 bit check once confirmed that at least
+ # ARM64 works.
+ if (arch STREQUAL "x86_64" AND NOT APPLE)
+ set(CONFIG_NAME ${ARCH_UPPER_CASE}HWAsanConfig)
+ set(LSAN_LIT_TEST_MODE "HWAddressSanitizer")
+ configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
+ list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
+ endif()
endforeach()
set(LSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
// Regression test for thread lifetime tracking. Thread data should be
// considered live during the thread's termination, at least until the
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
// user-installed TSD destructors have finished running (since they may contain
// additional cleanup tasks). LSan doesn't actually meet that goal 100%, but it
// makes its best effort.
// RUN: %clang_lsan %s -o %t
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0:use_tls=1:use_ld_allocations=0" %run %t
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
// RUN: %clangxx_lsan %s -o %t
// RUN: %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
// Check that if LSan finds that SP doesn't point into thread stack (e.g.
// if swapcontext is used), LSan will not hit the guard page.
// RUN: %clang_lsan %s -o %t && %run %t
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
// Missing 'getcontext' and 'makecontext' on Android.
// UNSUPPORTED: android
// where lsan would call dl_iterate_phdr while holding the allocator lock.
// RUN: %clangxx_lsan %s -o %t && %run %t
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <link.h>
#include <mutex>
#include <stdlib.h>
// RUN: %clangxx_lsan %s -o %t
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
// The globs below do not work in the lit shell.
// Regular run.
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// Investigate why it does not fail with use_tls=0
// UNSUPPORTED: arm-linux || armhf-linux
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
// RUN: %clangxx_lsan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
extern "C"
const char *__lsan_default_options() {
// CHECK: Available flags for {{Leak|Address}}Sanitizer:
// RUN: %clang_lsan %s -o %t
// RUN: %env_lsan_opts=report_objects=1:use_registers=0:use_stacks=0:use_tls=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// Investigate why it does not fail with use_tls=0
// UNSUPPORTED: arm-linux || armhf-linux
// Test for __lsan_do_leak_check(). We test it by making the leak check run
// before global destructors, which also tests compatibility with HeapChecker's
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
// "normal" mode (LSan runs in "strict" mode by default).
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s
// Usage: ./a.out number_of_threads total_number_of_allocations
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts=use_ld_allocations=0 %run %t 5 1000000 2>&1
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
// RUN: %clang_lsan %s -o %t
// RUN: %env_lsan_opts=report_objects=1:use_registers=0:use_stacks=0:use_tls=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// Investigate why it does not fail with use_stack=0
// UNSUPPORTED: arm-linux || armhf-linux
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include <sanitizer/lsan_interface.h>
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
//
// UNSUPPORTED: darwin
// RUN: %clang_lsan %s -o %t
// RUN: %env_lsan_opts=use_stacks=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
/// Fails when only leak sanitizer is enabled
// UNSUPPORTED: arm-linux, armhf-linux
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// On glibc, this requires the range returned by GetTLS to include
// specific_1stblock and specific in `struct pthread`.
// UNSUPPORTED: arm-linux, armhf-linux
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// Patch r303906 did not fix all the problems.
// UNSUPPORTED: arm-linux,armhf-linux
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0" not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
// RUN: %clang_lsan %s -o %t
// RUN: %env_lsan_opts=allocator_may_return_null=1:max_allocation_size_mb=1:use_stacks=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
/// Fails when only leak sanitizer is enabled
// UNSUPPORTED: arm-linux, armhf-linux
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t foo 2>&1 | FileCheck %s
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t 2>&1 | FileCheck %s
+
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
//
// UNSUPPORTED: darwin
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:use_root_regions=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts=use_registers=0:use_stacks=0 not %run %t 2>&1 | FileCheck %s
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
// RUN: %clangxx_lsan %s -o %t
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// RUN: rm -f %t.supp
// RUN: touch %t.supp
// RUN: %push_to_device %t.supp %device_rundir/%t.supp
// We can't unwind stack if we're running coroutines on heap-allocated
// memory. Make sure we don't report these leaks.
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// RUN: %clangxx_lsan %s -o %t
// RUN: %env_lsan_opts= %run %t 2>&1
// RUN: %env_lsan_opts= not %run %t foo 2>&1 | FileCheck %s
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// Investigate why it does not fail with use_stack=0
// UNSUPPORTED: arm-linux || armhf-linux
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include "sanitizer_common/print_address.h"
#include <assert.h>
#include <pthread.h>
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
// FIXME: Support more platforms.
// REQUIRES: x86-target-arch && linux
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include "sanitizer_common/print_address.h"
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
// RUN: %env_lsan_opts="" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <assert.h>
#include <pthread.h>
#include <sched.h>
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_unaligned=0" not %run %t 2>&1 | FileCheck %s
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_unaligned=1" %run %t 2>&1
+// Fixme: remove once test passes with hwasan
+// UNSUPPORTED: hwasan
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
-# Choose between standalone and LSan+ASan modes.
+# Choose between standalone and LSan+(ASan|HWAsan) modes.
lsan_lit_test_mode = get_required_attr(config, 'lsan_lit_test_mode')
+target_arch = getattr(config, 'target_arch', None)
if lsan_lit_test_mode == "Standalone":
config.name = "LeakSanitizer-Standalone"
config.available_features.add('asan')
if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
+elif lsan_lit_test_mode == "HWAddressSanitizer":
+ config.name = "LeakSanitizer-HWAddressSanitizer"
+ lsan_cflags = ["-fsanitize=hwaddress"]
+ if target_arch == "x86_64":
+ lsan_cflags = lsan_cflags + [ '-fsanitize-hwaddress-experimental-aliasing']
+ config.available_features.add('hwasan')
+ if config.host_os == 'NetBSD':
+ config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
else:
lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
config.name += config.name_suffix
config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
config.substitutions.append( ("%clang_lsan ", build_invocation(clang_lsan_cflags)) )
config.substitutions.append( ("%clangxx_lsan ", build_invocation(clang_lsan_cxxflags)) )
+config.substitutions.append( ("%clang_hwasan ", build_invocation(clang_lsan_cflags)) )
+config.substitutions.append( ("%clangxx_hwasan ", build_invocation(clang_lsan_cxxflags)) )
+
# LeakSanitizer tests are currently supported on
# Android{aarch64, x86, x86_64}, x86-64 Linux, PowerPC64 Linux, arm Linux, mips64 Linux, s390x Linux, loongarch64 Linux and x86_64 Darwin.