## Test how we output JSON file summaries.
# RUN: rm -rf %t.dir
# RUN: mkdir -p %t.dir
# RUN: yaml2obj %s -o %t.dir/obj
## Test outputting file summary for a single file.
# RUN: llvm-readobj --elf-output-style=JSON --pretty-print %t.dir/obj | \
# RUN: FileCheck %s --check-prefix=SINGLE \
# RUN: --match-full-lines --strict-whitespace --implicit-check-not={{.}}
# SINGLE:[
# SINGLE-NEXT: {
# SINGLE-NEXT: "FileSummary": {
# SINGLE-NEXT: "File": "{{.*}}/obj",
# SINGLE-NEXT: "Format": "elf64-x86-64",
# SINGLE-NEXT: "Arch": "x86_64",
# SINGLE-NEXT: "AddressSize": "64bit",
# SINGLE-NEXT: "LoadName": "<Not found>"
# SINGLE-NEXT: }
# SINGLE-NEXT: }
# SINGLE-NEXT:]
## Test outputting file summary for multiple files.
# RUN: llvm-readobj --elf-output-style=JSON --pretty-print %t.dir/obj %t.dir/obj | \
# RUN: FileCheck %s --check-prefix=MULTI \
# RUN: --match-full-lines --strict-whitespace --implicit-check-not={{.}}
# MULTI:[
# MULTI-NEXT: {
# MULTI-NEXT: "FileSummary": {
# MULTI-NEXT: "File": "{{.*}}/obj",
# MULTI-NEXT: "Format": "elf64-x86-64",
# MULTI-NEXT: "Arch": "x86_64",
# MULTI-NEXT: "AddressSize": "64bit",
# MULTI-NEXT: "LoadName": "<Not found>"
# MULTI-NEXT: }
# MULTI-NEXT: },
# MULTI-NEXT: {
# MULTI-NEXT: "FileSummary": {
# MULTI-NEXT: "File": "{{.*}}/obj",
# MULTI-NEXT: "Format": "elf64-x86-64",
# MULTI-NEXT: "Arch": "x86_64",
# MULTI-NEXT: "AddressSize": "64bit",
# MULTI-NEXT: "LoadName": "<Not found>"
# MULTI-NEXT: }
# MULTI-NEXT: }
# MULTI-NEXT:]
## Test outputting file summary for an archive with a single file.
# RUN: rm -f %t.archive-single
# RUN: llvm-ar rc %t.archive-single %t.dir/obj
# RUN: llvm-readobj --elf-output-style=JSON --pretty-print %t.archive-single | \
# RUN: FileCheck %s --check-prefix=ARCH-SINGLE \
# RUN: --match-full-lines --strict-whitespace --implicit-check-not={{.}}
# ARCH-SINGLE:[
# ARCH-SINGLE-NEXT: {
# ARCH-SINGLE-NEXT: "FileSummary": {
# ARCH-SINGLE-NEXT: "File": "{{.*}}.archive-single(obj)",
# ARCH-SINGLE-NEXT: "Format": "elf64-x86-64",
# ARCH-SINGLE-NEXT: "Arch": "x86_64",
# ARCH-SINGLE-NEXT: "AddressSize": "64bit",
# ARCH-SINGLE-NEXT: "LoadName": "<Not found>"
# ARCH-SINGLE-NEXT: }
# ARCH-SINGLE-NEXT: }
# ARCH-SINGLE-NEXT:]
## Test outputting file summary for an archive with multiple files.
# RUN: rm -f %t.archive-multiple
# RUN: llvm-ar rc %t.archive-multiple %t.dir/obj %t.dir/obj
# RUN: llvm-readobj --elf-output-style=JSON --pretty-print %t.archive-multiple | \
# RUN: FileCheck %s --check-prefix=ARCH-MULTI \
# RUN: --match-full-lines --strict-whitespace --implicit-check-not={{.}}
# ARCH-MULTI:[
# ARCH-MULTI-NEXT: {
# ARCH-MULTI-NEXT: "FileSummary": {
# ARCH-MULTI-NEXT: "File": "{{.*}}.archive-multiple(obj)",
# ARCH-MULTI-NEXT: "Format": "elf64-x86-64",
# ARCH-MULTI-NEXT: "Arch": "x86_64",
# ARCH-MULTI-NEXT: "AddressSize": "64bit",
# ARCH-MULTI-NEXT: "LoadName": "<Not found>"
# ARCH-MULTI-NEXT: }
# ARCH-MULTI-NEXT: },
# ARCH-MULTI-NEXT: {
# ARCH-MULTI-NEXT: "FileSummary": {
# ARCH-MULTI-NEXT: "File": "{{.*}}.archive-multiple(obj)",
# ARCH-MULTI-NEXT: "Format": "elf64-x86-64",
# ARCH-MULTI-NEXT: "Arch": "x86_64",
# ARCH-MULTI-NEXT: "AddressSize": "64bit",
# ARCH-MULTI-NEXT: "LoadName": "<Not found>"
# ARCH-MULTI-NEXT: }
# ARCH-MULTI-NEXT: }
# ARCH-MULTI-NEXT:]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64