llvm/llvm/test/tools/llvm-objcopy/ELF/dump-section-before-add-remove.test

# RUN: yaml2obj %s -o %t

## Verify that section is dumped before it is removed.
# RUN: llvm-objcopy --dump-section .test2=%t1.dump -R .test2 %t %t1
# RUN: od -t x1 %t1.dump | FileCheck %s --ignore-case --match-full-lines

# CHECK: 0000000 de ad be ef
# CHECK-NEXT: 0000004

## Verify that the newly added section is not dumped.
# RUN: echo CAFE > %t3.txt
# RUN: not llvm-objcopy --dump-section .test3=%t3.dump --add-section .test3=%t3.txt %t %t3 2>&1 | \
# RUN:     FileCheck %s --check-prefix=NODUMP -DINPUT=%t

# NODUMP: error: '[[INPUT]]': section '.test3' not found

!ELF
FileHeader:
  Class:    ELFCLASS64
  Data:     ELFDATA2LSB
  Type:     ET_REL
  Machine:  EM_X86_64
Sections:
  - Name:     .test1
    Type:     SHT_PROGBITS
    Flags:    [ ]
  - Name:     .test2
    Type:     SHT_PROGBITS
    Flags:    [ ]
    Content:  "DEADBEEF"
  - Name:     .test4
    Type:     SHT_PROGBITS
    Flags:    [ ]
    Content:  "BEEFDEAD"
Symbols: []