File: universal-object.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (42 lines) | stat: -rw-r--r-- 2,455 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This test verifies that llvm-objcopy copies a univeral Mach-O object file properly.

# RUN: yaml2obj %p/Inputs/i386.yaml -o %t.i386
# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64

## Case 1: copy a universal object containing regular Mach-O objects.
# RUN: llvm-lipo %t.i386 %t.x86_64 -create -output %t.universal
# RUN: llvm-objcopy %t.universal %t.universal.copy
# RUN: llvm-lipo %t.universal.copy -archs | FileCheck --check-prefix=VERIFY_ARCHS %s
# RUN: llvm-lipo %t.universal.copy -thin i386 -output %t.i386.copy
# RUN: llvm-lipo %t.universal.copy -thin x86_64 -output %t.x86_64.copy
# RUN: cmp %t.i386 %t.i386.copy
# RUN: cmp %t.x86_64 %t.x86_64.copy

## Case 2: copy a universal object file containing an archive.
# RUN: rm -f %t.archive.i386
# RUN: llvm-ar cr %t.archive.i386 %t.i386
# RUN: llvm-lipo %t.archive.i386 %t.x86_64 -create -output %t.universal.containing.archive
# RUN: llvm-objcopy %t.universal.containing.archive %t.universal.containing.archive.copy
# RUN: llvm-lipo %t.universal.containing.archive.copy -archs | FileCheck --check-prefix=VERIFY_ARCHS %s
# RUN: llvm-lipo %t.universal.containing.archive.copy -thin i386 -output %t.archive.i386.copy
# RUN: llvm-lipo %t.universal.containing.archive.copy -thin x86_64 -output %t.archive.x86_64.copy
# RUN: cmp %t.archive.i386 %t.archive.i386.copy
# RUN: cmp %t.x86_64 %t.archive.x86_64.copy

## Case 3: copy an archive containing a universal object.
# RUN: llvm-ar cr %t.archive.containing.universal %t.universal
# RUN: llvm-objcopy %t.archive.containing.universal %t.archive.containing.universal.copy

## Case 4: try to copy a universal object file contaning a bitcode slice.
# RUN: echo 'target triple = "arm64-apple-ios8.0.0"' | llvm-as -o %t.bitcode
# RUN: llvm-lipo %t.bitcode  %t.x86_64 -create -output %t.universal.containing.bitcode
# RUN: not llvm-objcopy %t.universal.containing.bitcode %t.universal.containing.bitcode.copy 2>&1 \
# RUN:  | FileCheck --check-prefix=UNSUPPORTED_UNIVERSAL_OBJECT %s

## Case 5: try to copy an archive containing an unsupported universal object.
# RUN: llvm-ar cr %t.archive.universal.bitcode %t.universal.containing.bitcode
# RUN: not llvm-objcopy %t.archive.universal.bitcode %t.archive.universal.bitcode.copy 2>&1 \
# RUN:  | FileCheck --check-prefix=UNSUPPORTED_UNIVERSAL_OBJECT %s

# VERIFY_ARCHS: i386 x86_64
# UNSUPPORTED_UNIVERSAL_OBJECT: slice for 'arm64' of the universal Mach-O binary {{.*}} is not a Mach-O object or an archive