1## 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
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 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
30# 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
33
34# Test help switch.
35RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ
36RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF
37HELP: OVERVIEW: LLVM Object Reader
38OBJ: 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
44ELF: -t - Alias for --section-details
45HELP: @FILE
46