xref: /llvm-project/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test (revision 939c03512d26b053196b9819bb64830482eab777)
1## This test checks that an error is thrown in case of invalid input/output args.
2
3## Missing input file:
4# RUN: not llvm-libtool-darwin -static -o %t.lib 2>&1 | \
5# RUN:   FileCheck %s --check-prefix=NO-INPUT
6
7# NO-INPUT: error: no input files specified
8
9## Missing output file:
10# RUN: not llvm-libtool-darwin -static %t.input 2>&1 | \
11# RUN:   FileCheck %s --check-prefix=NO-OUTPUT
12
13# NO-OUTPUT: -o option: must be specified
14
15## Missing argument to -o:
16# RUN: not llvm-libtool-darwin -static %t.input -o 2>&1 | \
17# RUN:   FileCheck %s --check-prefix=MISSING
18
19# MISSING: -o: missing argument
20
21## Input file not found:
22# RUN: not llvm-libtool-darwin -static -o %t.lib %t.missing 2>&1 | \
23# RUN:   FileCheck %s --check-prefix=NO-FILE -DFILE=%t.missing -DMSG=%errc_ENOENT
24
25# NO-FILE: error: '[[FILE]]': [[MSG]]
26
27## Input file is not an object file:
28# RUN: touch %t.invalid
29# RUN: not llvm-libtool-darwin -static -o %t.lib %t.invalid 2>&1 | \
30# RUN:   FileCheck %s --check-prefix=NOT-OBJECT -DFILE=%basename_t.tmp.invalid
31
32# NOT-OBJECT: error: '[[FILE]]': The file was not recognized as a valid object file
33
34## Input file is not a Mach-O object file:
35# RUN: yaml2obj %s -o %t.elf
36# RUN: not llvm-libtool-darwin -static -o %t.lib %t.elf 2>&1 | \
37# RUN:   FileCheck %s --check-prefix=NOT-MACHO -DFILE=%basename_t.tmp.elf
38
39# NOT-MACHO: error: '[[FILE]]': format not supported
40
41--- !ELF
42FileHeader:
43  Class:   ELFCLASS64
44  Data:    ELFDATA2LSB
45  Type:    ET_REL
46  Machine: EM_X86_64
47