]>
Commit | Line | Data |
---|---|---|
d696c285 A |
1 | ## |
2 | # Copyright (c) 2005 Apple Computer, Inc. All rights reserved. | |
3 | # | |
4 | # @APPLE_LICENSE_HEADER_START@ | |
5 | # | |
6 | # This file contains Original Code and/or Modifications of Original Code | |
7 | # as defined in and that are subject to the Apple Public Source License | |
8 | # Version 2.0 (the 'License'). You may not use this file except in | |
9 | # compliance with the License. Please obtain a copy of the License at | |
10 | # http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | # file. | |
12 | # | |
13 | # The Original Code and all software distributed under the License are | |
14 | # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | # Please see the License for the specific language governing rights and | |
19 | # limitations under the License. | |
20 | # | |
21 | # @APPLE_LICENSE_HEADER_END@ | |
22 | ## | |
23 | TESTROOT = ../.. | |
24 | include ${TESTROOT}/include/common.makefile | |
25 | ||
26 | # | |
27 | # Test that the -allowable_client and -client options | |
28 | # work when linking against subframeworks. | |
29 | # | |
30 | ||
31 | run: all | |
32 | ||
33 | all: | |
34 | # build with two allowable_clients | |
35 | ${CC} ${CCFLAGS} -dynamiclib -umbrella foo -allowable_client bar -allowable_client baz foo.c -o foo.${ARCH}.dylib | |
36 | ${FAIL_IF_BAD_MACHO} foo.${ARCH}.dylib | |
37 | ||
38 | # test that -o works | |
39 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.${ARCH}.dylib foo.${ARCH}.dylib | |
40 | ${FAIL_IF_BAD_MACHO} libbar.${ARCH}.dylib | |
41 | ||
42 | # test that a framework style output works | |
43 | mkdir -p bar.framework | |
44 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o bar.framework/bar foo.${ARCH}.dylib | |
45 | ${FAIL_IF_BAD_MACHO} bar.framework/bar | |
46 | ||
47 | # test that second -o works | |
48 | ${CC} ${CCFLAGS} -dynamiclib baz.c -o libbaz.${ARCH}.dylib foo.${ARCH}.dylib | |
a61fdf0a | 49 | ${FAIL_IF_BAD_MACHO} foo.${ARCH}.dylib |
d696c285 A |
50 | |
51 | # test that -o and -install_name works with install_name as an allowable | |
52 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o temp.${ARCH}.dylib -install_name /tmp/libbar.${ARCH}.dylib foo.${ARCH}.dylib | |
53 | ${FAIL_IF_BAD_MACHO} temp.${ARCH}.dylib | |
54 | ||
a61fdf0a A |
55 | # test that -install_name works with variant name |
56 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o temp.${ARCH}.dylib -install_name /tmp/libbar_profile foo.${ARCH}.dylib | |
57 | ${FAIL_IF_BAD_MACHO} temp.${ARCH}.dylib | |
58 | ||
d696c285 | 59 | # test that -o and -install_name fails with install_name different than allowable |
a61fdf0a | 60 | ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} -dynamiclib bar.c -o bar.${ARCH}.dylib -install_name /tmp/fail.${ARCH}.dylib foo.${ARCH}.dylib >& fail.log |
d696c285 A |
61 | |
62 | # test that a bundle and no client_name fails | |
a61fdf0a | 63 | ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} -bundle bar.c -o temp.${ARCH}.bundle foo.${ARCH}.dylib >& fail.log |
d696c285 A |
64 | |
65 | # test that a bundle and an allowable client_name passes | |
66 | ${CC} ${CCFLAGS} -bundle bar.c -client_name bar -o bar.${ARCH}.bundle foo.${ARCH}.dylib | |
67 | ${FAIL_IF_BAD_MACHO} bar.${ARCH}.bundle | |
68 | ||
69 | # test umbrella can link against subs | |
70 | mkdir -p foo.framework | |
71 | ${CC} ${CCFLAGS} -dynamiclib foo.${ARCH}.dylib -o foo.framework/foo | |
72 | ${FAIL_IF_BAD_MACHO} foo.framework/foo | |
73 | ||
a61fdf0a A |
74 | # test umbrella variant can link against subs |
75 | mkdir -p foo.framework | |
76 | ${CC} ${CCFLAGS} -dynamiclib foo.${ARCH}.dylib -o foo.framework/foo_debug -install_name /path/foo.framework/foo_debug | |
77 | ${FAIL_IF_BAD_MACHO} foo.framework/foo_debug | |
78 | ||
d696c285 A |
79 | # test sibling in umbrella can link against subs |
80 | ${CC} ${CCFLAGS} -dynamiclib main.c -umbrella foo foo.${ARCH}.dylib -o ./main.dylib | |
81 | ${FAIL_IF_BAD_MACHO} main.dylib | |
82 | ||
83 | # test anyone can link against umbrella | |
84 | ${CC} ${CCFLAGS} main.c -o main.${ARCH} -framework foo -F. | |
85 | ${FAIL_IF_BAD_MACHO} main.${ARCH} | |
86 | ||
87 | # test that an executable and no client_name fails | |
a61fdf0a | 88 | ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} main.c -o main.${ARCH} foo.${ARCH}.dylib >& fail.log |
d696c285 A |
89 | |
90 | # test that an executable and an allowable client_name passes | |
a61fdf0a A |
91 | ${CC} ${CCFLAGS} main.c -o main.${ARCH} -client_name bar foo.${ARCH}.dylib |
92 | ${PASS_IFF_GOOD_MACHO} main.${ARCH} | |
d696c285 | 93 | |
a61fdf0a A |
94 | # test that a regular dylib can be made unlinkable by using -allowable_client |
95 | ${CC} ${CCFLAGS} -dynamiclib foo.c -allowable_client '!' -o unlinkable_foo.${ARCH}.dylib | |
96 | ${FAIL_IF_BAD_MACHO} unlinkable_foo.${ARCH}.dylib | |
97 | ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} main.c -o main.${ARCH} unlinkable_foo.${ARCH}.dylib >& fail.log | |
98 | ||
99 | # test that a regular dylib can be made linkable by only specially named clients | |
100 | ${CC} ${CCFLAGS} -dynamiclib foo.c -allowable_client special -o restrictive_foo.${ARCH}.dylib | |
101 | ${FAIL_IF_BAD_MACHO} restrictive_foo.${ARCH}.dylib | |
102 | ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} main.c -o main.${ARCH} restrictive_foo.${ARCH}.dylib >& fail.log | |
103 | ${CC} ${CCFLAGS} main.c -o main.${ARCH} -client_name special restrictive_foo.${ARCH}.dylib | |
104 | ${FAIL_IF_BAD_MACHO} main.${ARCH} | |
d696c285 A |
105 | |
106 | # print final pass | |
107 | ${PASS_IFF_GOOD_MACHO} foo.${ARCH}.dylib | |
108 | ||
109 | clean: | |
a61fdf0a | 110 | rm -rf *.dylib *.bundle main.???* fail.log *.framework |