112 lines · plain
1## This test checks that the -filelist option works correctly.2 3# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-input1.o4# RUN: yaml2obj %S/Inputs/input2.yaml -o %t-input2.o5# RUN: llvm-as %S/Inputs/x86_64-osx.ll -o %t-x86_64.bc6 7## Passing files in a listfile:8# RUN: echo %t-input1.o > %t.files.txt9# RUN: echo %t-input2.o >> %t.files.txt10# RUN: echo %t-x86_64.bc >> %t.files.txt11# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files.txt12 13## Check that binaries are present:14# RUN: llvm-ar t %t.lib | \15# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp16 17# CHECK-NAMES: [[PREFIX]]-input1.o18# CHECK-NAMES-NEXT: [[PREFIX]]-input2.o19# CHECK-NAMES-NEXT: [[PREFIX]]-x86_64.bc20 21## Check that symbols are present:22# RUN: llvm-nm --print-armap %t.lib | \23# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines24 25# CHECK-SYMBOLS: Archive map26# CHECK-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o27# CHECK-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o28# CHECK-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-x86_64.bc29# CHECK-SYMBOLS-EMPTY:30 31# RUN: rm -rf %t/dirname && mkdir -p %t/dirname32# RUN: yaml2obj %S/Inputs/input1.yaml -o %t/dirname/%basename_t.tmp-input1.o33# RUN: echo %basename_t.tmp-input1.o > %t.files2.txt34 35## Passing in dirname:36# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files2.txt,%t/dirname37# RUN: llvm-ar t %t.lib | \38# RUN: FileCheck %s --check-prefix=DIRNAME-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp39# RUN: llvm-nm --print-armap %t.lib | \40# RUN: FileCheck %s --check-prefix=DIRNAME-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines41 42# DIRNAME-NAMES: [[PREFIX]]-input1.o43 44# DIRNAME-SYMBOLS: Archive map45# DIRNAME-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o46# DIRNAME-SYMBOLS-EMPTY:47 48## Passing both -filelist option and object file as input:49# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.files2.txt,%t/dirname %t-input2.o50# RUN: llvm-ar t %t.lib | \51# RUN: FileCheck %s --check-prefix=REVERSE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp52# RUN: llvm-nm --print-armap %t.lib | \53# RUN: FileCheck %s --check-prefix=REVERSE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines54 55# REVERSE-NAMES: [[PREFIX]]-input2.o56# REVERSE-NAMES-NEXT: [[PREFIX]]-input1.o57 58# REVERSE-SYMBOLS: Archive map59# REVERSE-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o60# REVERSE-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o61# REVERSE-SYMBOLS-EMPTY:62 63## Check that an error is thrown when a file in the filelist doesn't exist in the cwd and no dirname is specified:64# RUN: echo 'no-such-file' > %t.invalid-list.txt65# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt 2>&1 | \66# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=no-such-file -DMSG=%errc_ENOENT67 68# FILE-ERROR: error: '[[FILE]]': [[MSG]]69 70## Check that an error is thrown when the directory exists but does not contain the requested file:71# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.invalid-list.txt,%t/dirname 2>&1 | \72# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=no-such-file -DMSG=%errc_ENOENT73 74# DIR-ERROR: error: '[[DIR]]{{[/\\]}}[[FILE]]': [[MSG]]75 76## Check that an error is thrown when a file is in the cwd but dirname is specified:77# RUN: yaml2obj %S/Inputs/input2.yaml -o %basename_t.tmp-input2.o78# RUN: echo %basename_t.tmp-input2.o > %t.files-cwd.txt79# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/dirname 2>&1 | \80# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/dirname -DFILE=%basename_t.tmp-input2.o -DMSG=%errc_ENOENT81 82## Check that an error is thrown when the directory doesn't exist:83# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.files-cwd.txt,%t/Invalid-Dir 2>&1 | \84# RUN: FileCheck %s --check-prefix=DIR-ERROR -DDIR=%t/Invalid-Dir -DFILE=%basename_t.tmp-input2.o -DMSG=%errc_ENOENT85 86## Check that an error is thrown when the filelist is empty:87# RUN: touch %t.empty-list88# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.empty-list 2>&1 | \89# RUN: FileCheck %s --check-prefix=EMPTY-ERROR -DFILE=%t.empty-list90 91# EMPTY-ERROR: error: file list file: '[[FILE]]' is empty92 93## Check that an error is thrown when the filelist contains a blank line:94# RUN: echo %t-input2.o > %t.blank-line.txt95# RUN: echo '' >> %t.blank-line.txt96# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.blank-line.txt 2>&1 | \97# RUN: FileCheck %s --check-prefix=EMPTY-FILENAME -DFILE=%t.blank-line.txt98 99# EMPTY-FILENAME: error: file list file: '[[FILE]]': filename cannot be empty100 101## Check that an error is thrown when the filelist contains a line with only spaces:102# RUN: echo %t-input2.o > %t.space-line.txt103# RUN: echo " " >> %t.space-line.txt104# RUN: not llvm-libtool-darwin -static -o %t.lib -filelist %t.space-line.txt 2>&1 | \105# RUN: FileCheck %s --check-prefix=FILE-ERROR -DFILE=' ' -DMSG=%errc_ENOENT --strict-whitespace106 107## Filelist option specified more than once:108# RUN: touch %t.list1.txt and %t.list2.txt109# RUN: llvm-libtool-darwin -static -o %t.lib -filelist %t.empty-list -filelist %t.files.txt 2>&1110# RUN: llvm-ar t %t.lib | \111# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp112