xref: /llvm-project/bolt/test/binary-analysis/AArch64/cmdline-args.test (revision ceb7214be0287f536b292a41f8a7dc2e1467d72d)
1# This file tests error messages produced on invalid command line arguments.
2# It also checks that help messages are generated as expected.
3
4# Verify that an error message is provided if an input file is missing or incorrect
5
6RUN: not llvm-bolt-binary-analysis 2>&1 | FileCheck -check-prefix=NOFILEARG %s
7NOFILEARG:       llvm-bolt-binary-analysis: Not enough positional command line arguments specified!
8NOFILEARG-NEXT:  Must specify at least 1 positional argument: See: {{.*}}llvm-bolt-binary-analysis --help
9
10RUN: not llvm-bolt-binary-analysis non-existing-file 2>&1 | FileCheck -check-prefix=NONEXISTINGFILEARG %s
11NONEXISTINGFILEARG:       llvm-bolt-binary-analysis: 'non-existing-file': No such file or directory.
12
13RUN: not llvm-bolt-binary-analysis %p/Inputs/dummy.txt 2>&1 | FileCheck -check-prefix=NOELFFILEARG %s
14NOELFFILEARG:       llvm-bolt-binary-analysis: '{{.*}}/Inputs/dummy.txt': The file was not recognized as a valid object file.
15
16RUN: %clang %cflags %p/../../Inputs/asm_foo.s %p/../../Inputs/asm_main.c -o %t.exe
17RUN: llvm-bolt-binary-analysis %t.exe 2>&1 | FileCheck -check-prefix=VALIDELFFILEARG --allow-empty %s
18# Check that there are no BOLT-WARNING or BOLT-ERROR output lines
19VALIDELFFILEARG:     BOLT-INFO:
20VALIDELFFILEARG-NOT: BOLT-WARNING:
21VALIDELFFILEARG-NOT: BOLT-ERROR:
22
23# Check --help output
24
25RUN: llvm-bolt-binary-analysis --help 2>&1 | FileCheck -check-prefix=HELP %s
26
27HELP:       OVERVIEW: BinaryAnalysis
28HELP-EMPTY:
29HELP-NEXT:  USAGE: llvm-bolt-binary-analysis [options] <executable>
30HELP-EMPTY:
31HELP-NEXT:  OPTIONS:
32HELP-EMPTY:
33HELP-NEXT:  Generic Options:
34