archive-extract.test 2.67 KB
; This test just makes sure that llvm-ar can extract bytecode members
; from various style archives.

; RUN: rm -rf %t && mkdir -p %t && cd %t

; RUN: rm -f very_long_bytecode_file_name.bc
; RUN: llvm-ar p %p/Inputs/GNU.a very_long_bytecode_file_name.bc | \
; RUN:   cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
; RUN: llvm-ar x %p/Inputs/GNU.a very_long_bytecode_file_name.bc
; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
; RUN:        very_long_bytecode_file_name.bc

; RUN: rm -f very_long_bytecode_file_name.bc
; RUN: llvm-ar p %p/Inputs/MacOSX.a very_long_bytecode_file_name.bc | \
; RUN:   cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
; RUN: llvm-ar x %p/Inputs/MacOSX.a very_long_bytecode_file_name.bc
; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
; RUN:        very_long_bytecode_file_name.bc

; RUN: rm -f very_long_bytecode_file_name.bc
; RUN: llvm-ar p %p/Inputs/SVR4.a very_long_bytecode_file_name.bc | \
; RUN:   cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
; RUN: llvm-ar x %p/Inputs/SVR4.a very_long_bytecode_file_name.bc
; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
; RUN:        very_long_bytecode_file_name.bc

; RUN: rm -f very_long_bytecode_file_name.bc
; RUN: llvm-ar p %p/Inputs/xpg4.a very_long_bytecode_file_name.bc |\
; RUN:   cmp -s %p/Inputs/very_long_bytecode_file_name.bc -
; RUN: llvm-ar x %p/Inputs/xpg4.a very_long_bytecode_file_name.bc
; RUN: cmp -s %p/Inputs/very_long_bytecode_file_name.bc \
; RUN:        very_long_bytecode_file_name.bc


; Test that the 'o' option is working by extracting a file, putting it in o
; new archive and checking that date.
; RUN: rm -f very_long_bytecode_file_name.bc
; RUN: llvm-ar xo %p/Inputs/GNU.a very_long_bytecode_file_name.bc
; RUN: rm -f %t.a
; RUN: llvm-ar --format=gnu rcU %t.a very_long_bytecode_file_name.bc
; RUN: env TZ=GMT llvm-ar tv %t.a | FileCheck %s -check-prefix CHECK-GNU

CHECK-GNU: 1465 Nov 19 03:01 2004 very_long_bytecode_file_name.bc

; RUN: rm -f %t.a
; RUN: llvm-ar --format=darwin rcU %t.a very_long_bytecode_file_name.bc
; RUN: env TZ=GMT llvm-ar tv %t.a | FileCheck %s -check-prefix CHECK-DARWIN

CHECK-DARWIN: 1472 Nov 19 03:01 2004 very_long_bytecode_file_name.bc

RUN: not llvm-ar x %p/Inputs/GNU.a foo.o 2>&1 | FileCheck --check-prefix=NOTFOUND %s
NOTFOUND: error: 'foo.o' was not found

RUN: not llvm-ar x %p/Inputs/thin.a foo.o 2>&1 | FileCheck %s --check-prefix=THINEXTRACT
THINEXTRACT: extracting from a thin archive is not supported

RUN: llvm-ar p %p/Inputs/thin.a evenlen | FileCheck %s --check-prefix=EVENLEN
EVENLEN: evenlen

RUN: not llvm-ar p %p/Inputs/thin-path.a t/test2.o 2>&1 | FileCheck %s --check-prefix=MISSING
MISSING: error: {{N|n}}o such file or directory