diff options
Diffstat (limited to 'test/tools')
25 files changed, 409 insertions, 16 deletions
diff --git a/test/tools/llvm-cov/Inputs/range_based_for.gcda b/test/tools/llvm-cov/Inputs/range_based_for.gcda Binary files differnew file mode 100644 index 0000000..df51888 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/range_based_for.gcda diff --git a/test/tools/llvm-cov/Inputs/range_based_for.gcno b/test/tools/llvm-cov/Inputs/range_based_for.gcno Binary files differnew file mode 100644 index 0000000..5f30acf --- /dev/null +++ b/test/tools/llvm-cov/Inputs/range_based_for.gcno diff --git a/test/tools/llvm-cov/Inputs/test_long_file_names.output b/test/tools/llvm-cov/Inputs/test_long_file_names.output new file mode 100644 index 0000000..e09f4cb --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_long_file_names.output @@ -0,0 +1,8 @@ +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test_paths.cpp##test.h.gcov' + +File 'srcdir/./nested_dir/../test.cpp' +Lines executed:84.21% of 38 +srcdir/./nested_dir/../test.cpp:creating 'test_paths.cpp##test.cpp.gcov' + diff --git a/test/tools/llvm-cov/Inputs/test_long_paths.output b/test/tools/llvm-cov/Inputs/test_long_paths.output new file mode 100644 index 0000000..376ee5b --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_long_paths.output @@ -0,0 +1,8 @@ +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.h.gcov' + +File 'srcdir/./nested_dir/../test.cpp' +Lines executed:84.21% of 38 +srcdir/./nested_dir/../test.cpp:creating 'srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.cpp.gcov' + diff --git a/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov b/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov new file mode 100644 index 0000000..1c138e4 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov @@ -0,0 +1,77 @@ + -: 0:Source:srcdir/./nested_dir/../test.cpp + -: 0:Graph:test_paths.gcno + -: 0:Data:test_paths.gcda + -: 0:Runs:3 + -: 0:Programs:1 + -: 1:/*EOF*/ + -: 2:/*EOF*/ + -: 3:/*EOF*/ + -: 4:/*EOF*/ + -: 5:/*EOF*/ + -: 6:/*EOF*/ + -: 7:/*EOF*/ + -: 8:/*EOF*/ + -: 9:/*EOF*/ +12884901888: 10:/*EOF*/ + -: 11:/*EOF*/ + #####: 12:/*EOF*/ + -: 13:/*EOF*/ + -: 14:/*EOF*/ + #####: 15:/*EOF*/ + -: 16:/*EOF*/ + -: 17:/*EOF*/ + -: 18:/*EOF*/ + 3: 19:/*EOF*/ + 3: 20:/*EOF*/ + -: 21:/*EOF*/ + -: 22:/*EOF*/ + -: 23:/*EOF*/ + #####: 24:/*EOF*/ + #####: 25:/*EOF*/ + -: 26:/*EOF*/ + -: 27:/*EOF*/ + 12: 28:/*EOF*/ + 12: 29:/*EOF*/ + 12: 30:/*EOF*/ + -: 31:/*EOF*/ + -: 32:/*EOF*/ + 21: 33:/*EOF*/ + 36: 34:/*EOF*/ + 18: 35:/*EOF*/ + 3: 36:/*EOF*/ + -: 37:/*EOF*/ + -: 38:/*EOF*/ + 3: 39:/*EOF*/ + -: 40:/*EOF*/ + 3: 41:/*EOF*/ + 3: 42:/*EOF*/ + 3: 43:/*EOF*/ + 3: 44:/*EOF*/ + 3: 45:/*EOF*/ + 3: 46:/*EOF*/ + #####: 47:/*EOF*/ + #####: 48:/*EOF*/ + -: 49:/*EOF*/ + -: 50:/*EOF*/ + 66: 51:/*EOF*/ + 30: 52:/*EOF*/ + -: 53:/*EOF*/ + 6: 54:/*EOF*/ + 6: 55:/*EOF*/ + -: 56:/*EOF*/ + -: 57:/*EOF*/ + 3: 58:/*EOF*/ + 3: 59:/*EOF*/ + -: 60:/*EOF*/ + 9: 61:/*EOF*/ + 9: 62:/*EOF*/ + -: 63:/*EOF*/ + 12: 64:/*EOF*/ + 12: 65:/*EOF*/ + 30: 66:/*EOF*/ + -: 67:/*EOF*/ + 3: 68:/*EOF*/ +25769803782: 69:/*EOF*/ +12884901888: 70:/*EOF*/ + -: 71:/*EOF*/ + 3: 72:/*EOF*/ diff --git a/test/tools/llvm-cov/Inputs/test_missing.h.gcov b/test/tools/llvm-cov/Inputs/test_missing.h.gcov new file mode 100644 index 0000000..d500e86 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_missing.h.gcov @@ -0,0 +1,6 @@ + -: 0:Source:srcdir/./nested_dir/../test.h + -: 0:Graph:test_paths.gcno + -: 0:Data:test_paths.gcda + -: 0:Runs:3 + -: 0:Programs:1 + 6: 1:/*EOF*/ diff --git a/test/tools/llvm-cov/Inputs/test_missing.output b/test/tools/llvm-cov/Inputs/test_missing.output new file mode 100644 index 0000000..ada0c36 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_missing.output @@ -0,0 +1,8 @@ +File 'srcdir/./nested_dir/../test.h' +Lines executed:100.00% of 1 +srcdir/./nested_dir/../test.h:creating 'test.h.gcov' + +File 'srcdir/./nested_dir/../test.cpp' +Lines executed:84.21% of 38 +srcdir/./nested_dir/../test.cpp:creating 'test.cpp.gcov' + diff --git a/test/tools/llvm-cov/Inputs/test_no_output.output b/test/tools/llvm-cov/Inputs/test_no_output.output new file mode 100644 index 0000000..74286b9 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_no_output.output @@ -0,0 +1,6 @@ +File 'test.cpp' +Lines executed:84.21% of 38 + +File './test.h' +Lines executed:100.00% of 1 + diff --git a/test/tools/llvm-cov/lit.local.cfg b/test/tools/llvm-cov/lit.local.cfg index f738810..56c6f1f 100644 --- a/test/tools/llvm-cov/lit.local.cfg +++ b/test/tools/llvm-cov/lit.local.cfg @@ -1 +1 @@ -config.suffixes = ['.test', '.m'] +config.suffixes = ['.test', '.m', '.cpp'] diff --git a/test/tools/llvm-cov/llvm-cov.test b/test/tools/llvm-cov/llvm-cov.test index 19d3e5d..2345f8d 100644 --- a/test/tools/llvm-cov/llvm-cov.test +++ b/test/tools/llvm-cov/llvm-cov.test @@ -31,6 +31,15 @@ RUN: llvm-cov -o objdir/test test.c | diff -u test_no_options.output - RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov RUN: diff -aub test_objdir.h.gcov test.h.gcov +# With gcov output disabled +RUN: llvm-cov -n test.c | diff -u test_no_output.output - + +# Missing source files. This test is fragile, as it depends on being +# run before we copy some sources into place in the next test. +RUN: llvm-cov test_paths.cpp 2>/dev/null | diff -u test_missing.output - +RUN: diff -aub test_missing.cpp.gcov test.cpp.gcov +RUN: diff -aub test_missing.h.gcov test.h.gcov + # Preserve paths. This mangles the output filenames. RUN: mkdir -p %t/srcdir/nested_dir RUN: cp test.cpp test.h %t/srcdir @@ -43,6 +52,16 @@ RUN: llvm-cov test_paths.cpp | diff -u test_no_preserve_paths.output - RUN: diff -aub test_paths.cpp.gcov test.cpp.gcov RUN: diff -aub test_paths.h.gcov test.h.gcov +# Long file names. +RUN: llvm-cov -l test_paths.cpp | diff -u test_long_file_names.output - +RUN: diff -aub test_paths.cpp.gcov test_paths.cpp##test.cpp.gcov +RUN: diff -aub test_paths.h.gcov test_paths.cpp##test.h.gcov + +# Long file names and preserve paths. +RUN: llvm-cov -lp -gcno test_paths.gcno -gcda test_paths.gcda srcdir/../test_paths.cpp | diff -u test_long_paths.output - +RUN: diff -aub test_paths.cpp.gcov srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.cpp.gcov +RUN: diff -aub test_paths.h.gcov srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.h.gcov + # Function summaries. This changes stdout, but not the gcov files. RUN: llvm-cov test.c -f | diff -u test_-f.output - RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov diff --git a/test/tools/llvm-cov/range_based_for.cpp b/test/tools/llvm-cov/range_based_for.cpp new file mode 100644 index 0000000..61f60f6 --- /dev/null +++ b/test/tools/llvm-cov/range_based_for.cpp @@ -0,0 +1,29 @@ +// Make sure that compiler-added local variables (whose line number is zero) +// don't crash llvm-cov. + +// We need shell for cd +// REQUIRES: shell + +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: cd %t +// RUN: cp %s %p/Inputs/range_based_for.gc* . + +// RUN: llvm-cov range_based_for.cpp | FileCheck %s --check-prefix=STDOUT +// STDOUT: File 'range_based_for.cpp' +// STDOUT: Lines executed:100.00% of 5 +// STDOUT: range_based_for.cpp:creating 'range_based_for.cpp.gcov' + +// RUN: FileCheck %s --check-prefix=GCOV < %t/range_based_for.cpp.gcov +// GCOV: -: 0:Runs:1 +// GCOV: -: 0:Programs:1 + +int main(int argc, const char *argv[]) { // GCOV: 1: [[@LINE]]:int main( + int V[] = {1, 2}; // GCOV: 1: [[@LINE]]: int V[] + for (int &I : V) { // GCOV: 10: [[@LINE]]: for ( + } // GCOV: 2: [[@LINE]]: } + return 0; // GCOV: 1: [[@LINE]]: return +} // GCOV: -: [[@LINE]]:} + +// llvm-cov doesn't work on big endian yet +// XFAIL: powerpc64, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-objdump/Inputs/file-aux-record.yaml b/test/tools/llvm-objdump/Inputs/file-aux-record.yaml new file mode 100644 index 0000000..d19afaf --- /dev/null +++ b/test/tools/llvm-objdump/Inputs/file-aux-record.yaml @@ -0,0 +1,21 @@ +header: !Header + Machine: IMAGE_FILE_MACHINE_I386 # (0x14c) + Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ] +sections: +symbols: + - !Symbol + Name: .file + Value: 0 + SectionNumber: 65534 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_FILE + File: eighteen-chars.obj + - !Symbol + Name: '@comp.id' + Value: 13485607 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + diff --git a/test/tools/llvm-objdump/Inputs/file.obj.coff-arm b/test/tools/llvm-objdump/Inputs/file.obj.coff-arm Binary files differnew file mode 100755 index 0000000..a333a87 --- /dev/null +++ b/test/tools/llvm-objdump/Inputs/file.obj.coff-arm diff --git a/test/tools/llvm-objdump/coff-file.test b/test/tools/llvm-objdump/coff-file.test new file mode 100644 index 0000000..75d02b8 --- /dev/null +++ b/test/tools/llvm-objdump/coff-file.test @@ -0,0 +1,6 @@ +RUN: llvm-objdump -t %p/Inputs/file.obj.coff-arm | FileCheck %s + +CHECK: .file +CHECK-NEXT: AUX /Users/compnerd/work/llvm/test/tools/llvm-readobj/Inputs/file.asm +CHECK-NEXT: [{{[ 0-9]+}}] + diff --git a/test/tools/llvm-objdump/coff-non-null-terminated-file.test b/test/tools/llvm-objdump/coff-non-null-terminated-file.test new file mode 100644 index 0000000..125994f --- /dev/null +++ b/test/tools/llvm-objdump/coff-non-null-terminated-file.test @@ -0,0 +1,5 @@ +RUN: yaml2obj %p/Inputs/file-aux-record.yaml | llvm-objdump -t - | FileCheck %s + +CHECK: .file +CHECK: AUX eighteen-chars.obj{{$}} + diff --git a/test/tools/llvm-profdata/Inputs/no-counts.profdata b/test/tools/llvm-profdata/Inputs/no-counts.profdata new file mode 100644 index 0000000..5c1fa15 --- /dev/null +++ b/test/tools/llvm-profdata/Inputs/no-counts.profdata @@ -0,0 +1,3 @@ +no_counts +0 +0 diff --git a/test/tools/llvm-profdata/errors.test b/test/tools/llvm-profdata/errors.test index 6ccb084..28262ef 100644 --- a/test/tools/llvm-profdata/errors.test +++ b/test/tools/llvm-profdata/errors.test @@ -1,13 +1,16 @@ -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata -o /dev/null 2>&1 | FileCheck %s --check-prefix=HASH +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 /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW +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 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 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 diff --git a/test/tools/llvm-profdata/raw-two-profiles.test b/test/tools/llvm-profdata/raw-two-profiles.test new file mode 100644 index 0000000..3260836 --- /dev/null +++ b/test/tools/llvm-profdata/raw-two-profiles.test @@ -0,0 +1,64 @@ +RUN: printf '\201rforpl\377' > %t-foo.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\3\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw +RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw + +RUN: printf '\3\0\0\0' >> %t-foo.profraw +RUN: printf '\1\0\0\0' >> %t-foo.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw +RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw + +RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw +RUN: printf 'foo' >> %t-foo.profraw + +RUN: printf '\201rforpl\377' > %t-bar.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\3\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw +RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw + +RUN: printf '\3\0\0\0' >> %t-bar.profraw +RUN: printf '\2\0\0\0' >> %t-bar.profraw +RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw +RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw + +RUN: printf '\067\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw +RUN: printf 'bar' >> %t-bar.profraw + +Versions of the profiles that are padded to eight byte alignment. +RUN: cat %t-foo.profraw > %t-foo-padded.profraw +RUN: printf '\0\0\0\0\0' >> %t-foo-padded.profraw +RUN: cat %t-bar.profraw > %t-bar-padded.profraw +RUN: printf '\0\0\0\0\0' >> %t-bar-padded.profraw + +RUN: cat %t-foo.profraw %t-bar.profraw > %t-nopad.profraw +RUN: cat %t-foo-padded.profraw %t-bar.profraw > %t-pad-between.profraw +RUN: cat %t-foo-padded.profraw %t-bar-padded.profraw > %t-pad.profraw + +RUN: llvm-profdata show %t-nopad.profraw -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t-pad-between.profraw -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s + +CHECK: Counters: +CHECK: foo: +CHECK: Hash: 0x0000000000000001 +CHECK: Counters: 1 +CHECK: Function count: 19 +CHECK: Block counts: [] +CHECK: bar: +CHECK: Hash: 0x0000000000000002 +CHECK: Counters: 2 +CHECK: Function count: 55 +CHECK: Block counts: [65] +CHECK: Functions shown: 2 +CHECK: Total functions: 2 +CHECK: Maximum function count: 55 +CHECK: Maximum internal block count: 65 diff --git a/test/tools/llvm-profdata/simple.test b/test/tools/llvm-profdata/simple.test index 97dda5a..18741dd 100644 --- a/test/tools/llvm-profdata/simple.test +++ b/test/tools/llvm-profdata/simple.test @@ -1,5 +1,7 @@ -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3 -RUN: llvm-profdata merge %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3 +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 @@ -8,8 +10,10 @@ 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 | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO4 -RUN: llvm-profdata merge %p/Inputs/foo4-2.profdata %p/Inputs/foo4-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO4 +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 @@ -18,8 +22,10 @@ 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 | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3 -RUN: llvm-profdata merge %p/Inputs/foo3bar3-2.profdata %p/Inputs/foo3bar3-1.profdata | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3 +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 @@ -32,7 +38,8 @@ 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 | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY +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 @@ -41,7 +48,8 @@ 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 | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 +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 @@ -54,7 +62,8 @@ 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 | llvm-profdata show - -all-functions -counts | FileCheck %s --check-prefix=DISJOINT +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 diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table-exe.x86 b/test/tools/llvm-readobj/Inputs/dynamic-table-exe.x86 Binary files differnew file mode 100755 index 0000000..4edbe58 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/dynamic-table-exe.x86 diff --git a/test/tools/llvm-readobj/Inputs/file-aux-record.yaml b/test/tools/llvm-readobj/Inputs/file-aux-record.yaml new file mode 100644 index 0000000..d19afaf --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/file-aux-record.yaml @@ -0,0 +1,21 @@ +header: !Header + Machine: IMAGE_FILE_MACHINE_I386 # (0x14c) + Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ] +sections: +symbols: + - !Symbol + Name: .file + Value: 0 + SectionNumber: 65534 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_FILE + File: eighteen-chars.obj + - !Symbol + Name: '@comp.id' + Value: 13485607 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + diff --git a/test/tools/llvm-readobj/Inputs/file-multiple-aux-records.yaml b/test/tools/llvm-readobj/Inputs/file-multiple-aux-records.yaml new file mode 100644 index 0000000..8d8f684 --- /dev/null +++ b/test/tools/llvm-readobj/Inputs/file-multiple-aux-records.yaml @@ -0,0 +1,21 @@ +header: !Header + Machine: IMAGE_FILE_MACHINE_I386 # (0x14c) + Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ] +sections: +symbols: + - !Symbol + Name: .file + Value: 0 + SectionNumber: 65534 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_FILE + File: first-section-has-eighteen-characters.asm + - !Symbol + Name: '@comp.id' + Value: 13485607 + SectionNumber: 65535 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_STATIC + diff --git a/test/tools/llvm-readobj/coff-file-sections-reading.test b/test/tools/llvm-readobj/coff-file-sections-reading.test new file mode 100644 index 0000000..5c44c16 --- /dev/null +++ b/test/tools/llvm-readobj/coff-file-sections-reading.test @@ -0,0 +1,18 @@ +RUN: yaml2obj %p/Inputs/file-multiple-aux-records.yaml | llvm-readobj -t - | FileCheck %s + +CHECK: Symbols [ +CHECK: Symbol { +CHECK: Name: .file +CHECK: Value: 0 +CHECK: Section: (65534) +CHECK: BaseType: Null (0x0) +CHECK: ComplexType: Null (0x0) +CHECK: StorageClass: File (0x67) +CHECK: AuxSymbolCount: 3 +CHECK: AuxFileRecord { +CHECK: FileName: first-section-has-eighteen-characters.asm +CHECK: } +CHECK-NOT: AuxFileRecord { +CHECK: } +CHECK: ] + diff --git a/test/tools/llvm-readobj/coff-non-null-terminated-file.test b/test/tools/llvm-readobj/coff-non-null-terminated-file.test new file mode 100644 index 0000000..8bd88f3 --- /dev/null +++ b/test/tools/llvm-readobj/coff-non-null-terminated-file.test @@ -0,0 +1,20 @@ +RUN: yaml2obj %p/Inputs/file-aux-record.yaml | llvm-readobj -t - | FileCheck %s + +CHECK: Symbols [ +CHECK: Symbol { +CHECK: Name: .file +CHECK: Value: 0 +CHECK: StorageClass: File +CHECK: AuxSymbolCount: 1 +CHECK: AuxFileRecord { +CHECK: FileName: eighteen-chars.obj{{$}} +CHECK: } +CHECK: } +CHECK: Symbol { +CHECK: Name: @comp.id +CHECK: Value: 13485607 +CHECK: StorageClass: Static +CHECK: AuxSymbolCount: 0 +CHECK: } +CHECK: ] + diff --git a/test/tools/llvm-readobj/dynamic.test b/test/tools/llvm-readobj/dynamic.test index 6a5fe95..08f29fc 100644 --- a/test/tools/llvm-readobj/dynamic.test +++ b/test/tools/llvm-readobj/dynamic.test @@ -21,7 +21,7 @@ ELF-MIPS: 0x00000011 REL 0x518 ELF-MIPS: 0x00000012 RELSZ 16 (bytes) ELF-MIPS: 0x00000013 RELENT 8 (bytes) ELF-MIPS: 0x70000001 MIPS_RLD_VERSION 1 -ELF-MIPS: 0x70000005 MIPS_FLAGS 0x2 +ELF-MIPS: 0x70000005 MIPS_FLAGS NOTPOT ELF-MIPS: 0x70000006 MIPS_BASE_ADDRESS 0x0 ELF-MIPS: 0x7000000A MIPS_LOCAL_GOTNO 10 ELF-MIPS: 0x70000011 MIPS_SYMTABNO 19 @@ -55,7 +55,7 @@ ELF-MIPS-EXE: 0x70000016 MIPS_RLD_MAP 0x410880 ELF-MIPS-EXE: 0x00000015 DEBUG 0x0 ELF-MIPS-EXE: 0x00000003 PLTGOT 0x410890 ELF-MIPS-EXE: 0x70000001 MIPS_RLD_VERSION 1 -ELF-MIPS-EXE: 0x70000005 MIPS_FLAGS 0x2 +ELF-MIPS-EXE: 0x70000005 MIPS_FLAGS NOTPOT ELF-MIPS-EXE: 0x70000006 MIPS_BASE_ADDRESS 0x400000 ELF-MIPS-EXE: 0x7000000A MIPS_LOCAL_GOTNO 5 ELF-MIPS-EXE: 0x70000011 MIPS_SYMTABNO 8 @@ -70,3 +70,44 @@ ELF-MIPS-EXE: 0x6FFFFFFF VERNEEDNUM 1 ELF-MIPS-EXE: 0x6FFFFFF0 VERSYM 0x4003D8 ELF-MIPS-EXE: 0x00000000 NULL 0x0 ELF-MIPS-EXE: ] + +RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-exe.x86 \ +RUN: | FileCheck %s -check-prefix ELF-X86-EXE + +ELF-X86-EXE: Format: ELF32-i386 +ELF-X86-EXE: Arch: i386 +ELF-X86-EXE: AddressSize: 32bit +ELF-X86-EXE: LoadName: +ELF-X86-EXE: DynamicSection [ (30 entries) +ELF-X86-EXE: Tag Type Name/Value +ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libstdc++.so.6) +ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libgcc_s.so.1) +ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6) +ELF-X86-EXE: 0x0000000C INIT 0x62C +ELF-X86-EXE: 0x0000000D FINI 0x920 +ELF-X86-EXE: 0x00000019 INIT_ARRAY 0x19FC +ELF-X86-EXE: 0x0000001B INIT_ARRAYSZ 4 (bytes) +ELF-X86-EXE: 0x0000001A FINI_ARRAY 0x1A00 +ELF-X86-EXE: 0x0000001C FINI_ARRAYSZ 4 (bytes) +ELF-X86-EXE: 0x00000004 HASH 0x18C +ELF-X86-EXE: 0x6FFFFEF5 GNU_HASH 0x1E4 +ELF-X86-EXE: 0x00000005 STRTAB 0x328 +ELF-X86-EXE: 0x00000006 SYMTAB 0x218 +ELF-X86-EXE: 0x0000000A STRSZ 408 (bytes) +ELF-X86-EXE: 0x0000000B SYMENT 16 (bytes) +ELF-X86-EXE: 0x00000015 DEBUG 0x0 +ELF-X86-EXE: 0x00000003 PLTGOT 0x1B30 +ELF-X86-EXE: 0x00000002 PLTRELSZ 64 (bytes) +ELF-X86-EXE: 0x00000014 PLTREL REL +ELF-X86-EXE: 0x00000017 JMPREL 0x5EC +ELF-X86-EXE: 0x00000011 REL 0x564 +ELF-X86-EXE: 0x00000012 RELSZ 136 (bytes) +ELF-X86-EXE: 0x00000013 RELENT 8 (bytes) +ELF-X86-EXE: 0x00000016 TEXTREL +ELF-X86-EXE: 0x0000001E FLAGS TEXTREL +ELF-X86-EXE: 0x6FFFFFFE VERNEED 0x4E4 +ELF-X86-EXE: 0x6FFFFFFF VERNEEDNUM 3 +ELF-X86-EXE: 0x6FFFFFF0 VERSYM 0x4C0 +ELF-X86-EXE: 0x6FFFFFFA RELCOUNT 6 +ELF-X86-EXE: 0x00000000 NULL 0x0 +ELF-X86-EXE: ] |