xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/same-file-strip.test (revision ebd50291e8cf5911eb9c2da54389d93312caadd2)
177477009SAlex Brachet## Test llvm-strip using the same input file more than once.
277477009SAlex Brachet## When using stdin ('-') more than once llvm-strip should give an error
377477009SAlex Brachet## while a file more than once should be simply a warning.
477477009SAlex Brachet
577477009SAlex Brachet# RUN: yaml2obj %s -o %t
677477009SAlex Brachet
777477009SAlex Brachet# RUN: not llvm-strip - - < %t 2>&1 | FileCheck -check-prefix=ERR %s
877477009SAlex Brachet# RUN: not llvm-strip - %t - < %t 2>&1 | FileCheck -check-prefix=ERR %s
977477009SAlex Brachet
1077477009SAlex Brachet# ERR: error: cannot specify '-' as an input file more than once
1177477009SAlex Brachet
12*ebd50291SFangrui Song# RUN: cp %t %t2
13*ebd50291SFangrui Song# RUN: llvm-strip %t %t %t %t2 %t2 2>&1 | FileCheck -check-prefix=WARN %s -DFILE=%t -DFILE2=%t2
1477477009SAlex Brachet
1577477009SAlex Brachet# WARN:      warning: '[[FILE]]' was already specified
16*ebd50291SFangrui Song# WARN-NEXT: warning: '[[FILE2]]' was already specified
1777477009SAlex Brachet
1877477009SAlex Brachet--- !ELF
1977477009SAlex BrachetFileHeader:
2077477009SAlex Brachet  Class:   ELFCLASS64
2177477009SAlex Brachet  Data:    ELFDATA2LSB
2277477009SAlex Brachet  Type:    ET_REL
2377477009SAlex Brachet  Machine: EM_X86_64
2477477009SAlex BrachetSections:
2577477009SAlex Brachet  - Name:  .alloc
2677477009SAlex Brachet    Type:  SHT_PROGBITS
2777477009SAlex Brachet    Flags: [ SHF_ALLOC ]
28