[compiler-rt] r232808 - [ASan] Move the coverage tests that work on Darwin to common testcase dir.

Alexander Potapenko glider at google.com
Fri Mar 20 06:31:03 PDT 2015


Author: glider
Date: Fri Mar 20 08:31:03 2015
New Revision: 232808

URL: http://llvm.org/viewvc/llvm-project?rev=232808&view=rev
Log:
[ASan] Move the coverage tests that work on Darwin to common testcase dir.

Added:
    compiler-rt/trunk/test/asan/TestCases/coverage-and-lsan.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee-total-count.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-caller-callee.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-disabled.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-fork.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-levels.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-maybe-open-file.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-order-pcs.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc
    compiler-rt/trunk/test/asan/TestCases/coverage-tracing.cc
      - copied unchanged from r232800, compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc
Removed:
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc (removed)
@@ -1,20 +0,0 @@
-// Make sure coverage is dumped even if there are reported leaks.
-//
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-//
-// RUN: rm -rf %T/coverage-and-lsan
-//
-// RUN: mkdir -p %T/coverage-and-lsan/normal
-// RUN: ASAN_OPTIONS=coverage=1:coverage_dir=%T/coverage-and-lsan:verbosity=1 not %run %t 2>&1 | FileCheck %s
-// RUN: %sancov print %T/coverage-and-lsan/*.sancov 2>&1
-//
-// REQUIRES: leak-detection
-
-int *g = new int;
-int main(int argc, char **argv) {
-  g = 0;
-  return 0;
-}
-
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: CovDump:

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc (removed)
@@ -1,41 +0,0 @@
-// Test __sanitizer_get_total_unique_coverage for caller-callee coverage
-
-// RUN: %clangxx_asan -fsanitize-coverage=4 %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1 %run %t
-// RUN: rm -f caller-callee*.sancov
-//
-// REQUIRES: asan-64-bits
-
-#include <sanitizer/coverage_interface.h>
-#include <stdio.h>
-#include <assert.h>
-int P = 0;
-struct Foo {virtual void f() {if (P) printf("Foo::f()\n");}};
-struct Foo1 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo2 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-
-Foo *foo[3] = {new Foo, new Foo1, new Foo2};
-
-uintptr_t CheckNewTotalUniqueCoverageIsLargerAndReturnIt(uintptr_t old_total) {
-  uintptr_t new_total = __sanitizer_get_total_unique_coverage();
-  assert(new_total > old_total);
-  return new_total;
-}
-
-int main(int argc, char **argv) {
-  uintptr_t total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(0);
-  foo[0]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-  foo[1]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-  foo[2]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-  // Ok, called every function once.
-  // Now call them again from another call site. Should get new coverage.
-  foo[0]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-  foo[1]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-  foo[2]->f();
-  total = CheckNewTotalUniqueCoverageIsLargerAndReturnIt(total);
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-caller-callee.cc (removed)
@@ -1,74 +0,0 @@
-// Test caller-callee coverage with large number of threads
-// and various numbers of callers and callees.
-
-// RUN: %clangxx_asan -fsanitize-coverage=4 %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 10 1 2>&1 | FileCheck %s --check-prefix=CHECK-10-1
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 9  2 2>&1 | FileCheck %s --check-prefix=CHECK-9-2
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 7  3 2>&1 | FileCheck %s --check-prefix=CHECK-7-3
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 17 1 2>&1 | FileCheck %s --check-prefix=CHECK-17-1
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 15 2 2>&1 | FileCheck %s --check-prefix=CHECK-15-2
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 18 3 2>&1 | FileCheck %s --check-prefix=CHECK-18-3
-// RUN: rm -f caller-callee*.sancov
-//
-// REQUIRES: asan-64-bits
-//
-// CHECK-10-1: CovDump: 10 caller-callee pairs written
-// CHECK-9-2: CovDump: 18 caller-callee pairs written
-// CHECK-7-3: CovDump: 21 caller-callee pairs written
-// CHECK-17-1: CovDump: 14 caller-callee pairs written
-// CHECK-15-2: CovDump: 28 caller-callee pairs written
-// CHECK-18-3: CovDump: 42 caller-callee pairs written
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-int P = 0;
-struct Foo {virtual void f() {if (P) printf("Foo::f()\n");}};
-struct Foo1 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo2 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo3 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo4 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo5 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo6 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo7 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo8 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo9 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo10 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo11 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo12 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo13 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo14 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo15 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo16 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo17 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo18 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-struct Foo19 : Foo {virtual void f() {if (P) printf("%d\n", __LINE__);}};
-
-Foo *foo[20] = {
-    new Foo,   new Foo1,  new Foo2,  new Foo3,  new Foo4,  new Foo5,  new Foo6,
-    new Foo7,  new Foo8,  new Foo9,  new Foo10, new Foo11, new Foo12, new Foo13,
-    new Foo14, new Foo15, new Foo16, new Foo17, new Foo18, new Foo19,
-};
-
-int n_functions = 10;
-int n_callers = 2;
-
-void *Thread(void *arg) {
-  if (n_callers >= 1) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();
-  if (n_callers >= 2) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();
-  if (n_callers >= 3) for (int i = 0; i < 2000; i++) foo[i % n_functions]->f();
-  return arg;
-}
-
-int main(int argc, char **argv) {
-  if (argc >= 2)
-    n_functions = atoi(argv[1]);
-  if (argc >= 3)
-    n_callers = atoi(argv[2]);
-  const int kNumThreads = 16;
-  pthread_t t[kNumThreads];
-  for (int i = 0; i < kNumThreads; i++)
-    pthread_create(&t[i], 0, Thread, 0);
-  for (int i = 0; i < kNumThreads; i++)
-    pthread_join(t[i], 0);
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-disabled.cc (removed)
@@ -1,20 +0,0 @@
-// Test that no data is collected without a runtime flag.
-//
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-//
-// RUN: rm -rf %T/coverage-disabled
-//
-// RUN: mkdir -p %T/coverage-disabled/normal
-// RUN: ASAN_OPTIONS=coverage_direct=0:coverage_dir=%T/coverage-disabled/normal:verbosity=1 %run %t
-// RUN: not %sancov print %T/coverage-disabled/normal/*.sancov 2>&1
-//
-// RUN: mkdir -p %T/coverage-disabled/direct
-// RUN: ASAN_OPTIONS=coverage_direct=1:coverage_dir=%T/coverage-disabled/direct:verbosity=1 %run %t
-// RUN: cd %T/coverage-disabled/direct
-// RUN: not %sancov rawunpack *.sancov
-//
-// XFAIL: android
-
-int main(int argc, char **argv) {
-  return 0;
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-fork.cc (removed)
@@ -1,38 +0,0 @@
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-// RUN: export ASAN_OPTIONS=coverage=1:coverage_direct=0:verbosity=1
-// RUN: rm -rf %T/coverage-fork
-// RUN: mkdir -p %T/coverage-fork && cd %T/coverage-fork
-// RUN: %run %t 2>&1 | FileCheck %s
-//
-// XFAIL: android
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-__attribute__((noinline))
-void foo() { printf("foo\n"); }
-
-__attribute__((noinline))
-void bar() { printf("bar\n"); }
-
-__attribute__((noinline))
-void baz() { printf("baz\n"); }
-
-int main(int argc, char **argv) {
-  pid_t child_pid = fork();
-  if (child_pid == 0) {
-    fprintf(stderr, "Child PID: %d\n", getpid());
-    baz();
-  } else {
-    fprintf(stderr, "Parent PID: %d\n", getpid());
-    foo();
-    bar();
-  }
-  return 0;
-}
-
-// CHECK-DAG: Child PID: [[ChildPID:[0-9]+]]
-// CHECK-DAG: [[ChildPID]].sancov: 1 PCs written
-// CHECK-DAG: Parent PID: [[ParentPID:[0-9]+]]
-// CHECK-DAG: [[ParentPID]].sancov: 3 PCs written

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-levels.cc (removed)
@@ -1,34 +0,0 @@
-// Test various levels of coverage
-//
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=1  %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=2  %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=3  %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=3 -mllvm -sanitizer-coverage-block-threshold=0 %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=3 -mllvm -sanitizer-coverage-8bit-counters=1 %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1:coverage_counters=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK_COUNTERS
-
-// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=0:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOBITSET
-// RUN: ASAN_OPTIONS=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOBITSET
-// RUN: ASAN_OPTIONS=coverage=1:coverage_pcs=0:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOPCS
-//
-// REQUIRES: asan-64-bits
-
-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 3 bits written for '{{.*}}', 2 bits are set
-// CHECK2:  2 PCs written
-// CHECK3: CovDump: bitset of 4 bits written for '{{.*}}', 3 bits are set
-// CHECK3:  3 PCs written
-// CHECK3_NOBITSET-NOT: bitset of
-// CHECK3_NOPCS-NOT: PCs written
-// CHECK_COUNTERS: CovDump: 4 counters written for

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-maybe-open-file.cc (removed)
@@ -1,31 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// XFAIL: android
-//
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-// RUN: rm -rf %T/coverage-maybe-open-file
-// RUN: mkdir -p %T/coverage-maybe-open-file && cd %T/coverage-maybe-open-file
-// RUN: ASAN_OPTIONS=coverage=1 %run %t | FileCheck %s --check-prefix=CHECK-success
-// RUN: ASAN_OPTIONS=coverage=0 %run %t | FileCheck %s --check-prefix=CHECK-fail
-// RUN: [ "$(cat test.sancov.packed)" == "test" ]
-// RUN: cd .. && rm -rf %T/coverage-maybe-open-file
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sanitizer/coverage_interface.h>
-
-int main(int argc, char **argv) {
-  int fd = __sanitizer_maybe_open_cov_file("test");
-  if (fd > 0) {
-    printf("SUCCESS\n");
-    const char s[] = "test\n";
-    write(fd, s, strlen(s));
-    close(fd);
-  } else {
-    printf("FAIL\n");
-  }
-}
-
-// CHECK-success: SUCCESS
-// CHECK-fail: FAIL

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-order-pcs.cc (removed)
@@ -1,56 +0,0 @@
-// Test coverage_order_pcs=1 flag which orders the PCs by their appearance.
-// RUN: DIR=%T/coverage-order-pcs
-// RUN: rm -rf $DIR
-// RUN: mkdir $DIR
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-// RUN: ASAN_OPTIONS=coverage_dir=$DIR:coverage=1:coverage_order_pcs=0 %t
-// RUN: mv $DIR/*sancov $DIR/A
-
-// RUN: ASAN_OPTIONS=coverage_dir=$DIR:coverage=1:coverage_order_pcs=0 %t 1
-// RUN: mv $DIR/*sancov $DIR/B
-
-// RUN: ASAN_OPTIONS=coverage_dir=$DIR:coverage=1:coverage_order_pcs=1 %t
-// RUN: mv $DIR/*sancov $DIR/C
-
-// RUN: ASAN_OPTIONS=coverage_dir=$DIR:coverage=1:coverage_order_pcs=1 %t 1
-// RUN: mv $DIR/*sancov $DIR/D
-//
-// RUN: (%sancov print $DIR/A; %sancov print $DIR/B; %sancov print $DIR/C; %sancov print $DIR/D) | FileCheck %s
-//
-// RUN: rm -rf $DIR
-// Ordering works only in 64-bit mode for now.
-// REQUIRES: asan-64-bits
-#include <stdio.h>
-
-void foo() { fprintf(stderr, "FOO\n"); }
-void bar() { fprintf(stderr, "BAR\n"); }
-
-int main(int argc, char **argv) {
-  if (argc == 2) {
-    foo();
-    bar();
-  } else {
-    bar();
-    foo();
-  }
-}
-
-// Run A: no ordering
-// CHECK: [[FOO:0x[0-9a-f]*]]
-// CHECK-NEXT: [[BAR:0x[0-9a-f]*]]
-// CHECK-NEXT: [[MAIN:0x[0-9a-f]*]]
-//
-// Run B: still no ordering
-// CHECK-NEXT: [[FOO]]
-// CHECK-NEXT: [[BAR]]
-// CHECK-NEXT: [[MAIN]]
-//
-// Run C: MAIN, BAR, FOO
-// CHECK-NEXT: [[MAIN]]
-// CHECK-NEXT: [[BAR]]
-// CHECK-NEXT: [[FOO]]
-//
-// Run D: MAIN, FOO, BAR
-// CHECK-NEXT: [[MAIN]]
-// CHECK-NEXT: [[FOO]]
-// CHECK-NEXT: [[BAR]]

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-reset.cc (removed)
@@ -1,52 +0,0 @@
-// Test __sanitizer_reset_coverage().
-
-// RUN: %clangxx_asan -fsanitize-coverage=1 %s -o %t
-// RUN: ASAN_OPTIONS=coverage=1 %run %t
-
-#include <sanitizer/coverage_interface.h>
-#include <stdio.h>
-#include <assert.h>
-static volatile int sink;
-__attribute__((noinline)) void bar() { sink = 2; }
-__attribute__((noinline)) void foo() { sink = 1; }
-
-#define GET_AND_PRINT_COVERAGE()                                       \
-  bitset = 0;                                                  \
-  for (size_t i = 0; i < n_guards; i++)                        \
-    if (guards[i]) bitset |= 1U << i;                          \
-  printf("line %d: bitset %zd total: %zd\n", __LINE__, bitset, \
-         __sanitizer_get_total_unique_coverage());
-
-#define IS_POWER_OF_TWO(a) ((a & ((a) - 1)) == 0)
-
-int main() {
-  size_t *guards = 0;
-  size_t bitset;
-  size_t n_guards = __sanitizer_get_coverage_guards(&guards);
-
-  GET_AND_PRINT_COVERAGE();
-  size_t main_bit = bitset;
-  assert(IS_POWER_OF_TWO(main_bit));
-
-  foo();
-  GET_AND_PRINT_COVERAGE();
-  size_t foo_bit = bitset & ~main_bit;
-  assert(IS_POWER_OF_TWO(foo_bit));
-
-  bar();
-  GET_AND_PRINT_COVERAGE();
-  size_t bar_bit = bitset & ~(main_bit | foo_bit);
-  assert(IS_POWER_OF_TWO(bar_bit));
-
-  __sanitizer_reset_coverage();
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == 0);
-
-  foo();
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == foo_bit);
-
-  bar();
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == (foo_bit | bar_bit));
-}

Removed: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc?rev=232807&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-tracing.cc (removed)
@@ -1,50 +0,0 @@
-// Test -mllvm -sanitizer-coverage-experimental-tracing
-//
-// RUN: %clangxx_asan -O1 -fsanitize-coverage=1 -mllvm -sanitizer-coverage-experimental-tracing %s -o %t
-// RUN: rm -rf   %T/coverage-tracing
-// RUN: mkdir %T/coverage-tracing
-// RUN: cd %T/coverage-tracing
-// RUN:  A=x;   ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK1; mv trace-points.*.sancov $A.points
-// RUN:  A=f;   ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK2; mv trace-points.*.sancov $A.points
-// RUN:  A=b;   ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK2; mv trace-points.*.sancov $A.points
-// RUN:  A=bf;  ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK3; mv trace-points.*.sancov $A.points
-// RUN:  A=fb;  ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK3; mv trace-points.*.sancov $A.points
-// RUN:  A=ffb; ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK4; mv trace-points.*.sancov $A.points
-// RUN:  A=fff; ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 1   2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK4; mv trace-points.*.sancov $A.points
-// RUN:  A=bbf; ASAN_OPTIONS=coverage=1:verbosity=1 %run %t $A 100 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK301; mv trace-points.*.sancov $A.points
-// RUN: diff f.points fff.points
-// RUN: diff bf.points fb.points
-// RUN: diff bf.points ffb.points
-// RUN: diff bf.points bbf.points
-// RUN: not diff x.points f.points
-// RUN: not diff x.points b.points
-// RUN: not diff x.points bf.points
-// RUN: not diff f.points b.points
-// RUN: not diff f.points bf.points
-// RUN: not diff b.points bf.points
-// RUN: rm -rf   %T/coverage-tracing
-//
-// REQUIRES: asan-64-bits
-
-#include <stdlib.h>
-volatile int sink;
-__attribute__((noinline)) void foo() { sink++; }
-__attribute__((noinline)) void bar() { sink++; }
-
-int main(int argc, char **argv) {
-  if (argc != 3) return 0;
-  int n = strtol(argv[2], 0, 10);
-  while (n-- > 0) {
-    for (int i = 0; argv[1][i]; i++) {
-      if (argv[1][i] == 'f') foo();
-      else if (argv[1][i] == 'b') bar();
-    }
-  }
-}
-
-// CHECK: CovDump: Trace: 3 PCs written
-// CHECK1: CovDump: Trace: 1 Events written
-// CHECK2: CovDump: Trace: 2 Events written
-// CHECK3: CovDump: Trace: 3 Events written
-// CHECK4: CovDump: Trace: 4 Events written
-// CHECK301: CovDump: Trace: 301 Events written





More information about the llvm-commits mailing list