[PATCH] asan unit tests from llvm lit-test

Jakub Jelinek jakub@redhat.com
Tue Dec 4 07:34:00 GMT 2012


On Tue, Dec 04, 2012 at 11:22:40AM +0400, Kostya Serebryany wrote:
> Please note that tsan has 20+ more tests like this
> (projects/compiler-rt/lib/tsan/lit_tests) and asan will be getting more
> such tests too
> (mostly for the new features such as use-after-return, use-after-scope,
> global-init).
> If we do not find a way to make these tests clang-friendly and gcc-friendly
> at the same time,
> the maintenance burden for the gcc fork could be quite high.

Well, the dejagnu comments could coexist with the FILECHECK comments,
LLVM would ignore the dejagnu comments and GCC would ignore the FILECHECK
comments.  Doing some automatic translation of FILECHECK into dejagnu
procedures is too complicated and too hackish, e.g. it would need to
abstract from the multiple compiler + invocation:
// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
ah, this is a C++ test run at all torture options, etc.  Plus as soon as
the tests are enabled on more than i?86/x86_64, some of the tests will need
to be limited to some particular targets, or skipped on some, tweaked
options etc.  You don't have thousands of tests, so doing it by hand and
reviewing those changes sounds much better way to me.

	Jakub



More information about the Gcc-patches mailing list