diff options
author | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2019-07-29 16:22:40 +0000 |
---|---|---|
committer | Sergey Dmitriev <serguei.n.dmitriev@intel.com> | 2019-07-29 16:22:40 +0000 |
commit | 899bdaa8c29d9100759e63e9be52897e4dbb37d9 (patch) | |
tree | cafe4cb72e375f4de1fc8178c267876f6d1c5d1a /llvm/test/tools/llvm-objcopy | |
parent | 3bdcedbf3d6adbd3ea5c6e00e814ea7548a07e66 (diff) | |
download | bcm5719-llvm-899bdaa8c29d9100759e63e9be52897e4dbb37d9.tar.gz bcm5719-llvm-899bdaa8c29d9100759e63e9be52897e4dbb37d9.zip |
[llvm-objcopy] Improve --add-section argument string parsing
Differential Revision: https://reviews.llvm.org/D65346
llvm-svn: 367236
Diffstat (limited to 'llvm/test/tools/llvm-objcopy')
-rw-r--r-- | llvm/test/tools/llvm-objcopy/COFF/add-section.test | 13 | ||||
-rw-r--r-- | llvm/test/tools/llvm-objcopy/ELF/add-section.test | 16 |
2 files changed, 25 insertions, 4 deletions
diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-section.test b/llvm/test/tools/llvm-objcopy/COFF/add-section.test index f2aa5ef093d..4422e31a99c 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/add-section.test +++ b/llvm/test/tools/llvm-objcopy/COFF/add-section.test @@ -34,14 +34,19 @@ ## Test that llvm-objcopy produces an error if the file with section contents ## to be added does not exist. -# RUN: not llvm-objcopy --add-section=.another.section=%t2 %t %t3 2>&1 | FileCheck -DFILE=%t -DFILE1=%t2 %s --check-prefixes=CHECK-ERR1 +# RUN: not llvm-objcopy --add-section=.another.section=%t2 %t %t3 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t2 %s --check-prefixes=ERR1 -# CHECK-ERR1: llvm-objcopy{{(.exe)?}}: error: '[[FILE]]': '[[FILE1]]': {{[Nn]}}o such file or directory +# ERR1: error: '[[FILE1]]': '[[FILE2]]': {{[Nn]}}o such file or directory ## Another negative test for invalid --add-sections command line argument. -# RUN: not llvm-objcopy --add-section=.another.section %t %t3 2>&1 | FileCheck -DFILE=%t %s --check-prefixes=CHECK-ERR2 +# RUN: not llvm-objcopy --add-section=.another.section %t %t3 2>&1 | FileCheck %s --check-prefixes=ERR2 -# CHECK-ERR2: llvm-objcopy{{(.exe)?}}: error: '[[FILE]]': bad format for --add-section +# ERR2: error: bad format for --add-section: missing '=' + +## Negative test for invalid --add-sections argument - missing file name. +# RUN: not llvm-objcopy --add-section=.section.name= %t %t3 2>&1 | FileCheck %s --check-prefixes=ERR3 + +# ERR3: error: bad format for --add-section: missing file name --- !COFF header: diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-section.test b/llvm/test/tools/llvm-objcopy/ELF/add-section.test index bf3ffdb090e..4acbd9ae4e2 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-section.test @@ -35,3 +35,19 @@ Sections: # CHECK: SectionData ( # CHECK-NEXT: 0000: DEADBEEF # CHECK-NEXT: ) + +## Test that llvm-objcopy produces an error if the file with section contents +## to be added does not exist. +# RUN: not llvm-objcopy --add-section=.section.name=%t.missing %t %t.out 2>&1 | FileCheck -DFILE1=%t -DFILE2=%t.missing %s --check-prefixes=ERR1 + +# ERR1: error: '[[FILE1]]': '[[FILE2]]': {{[Nn]}}o such file or directory + +## Negative test for invalid --add-sections argument - missing '='. +# RUN: not llvm-objcopy --add-section=.section.name %t %t.out 2>&1 | FileCheck %s --check-prefixes=ERR2 + +# ERR2: error: bad format for --add-section: missing '=' + +## Negative test for invalid --add-sections argument - missing file name. +# RUN: not llvm-objcopy --add-section=.section.name= %t %t.out 2>&1 | FileCheck %s --check-prefixes=ERR3 + +# ERR3: error: bad format for --add-section: missing file name |