xref: /llvm-project/llvm/test/tools/llvm-libtool-darwin/invalid-input-output-args.test (revision 939c03512d26b053196b9819bb64830482eab777)
16c43ed60SSameer Arora## This test checks that an error is thrown in case of invalid input/output args.
26c43ed60SSameer Arora
36c43ed60SSameer Arora## Missing input file:
4303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static -o %t.lib 2>&1 | \
56c43ed60SSameer Arora# RUN:   FileCheck %s --check-prefix=NO-INPUT
66c43ed60SSameer Arora
7d9a91929SSameer Arora# NO-INPUT: error: no input files specified
86c43ed60SSameer Arora
96c43ed60SSameer Arora## Missing output file:
10303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static %t.input 2>&1 | \
116c43ed60SSameer Arora# RUN:   FileCheck %s --check-prefix=NO-OUTPUT
126c43ed60SSameer Arora
13*939c0351SAndres Villegas# NO-OUTPUT: -o option: must be specified
146c43ed60SSameer Arora
156c43ed60SSameer Arora## Missing argument to -o:
16303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static %t.input -o 2>&1 | \
176c43ed60SSameer Arora# RUN:   FileCheck %s --check-prefix=MISSING
186c43ed60SSameer Arora
19*939c0351SAndres Villegas# MISSING: -o: missing argument
206c43ed60SSameer Arora
21303a7f7aSSameer Arora## Input file not found:
22303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static -o %t.lib %t.missing 2>&1 | \
2342a21778SAbhina Sreeskantharajan# RUN:   FileCheck %s --check-prefix=NO-FILE -DFILE=%t.missing -DMSG=%errc_ENOENT
24303a7f7aSSameer Arora
2542a21778SAbhina Sreeskantharajan# NO-FILE: error: '[[FILE]]': [[MSG]]
26303a7f7aSSameer Arora
27303a7f7aSSameer Arora## Input file is not an object file:
28303a7f7aSSameer Arora# RUN: touch %t.invalid
29303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static -o %t.lib %t.invalid 2>&1 | \
30303a7f7aSSameer Arora# RUN:   FileCheck %s --check-prefix=NOT-OBJECT -DFILE=%basename_t.tmp.invalid
31303a7f7aSSameer Arora
32303a7f7aSSameer Arora# NOT-OBJECT: error: '[[FILE]]': The file was not recognized as a valid object file
33303a7f7aSSameer Arora
34303a7f7aSSameer Arora## Input file is not a Mach-O object file:
35303a7f7aSSameer Arora# RUN: yaml2obj %s -o %t.elf
36303a7f7aSSameer Arora# RUN: not llvm-libtool-darwin -static -o %t.lib %t.elf 2>&1 | \
37303a7f7aSSameer Arora# RUN:   FileCheck %s --check-prefix=NOT-MACHO -DFILE=%basename_t.tmp.elf
38303a7f7aSSameer Arora
39303a7f7aSSameer Arora# NOT-MACHO: error: '[[FILE]]': format not supported
40303a7f7aSSameer Arora
41303a7f7aSSameer Arora--- !ELF
42303a7f7aSSameer AroraFileHeader:
43303a7f7aSSameer Arora  Class:   ELFCLASS64
44303a7f7aSSameer Arora  Data:    ELFDATA2LSB
45303a7f7aSSameer Arora  Type:    ET_REL
46303a7f7aSSameer Arora  Machine: EM_X86_64
47