blob: ddf6acb5c44db636bd64c9ebe2968755ddb342a6 [file] [log] [blame]
Georgii Rymarfff9f042019-12-10 17:06:16 +03001## Test case where input file does not exit.
2RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readobj %s
3RUN: not llvm-readelf %t.blah 2>&1 | FileCheck --check-prefix=ENOENT -DTOOL=readelf %s
4
5ENOENT: llvm-[[TOOL]]{{(\.exe)?}}: error: '{{.*}}.blah': {{[Nn]}}o such file or directory
James Henderson6561a822019-02-21 11:00:29 +00006
Elvina Yakubovadf952cb2020-07-20 08:47:11 +01007# 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
James Henderson6561a822019-02-21 11:00:29 +000012# 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
Stephen Tozer19bb1d52019-04-15 11:17:48 +000015EMPTY: '{{.*}}.empty': The file was not recognized as a valid object file
James Henderson6561a822019-02-21 11:00:29 +000016
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
James Henderson6561a822019-02-21 11:00:29 +000023# Test case where switch it not recognised.
24RUN: not llvm-readobj --unknown-switch 2>&1 | FileCheck --check-prefix=UNKNOWN %s
25UNKNOWN: Unknown command line argument '--unknown-switch'
26
27# Test version switch.
28RUN: llvm-readobj --version | FileCheck %s --check-prefix=VERSION
29RUN: llvm-readelf --version | FileCheck %s --check-prefix=VERSION
Ilya Biryukov411a55f2019-02-21 14:51:17 +000030# In default configuration we could match "LLVM version", but the "LLVM" part
31# can be changed with PACKAGE_NAME in CMake, so we match only version.
32VERSION: version
James Henderson6561a822019-02-21 11:00:29 +000033
34# Test help switch.
James Henderson9485b262019-06-21 11:49:20 +000035RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ
36RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF
James Henderson6561a822019-02-21 11:00:29 +000037HELP: OVERVIEW: LLVM Object Reader
James Henderson9485b262019-06-21 11:49:20 +000038OBJ: llvm-readobj{{.*}} [options] <input object files>
39ELF: llvm-readelf{{.*}} [options] <input object files>
40HELP: OPTIONS:
41OBJ: -s - Alias for --section-headers
42OBJ: -t - Alias for --symbols
43ELF: -s - Alias for --symbols
Georgii Rymarf855a552020-10-13 10:46:04 +030044ELF: -t - Alias for --section-details
James Henderson9485b262019-06-21 11:49:20 +000045HELP: @FILE