[llvm] r214235 - llvm-profdata: Clean up and reorganize some tests
Justin Bogner
mail at justinbogner.com
Tue Jul 29 15:29:23 PDT 2014
Author: bogner
Date: Tue Jul 29 17:29:23 2014
New Revision: 214235
URL: http://llvm.org/viewvc/llvm-project?rev=214235&view=rev
Log:
llvm-profdata: Clean up and reorganize some tests
This moves some tests around to make it clearer what's being tested,
and adds very rudimentary comment syntax to the text input format to
make specifying this kind of test a little bit simpler.
Added:
llvm/trunk/test/tools/llvm-profdata/hash-mismatch.profdata
llvm/trunk/test/tools/llvm-profdata/lit.local.cfg
llvm/trunk/test/tools/llvm-profdata/multiple-inputs.test
- copied, changed from r214234, llvm/trunk/test/tools/llvm-profdata/simple.test
llvm/trunk/test/tools/llvm-profdata/overflow.profdata
llvm/trunk/test/tools/llvm-profdata/text-format-errors.test
- copied, changed from r214234, llvm/trunk/test/tools/llvm-profdata/errors.test
Removed:
llvm/trunk/test/tools/llvm-profdata/Inputs/overflow.profdata
llvm/trunk/test/tools/llvm-profdata/errors.test
llvm/trunk/test/tools/llvm-profdata/simple.test
Modified:
llvm/trunk/lib/ProfileData/InstrProfReader.cpp
Modified: llvm/trunk/lib/ProfileData/InstrProfReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfReader.cpp?rev=214235&r1=214234&r2=214235&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProfReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProfReader.cpp Tue Jul 29 17:29:23 2014
@@ -83,8 +83,8 @@ void InstrProfIterator::Increment() {
}
std::error_code TextInstrProfReader::readNextRecord(InstrProfRecord &Record) {
- // Skip empty lines.
- while (!Line.is_at_end() && Line->empty())
+ // Skip empty lines and comments.
+ while (!Line.is_at_end() && (Line->empty() || Line->startswith("#")))
++Line;
// If we hit EOF while looking for a name, we're done.
if (Line.is_at_end())
Removed: llvm/trunk/test/tools/llvm-profdata/Inputs/overflow.profdata
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/Inputs/overflow.profdata?rev=214234&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/Inputs/overflow.profdata (original)
+++ llvm/trunk/test/tools/llvm-profdata/Inputs/overflow.profdata (removed)
@@ -1,4 +0,0 @@
-overflow
-1
-1
-9223372036854775808
Removed: llvm/trunk/test/tools/llvm-profdata/errors.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/errors.test?rev=214234&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/errors.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/errors.test (removed)
@@ -1,16 +0,0 @@
-RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=HASH
-HASH: foo4-1.profdata: foo: Function hash mismatch
-
-RUN: llvm-profdata merge %p/Inputs/overflow.profdata %p/Inputs/overflow.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=OVERFLOW
-OVERFLOW: overflow.profdata: overflow: Counter overflow
-
-RUN: not llvm-profdata show %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
-RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.profdata %p/Inputs/invalid-count-later.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
-INVALID-COUNT-LATER: error: {{.*}}invalid-count-later.profdata: Malformed profile data
-
-RUN: not llvm-profdata show %p/Inputs/bad-hash.profdata 2>&1 | FileCheck %s --check-prefix=BAD-HASH
-RUN: not llvm-profdata merge %p/Inputs/bad-hash.profdata %p/Inputs/bad-hash.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=BAD-HASH
-BAD-HASH: error: {{.*}}bad-hash.profdata: Malformed profile data
-
-RUN: not llvm-profdata show %p/Inputs/no-counts.profdata 2>&1 | FileCheck %s --check-prefix=NO-COUNTS
-NO-COUNTS: error: {{.*}}no-counts.profdata: Malformed profile data
Added: llvm/trunk/test/tools/llvm-profdata/hash-mismatch.profdata
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/hash-mismatch.profdata?rev=214235&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/hash-mismatch.profdata (added)
+++ llvm/trunk/test/tools/llvm-profdata/hash-mismatch.profdata Tue Jul 29 17:29:23 2014
@@ -0,0 +1,17 @@
+# RUN: llvm-profdata merge %s -o %t.out 2>&1 | FileCheck %s
+# CHECK: hash-mismatch.profdata: foo: Function hash mismatch
+
+foo
+3
+3
+1
+2
+3
+
+foo
+4
+4
+11
+22
+33
+44
Added: llvm/trunk/test/tools/llvm-profdata/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/lit.local.cfg?rev=214235&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/lit.local.cfg (added)
+++ llvm/trunk/test/tools/llvm-profdata/lit.local.cfg Tue Jul 29 17:29:23 2014
@@ -0,0 +1 @@
+config.suffixes.add('.profdata')
Copied: llvm/trunk/test/tools/llvm-profdata/multiple-inputs.test (from r214234, llvm/trunk/test/tools/llvm-profdata/simple.test)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/multiple-inputs.test?p2=llvm/trunk/test/tools/llvm-profdata/multiple-inputs.test&p1=llvm/trunk/test/tools/llvm-profdata/simple.test&r1=214234&r2=214235&rev=214235&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/simple.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/multiple-inputs.test Tue Jul 29 17:29:23 2014
@@ -1,3 +1,5 @@
+Some very basic tests for the multiple input cases.
+
RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata -o %t
RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3
RUN: llvm-profdata merge %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata -o %t
Added: llvm/trunk/test/tools/llvm-profdata/overflow.profdata
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/overflow.profdata?rev=214235&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/overflow.profdata (added)
+++ llvm/trunk/test/tools/llvm-profdata/overflow.profdata Tue Jul 29 17:29:23 2014
@@ -0,0 +1,12 @@
+# RUN: llvm-profdata merge %s -o %t.out 2>&1 | FileCheck %s
+# CHECK: overflow.profdata: overflow: Counter overflow
+
+overflow
+1
+1
+9223372036854775808
+
+overflow
+1
+1
+9223372036854775808
Removed: llvm/trunk/test/tools/llvm-profdata/simple.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/simple.test?rev=214234&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/simple.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/simple.test (removed)
@@ -1,77 +0,0 @@
-RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3
-RUN: llvm-profdata merge %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3
-FOO3: foo:
-FOO3: Counters: 3
-FOO3: Function count: 8
-FOO3: Block counts: [7, 6]
-FOO3: Total functions: 1
-FOO3: Maximum function count: 8
-FOO3: Maximum internal block count: 7
-
-RUN: llvm-profdata merge %p/Inputs/foo4-1.profdata %p/Inputs/foo4-2.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4
-RUN: llvm-profdata merge %p/Inputs/foo4-2.profdata %p/Inputs/foo4-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4
-FOO4: foo:
-FOO4: Counters: 4
-FOO4: Function count: 18
-FOO4: Block counts: [28, 38, 48]
-FOO4: Total functions: 1
-FOO4: Maximum function count: 18
-FOO4: Maximum internal block count: 48
-
-RUN: llvm-profdata merge %p/Inputs/foo3bar3-1.profdata %p/Inputs/foo3bar3-2.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3
-RUN: llvm-profdata merge %p/Inputs/foo3bar3-2.profdata %p/Inputs/foo3bar3-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3
-FOO3BAR3: foo:
-FOO3BAR3: Counters: 3
-FOO3BAR3: Function count: 19
-FOO3BAR3: Block counts: [22, 28]
-FOO3BAR3: bar:
-FOO3BAR3: Counters: 3
-FOO3BAR3: Function count: 36
-FOO3BAR3: Block counts: [42, 50]
-FOO3BAR3: Total functions: 2
-FOO3BAR3: Maximum function count: 36
-FOO3BAR3: Maximum internal block count: 50
-
-RUN: llvm-profdata merge %p/Inputs/empty.profdata %p/Inputs/foo3-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY
-FOO3EMPTY: foo:
-FOO3EMPTY: Counters: 3
-FOO3EMPTY: Function count: 1
-FOO3EMPTY: Block counts: [2, 3]
-FOO3EMPTY: Total functions: 1
-FOO3EMPTY: Maximum function count: 1
-FOO3EMPTY: Maximum internal block count: 3
-
-RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3bar3-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3
-FOO3FOO3BAR3: foo:
-FOO3FOO3BAR3: Counters: 3
-FOO3FOO3BAR3: Function count: 3
-FOO3FOO3BAR3: Block counts: [5, 8]
-FOO3FOO3BAR3: bar:
-FOO3FOO3BAR3: Counters: 3
-FOO3FOO3BAR3: Function count: 7
-FOO3FOO3BAR3: Block counts: [11, 13]
-FOO3FOO3BAR3: Total functions: 2
-FOO3FOO3BAR3: Maximum function count: 7
-FOO3FOO3BAR3: Maximum internal block count: 13
-
-RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/bar3-1.profdata -o %t
-RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT
-DISJOINT: foo:
-DISJOINT: Counters: 3
-DISJOINT: Function count: 1
-DISJOINT: Block counts: [2, 3]
-DISJOINT: bar:
-DISJOINT: Counters: 3
-DISJOINT: Function count: 1
-DISJOINT: Block counts: [2, 3]
-DISJOINT: Total functions: 2
-DISJOINT: Maximum function count: 1
-DISJOINT: Maximum internal block count: 3
Copied: llvm/trunk/test/tools/llvm-profdata/text-format-errors.test (from r214234, llvm/trunk/test/tools/llvm-profdata/errors.test)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/text-format-errors.test?p2=llvm/trunk/test/tools/llvm-profdata/text-format-errors.test&p1=llvm/trunk/test/tools/llvm-profdata/errors.test&r1=214234&r2=214235&rev=214235&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/errors.test (original)
+++ llvm/trunk/test/tools/llvm-profdata/text-format-errors.test Tue Jul 29 17:29:23 2014
@@ -1,9 +1,3 @@
-RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=HASH
-HASH: foo4-1.profdata: foo: Function hash mismatch
-
-RUN: llvm-profdata merge %p/Inputs/overflow.profdata %p/Inputs/overflow.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=OVERFLOW
-OVERFLOW: overflow.profdata: overflow: Counter overflow
-
RUN: not llvm-profdata show %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.profdata %p/Inputs/invalid-count-later.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER
INVALID-COUNT-LATER: error: {{.*}}invalid-count-later.profdata: Malformed profile data
More information about the llvm-commits
mailing list