Merge two coverage tests undef UBSan into one.

Also replace mkdir -p with rm -rf && mkdir.

llvm-svn: 272839
This commit is contained in:
Evgeniy Stepanov 2016-06-15 21:18:17 +00:00
parent 20e4d9e21d
commit 062c26f1f0
2 changed files with 5 additions and 19 deletions

View File

@ -3,12 +3,16 @@
// FIXME: Port the environment variable logic below for the lit shell. // FIXME: Port the environment variable logic below for the lit shell.
// REQUIRES: shell // REQUIRES: shell
// //
// RUN: mkdir -p %T/coverage-levels // RUN: rm -rf %T/coverage-levels && mkdir %T/coverage-levels
// RUN: %clangxx -fsanitize=shift -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t // RUN: %clangxx -fsanitize=shift -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// RUN: %clangxx -fsanitize=undefined -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t // RUN: %clangxx -fsanitize=undefined -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN // RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// Also works without any sanitizer.
// RUN: %clangxx -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func %s -o %t // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN // RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb %s -o %t // RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb %s -o %t

View File

@ -1,18 +0,0 @@
// RUN: mkdir -p %T/coverage
// RUN: %clangxx -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:coverage_bitset=1:verbosity=1:coverage_dir=%T/coverage %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1
// RUN: %clangxx -O1 -fsanitize-coverage=bb %s -o %t
// RUN: %env_ubsan_opts=coverage=1:coverage_bitset=1:verbosity=1:coverage_dir=%T/coverage %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2
//
// UNSUPPORTED: ubsan-tsan
// UNSUPPORTED: android
volatile int sink;
int main(int argc, char **argv) {
if (argc == 0)
sink = 0;
}
// CHECK1: CovDump: bitset of 1 bits written for '{{.*}}', 1 bits are set
// CHECK1: 1 PCs written
// CHECK2: CovDump: bitset of 2 bits written for '{{.*}}', 1 bits are set
// CHECK2: 1 PCs written