1## Test case where input file does not exit. 2RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj -DMSG=%errc_ENOENT %s 3RUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf -DMSG=%errc_ENOENT %s 4 5ENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': [[MSG]] 6 7# Test case with no input file. 8RUN: not llvm-readobj 2>&1 | FileCheck %s --check-prefix=NO-FILE 9RUN: not llvm-readelf 2>&1 | FileCheck %s --check-prefix=NO-FILE 10NO-FILE: error: no input files specified 11 12# Test case where input file is too small to be a recognised object file. 13RUN: touch %t.empty 14RUN: not llvm-readobj %t.empty 2>&1 | FileCheck --check-prefix=EMPTY %s 15EMPTY: '{{.*}}.empty': The file was not recognized as a valid object file 16 17# Test that unrecognised files in archives are ignored. 18RUN: rm -f %t.a 19RUN: llvm-ar rc %t.a %t.empty 20RUN: llvm-readobj --all %t.a 2>&1 | FileCheck --check-prefix=NO-OUTPUT --allow-empty %s 21NO-OUTPUT-NOT: {{.}} 22 23## Test we report a meaningful warning for bitcode files. 24## Check we try to continue dumping other files. 25 26## Note: 'echo -e -n "\x42\x43\xc0\xde" > %t.bc.1' simply doesn't work properly on windows. 27## It has an issue with writing of the 2 last bytes and emits different data instead. 28## echo.exe from GnuWin32 works properly though, but using of python is a more stable way. 29RUN: %python -c "import os; open(r'%t.bc.1', 'wb').write(b'\x42\x43\xC0\xDE')" 30RUN: %python -c "import os; open(r'%t.bc.2', 'wb').write(b'\xDE\xC0\x17\x0B')" 31RUN: llvm-readelf %t.bc.1 %t.bc.2 2>&1 | \ 32RUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s 33RUN: llvm-readobj %t.bc.1 %t.bc.2 2>&1 | \ 34RUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s 35 36# BITCODE: warning: '[[FILE1]]': bitcode files are not supported{{$}} 37# BITCODE: warning: '[[FILE2]]': bitcode files are not supported{{$}} 38 39# Test case where switch it not recognised. 40RUN: not llvm-readobj --unknown-switch 2>&1 | FileCheck --check-prefix=UNKNOWN %s 41UNKNOWN: error: unknown argument '--unknown-switch' 42 43# Test version switch. 44RUN: llvm-readobj --version | FileCheck %s --check-prefix=VERSION 45RUN: llvm-readelf --version | FileCheck %s --check-prefix=VERSION 46# In default configuration we could match "LLVM version", but the "LLVM" part 47# can be changed with PACKAGE_NAME in CMake, so we match only version. 48VERSION: version 49 50# Test help switch. 51RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ 52RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF 53HELP: OVERVIEW: LLVM Object Reader 54OBJ: llvm-readobj{{.*}} [options] <input object files> 55ELF: llvm-readelf{{.*}} [options] <input object files> 56HELP: OPTIONS: 57HELP: -s Alias for --symbols 58HELP: -t Alias for --section-details 59HELP: OPTIONS (ELF specific): 60HELP: --dynamic-table 61HELP: OPTIONS (Mach-O specific): 62HELP: --macho-data-in-code 63HELP: OPTIONS (PE/COFF specific): 64HELP: --codeview-ghash 65HELP: @FILE 66