1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

llvm-cov: Added test.h header to tests.

llvm-svn: 196632
This commit is contained in:
Yuchen Wu 2013-12-07 01:28:11 +00:00
parent ee5ebb655a
commit 0eb465520e
7 changed files with 86 additions and 80 deletions

View File

@ -1,3 +1,4 @@
#include "test.h"
#include <cstdlib> #include <cstdlib>
bool on = false; bool on = false;
@ -6,10 +7,6 @@ double grid[10][10] = {0};
const char * hello = "world"; const char * hello = "world";
const char * world = "hello"; const char * world = "hello";
struct A {
virtual void B();
};
void A::B() {} void A::B() {}
void useless() {} void useless() {}

View File

@ -3,80 +3,77 @@
-: 0:Data:test.gcda -: 0:Data:test.gcda
-: 0:Runs:2 -: 0:Runs:2
-: 0:Programs:1 -: 0:Programs:1
-: 1:#include <cstdlib> -: 1:#include "test.h"
-: 2: -: 2:#include <cstdlib>
-: 3:bool on = false; -: 3:
-: 4:int len = 42; -: 4:bool on = false;
-: 5:double grid[10][10] = {0}; -: 5:int len = 42;
-: 6:const char * hello = "world"; -: 6:double grid[10][10] = {0};
-: 7:const char * world = "hello"; -: 7:const char * hello = "world";
-: 8: -: 8:const char * world = "hello";
4: 9:struct A { -: 9:
-: 10: virtual void B(); 8589934592: 10:void A::B() {}
-: 11:}; -: 11:
-: 12: #####: 12:void useless() {}
8589934592: 13:void A::B() {} -: 13:
-: 14: -: 14:double more_useless() {
#####: 15:void useless() {} #####: 15: return 0;
-: 16: -: 16:}
-: 17:double more_useless() { -: 17:
#####: 18: return 0; -: 18:int foo() {
-: 19:} 2: 19: on = true;
-: 20: 2: 20: return 3;
-: 21:int foo() { -: 21:}
2: 22: on = true; -: 22:
2: 23: return 3; -: 23:int bar() {
-: 24:} #####: 24: len--;
-: 25: #####: 25: return foo() + 45;
-: 26:int bar() { -: 26:}
#####: 27: len--; -: 27:
#####: 28: return foo() + 45; 8: 28:void assign(int ii, int jj) {
-: 29:} 8: 29: grid[ii][jj] = (ii+1) * (jj+1);
-: 30: 8: 30:}
8: 31:void assign(int ii, int jj) { -: 31:
8: 32: grid[ii][jj] = (ii+1) * (jj+1); -: 32:void initialize_grid() {
8: 33:} 12: 33: for (int ii = 0; ii < 2; ii++)
-: 34: 24: 34: for (int jj = 0; jj < 2; jj++)
-: 35:void initialize_grid() { 12: 35: assign(ii, jj);
12: 36: for (int ii = 0; ii < 2; ii++) 2: 36:}
24: 37: for (int jj = 0; jj < 2; jj++) -: 37:
12: 38: assign(ii, jj); -: 38:int main() {
2: 39:} 2: 39: initialize_grid();
-: 40: -: 40:
-: 41:int main() { 2: 41: int a = 2;
2: 42: initialize_grid(); 2: 42: on = rand() % 2;
-: 43: 2: 43: if (on) {
2: 44: int a = 2; 2: 44: foo();
2: 45: on = rand() % 2; 2: 45: ++a;
2: 46: if (on) { 2: 46: } else {
2: 47: foo(); #####: 47: bar();
2: 48: ++a; #####: 48: a += rand();
2: 49: } else { -: 49: }
#####: 50: bar(); -: 50:
#####: 51: a += rand(); 44: 51: for (int ii = 0; ii < 10; ++ii) {
-: 52: } 20: 52: switch (rand() % 5) {
-: 53: -: 53: case 0:
44: 54: for (int ii = 0; ii < 10; ++ii) { 4: 54: a += rand();
20: 55: switch (rand() % 5) { 4: 55: break;
-: 56: case 0: -: 56: case 1:
4: 57: a += rand(); -: 57: case 2:
4: 58: break; 2: 58: a += rand() / rand();
-: 59: case 1: 2: 59: break;
-: 60: case 2: -: 60: case 3:
2: 61: a += rand() / rand(); 6: 61: a -= rand();
2: 62: break; 6: 62: break;
-: 63: case 3: -: 63: default:
6: 64: a -= rand(); 8: 64: a = -1;
6: 65: break; 8: 65: }
-: 66: default: 20: 66: }
8: 67: a = -1; -: 67:
8: 68: } 2: 68: A thing;
20: 69: } 17179869188: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
-: 70: 8589934592: 70: thing.B();
2: 71: A thing; -: 71:
17179869188: 72: for (uint64_t ii = 0; ii < 4294967296; ++ii) 2: 72: return a + 8 + grid[2][3] + len;
8589934592: 73: thing.B(); -: 73: return more_useless();
-: 74: -: 74:}
2: 75: return a + 8 + grid[2][3] + len;
-: 76: return more_useless();
-: 77:}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
struct A {
virtual void B();
};

View File

@ -0,0 +1,8 @@
-: 0:Source:./test.h
-: 0:Graph:test.gcno
-: 0:Data:test.gcda
-: 0:Runs:2
-: 0:Programs:1
4: 1:struct A {
-: 2: virtual void B();
-: 3:};

View File

@ -7,6 +7,7 @@ RUN: cp %p/Inputs/test* .
RUN: llvm-cov -gcno=test.gcno -gcda=test.gcda RUN: llvm-cov -gcno=test.gcno -gcda=test.gcda
RUN: diff -aub test.cpp.orig_gcov test.cpp.gcov RUN: diff -aub test.cpp.orig_gcov test.cpp.gcov
RUN: diff -aub test.h.orig_gcov test.h.gcov
RUN: not llvm-cov -gcno=test_read_fail.gcno -gcda=test.gcda RUN: not llvm-cov -gcno=test_read_fail.gcno -gcda=test.gcda