1fff9f049SGeorgii Rymar## Test case where input file does not exit. 242a21778SAbhina SreeskantharajanRUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj -DMSG=%errc_ENOENT %s 342a21778SAbhina SreeskantharajanRUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf -DMSG=%errc_ENOENT %s 4fff9f049SGeorgii Rymar 542a21778SAbhina SreeskantharajanENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': [[MSG]] 66561a823SJames Henderson 7df952cb9SElvina Yakubova# Test case with no input file. 8df952cb9SElvina YakubovaRUN: not llvm-readobj 2>&1 | FileCheck %s --check-prefix=NO-FILE 9df952cb9SElvina YakubovaRUN: not llvm-readelf 2>&1 | FileCheck %s --check-prefix=NO-FILE 10df952cb9SElvina YakubovaNO-FILE: error: no input files specified 11df952cb9SElvina Yakubova 126561a823SJames Henderson# Test case where input file is too small to be a recognised object file. 136561a823SJames HendersonRUN: touch %t.empty 146561a823SJames HendersonRUN: not llvm-readobj %t.empty 2>&1 | FileCheck --check-prefix=EMPTY %s 1519bb1d57SStephen TozerEMPTY: '{{.*}}.empty': The file was not recognized as a valid object file 166561a823SJames Henderson 176561a823SJames Henderson# Test that unrecognised files in archives are ignored. 186561a823SJames HendersonRUN: rm -f %t.a 19*fe3b621fSzhijianRUN: llvm-ar rc %t.a %t.empty 206561a823SJames HendersonRUN: llvm-readobj --all %t.a 2>&1 | FileCheck --check-prefix=NO-OUTPUT --allow-empty %s 216561a823SJames HendersonNO-OUTPUT-NOT: {{.}} 226561a823SJames Henderson 23a5154ab9SGeorgii Rymar## Test we report a meaningful warning for bitcode files. 24a5154ab9SGeorgii Rymar## Check we try to continue dumping other files. 25a5154ab9SGeorgii Rymar 26a5154ab9SGeorgii Rymar## Note: 'echo -e -n "\x42\x43\xc0\xde" > %t.bc.1' simply doesn't work properly on windows. 27a5154ab9SGeorgii Rymar## It has an issue with writing of the 2 last bytes and emits different data instead. 28a5154ab9SGeorgii Rymar## echo.exe from GnuWin32 works properly though, but using of python is a more stable way. 29a5154ab9SGeorgii RymarRUN: %python -c "import os; open(r'%t.bc.1', 'wb').write(b'\x42\x43\xC0\xDE')" 30a5154ab9SGeorgii RymarRUN: %python -c "import os; open(r'%t.bc.2', 'wb').write(b'\xDE\xC0\x17\x0B')" 31a5154ab9SGeorgii RymarRUN: llvm-readelf %t.bc.1 %t.bc.2 2>&1 | \ 32a5154ab9SGeorgii RymarRUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s 33a5154ab9SGeorgii RymarRUN: llvm-readobj %t.bc.1 %t.bc.2 2>&1 | \ 34a5154ab9SGeorgii RymarRUN: FileCheck --check-prefix=BITCODE -DFILE1=%t.bc.1 -DFILE2=%t.bc.2 %s 35a5154ab9SGeorgii Rymar 36a5154ab9SGeorgii Rymar# BITCODE: warning: '[[FILE1]]': bitcode files are not supported{{$}} 37a5154ab9SGeorgii Rymar# BITCODE: warning: '[[FILE2]]': bitcode files are not supported{{$}} 38a5154ab9SGeorgii Rymar 396561a823SJames Henderson# Test case where switch it not recognised. 406561a823SJames HendersonRUN: not llvm-readobj --unknown-switch 2>&1 | FileCheck --check-prefix=UNKNOWN %s 4146580d43SFangrui SongUNKNOWN: error: unknown argument '--unknown-switch' 426561a823SJames Henderson 436561a823SJames Henderson# Test version switch. 446561a823SJames HendersonRUN: llvm-readobj --version | FileCheck %s --check-prefix=VERSION 456561a823SJames HendersonRUN: llvm-readelf --version | FileCheck %s --check-prefix=VERSION 46411a55f7SIlya Biryukov# In default configuration we could match "LLVM version", but the "LLVM" part 47411a55f7SIlya Biryukov# can be changed with PACKAGE_NAME in CMake, so we match only version. 48411a55f7SIlya BiryukovVERSION: version 496561a823SJames Henderson 506561a823SJames Henderson# Test help switch. 519485b265SJames HendersonRUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ 529485b265SJames HendersonRUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF 536561a823SJames HendersonHELP: OVERVIEW: LLVM Object Reader 549485b265SJames HendersonOBJ: llvm-readobj{{.*}} [options] <input object files> 559485b265SJames HendersonELF: llvm-readelf{{.*}} [options] <input object files> 569485b265SJames HendersonHELP: OPTIONS: 5746580d43SFangrui SongHELP: -s Alias for --symbols 5846580d43SFangrui SongHELP: -t Alias for --section-details 5946580d43SFangrui SongHELP: OPTIONS (ELF specific): 6046580d43SFangrui SongHELP: --dynamic-table 6146580d43SFangrui SongHELP: OPTIONS (Mach-O specific): 6246580d43SFangrui SongHELP: --macho-data-in-code 6346580d43SFangrui SongHELP: OPTIONS (PE/COFF specific): 6446580d43SFangrui SongHELP: --codeview-ghash 659485b265SJames HendersonHELP: @FILE 66