1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/tools/llvm-size/totals.test
James Henderson 056055f8f6 [llvm-size][test] Improve llvm-size testing
This patch significantly improves the llvm-size testing. The changes
made are:

1) Change all tests to use yaml2obj instead of assembly or pre-canned
   inputs.
2) Move the tests out of the X86 directory, since they don't need to be
   there after 1).
3) Increased test coverage.
4) Added comments to explain purpose of tests.

I haven't attempted to add test coverage for all Mach-O related code, as
I am not familiar enough with that file format to be able to.

Reviewers: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D66134

llvm-svn: 368821
2019-08-14 10:17:34 +00:00

58 lines
1.5 KiB
Plaintext

## Show that llvm-size prints the total sizes when --totals is specified.
# RUN: rm -f %t.a
# RUN: yaml2obj %s --docnum=1 -o %t.o
# RUN: yaml2obj %s --docnum=2 -o %t2.o
# RUN: llvm-ar rc %t.a %t.o %t2.o
# RUN: llvm-size --totals %t.o %t.a %t2.o \
# RUN: | FileCheck %s -DFILE1=%t.o -DFILE2=%t2.o -DARCHIVE=%t.a
# RUN: llvm-size -t %t.o %t.a %t2.o \
# RUN: | FileCheck %s -DFILE1=%t.o -DFILE2=%t2.o -DARCHIVE=%t.a
# CHECK: text data bss dec hex filename
# CHECK-NEXT: [[FILE1]]
# CHECK-NEXT: {{.*}}.o (ex [[ARCHIVE]])
# CHECK-NEXT: {{.*}}2.o (ex [[ARCHIVE]])
# CHECK-NEXT: [[FILE2]]
# CHECK-NEXT: 18 36 72 126 7e (TOTALS)
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Size: 1
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 2
- Name: .bss
Type: SHT_NOBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 4
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Size: 8
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 16
- Name: .bss
Type: SHT_NOBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 32