]> granicus.if.org Git - llvm/commitdiff
llvm-profdata: Clean up and reorganize some tests
authorJustin Bogner <mail@justinbogner.com>
Tue, 29 Jul 2014 22:29:23 +0000 (22:29 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 29 Jul 2014 22:29:23 +0000 (22:29 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214235 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ProfileData/InstrProfReader.cpp
test/tools/llvm-profdata/Inputs/overflow.profdata [deleted file]
test/tools/llvm-profdata/hash-mismatch.profdata [new file with mode: 0644]
test/tools/llvm-profdata/lit.local.cfg [new file with mode: 0644]
test/tools/llvm-profdata/multiple-inputs.test [moved from test/tools/llvm-profdata/simple.test with 98% similarity]
test/tools/llvm-profdata/overflow.profdata [new file with mode: 0644]
test/tools/llvm-profdata/text-format-errors.test [moved from test/tools/llvm-profdata/errors.test with 69% similarity]

index 0b367282e14972244935097ce6620d1ae4326b4a..e8f64614df50a5a1e4c20ca4b30c710dce338eb1 100644 (file)
@@ -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())
diff --git a/test/tools/llvm-profdata/Inputs/overflow.profdata b/test/tools/llvm-profdata/Inputs/overflow.profdata
deleted file mode 100644 (file)
index c9a9d69..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-overflow
-1
-1
-9223372036854775808
diff --git a/test/tools/llvm-profdata/hash-mismatch.profdata b/test/tools/llvm-profdata/hash-mismatch.profdata
new file mode 100644 (file)
index 0000000..1263258
--- /dev/null
@@ -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
diff --git a/test/tools/llvm-profdata/lit.local.cfg b/test/tools/llvm-profdata/lit.local.cfg
new file mode 100644 (file)
index 0000000..33bc0a9
--- /dev/null
@@ -0,0 +1 @@
+config.suffixes.add('.profdata')
similarity index 98%
rename from test/tools/llvm-profdata/simple.test
rename to test/tools/llvm-profdata/multiple-inputs.test
index 18741dd2ba868f0e6b36e37c2a76419108b4722d..82d417e2b7b97ff684409c6f4591941607f6fb8d 100644 (file)
@@ -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
diff --git a/test/tools/llvm-profdata/overflow.profdata b/test/tools/llvm-profdata/overflow.profdata
new file mode 100644 (file)
index 0000000..62ced05
--- /dev/null
@@ -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
similarity index 69%
rename from test/tools/llvm-profdata/errors.test
rename to test/tools/llvm-profdata/text-format-errors.test
index 28262efe0638c9e2e5125f8466c800b224cd9818..870001f4816b6897afe7ecf9ac1b19d8b259b0a5 100644 (file)
@@ -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