1 |
704 |
jeremybenn |
# GCC Objective-C testsuite that uses the `dg.exp' driver.
|
2 |
|
|
# Copyright (C) 1997, 2001, 2007, 2010 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
5 |
|
|
# it under the terms of the GNU General Public License as published by
|
6 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with GCC; see the file COPYING3. If not see
|
16 |
|
|
# .
|
17 |
|
|
|
18 |
|
|
# Load support procs.
|
19 |
|
|
load_lib objc-dg.exp
|
20 |
|
|
|
21 |
|
|
# If a testcase doesn't have special options, use these.
|
22 |
|
|
global DEFAULT_CFLAGS
|
23 |
|
|
if ![info exists DEFAULT_CFLAGS] then {
|
24 |
|
|
set DEFAULT_CFLAGS ""
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
# Initialize `dg'.
|
28 |
|
|
dg-init
|
29 |
|
|
|
30 |
|
|
# TODO: All these testcases compile and link two Objective-C modules.
|
31 |
|
|
# Remove code duplication and factor the common code out.
|
32 |
|
|
|
33 |
|
|
#
|
34 |
|
|
# unclaimed-category-1 test
|
35 |
|
|
#
|
36 |
|
|
# This test is special because we must compile two different modules,
|
37 |
|
|
# unclaimed-category-1a.m and unclaimed-category-1.m, then link
|
38 |
|
|
# together, then run the resulting executable.
|
39 |
|
|
# for all systems we point to the libobjc includes and use the -fgnu-runtime
|
40 |
|
|
set add_flags "additional_flags=-I${srcdir}/../../libobjc"
|
41 |
|
|
lappend add_flags "additional_flags=-fgnu-runtime"
|
42 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
|
43 |
|
|
if ![string match "" $lines] then {
|
44 |
|
|
fail "unclaimed-category-1a.o"
|
45 |
|
|
} else {
|
46 |
|
|
dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
|
47 |
|
|
file delete unclaimed-category-1a.o
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
if [istarget "*-*-darwin*" ] {
|
51 |
|
|
set add_flags ""
|
52 |
|
|
lappend add_flags "additional_flags=-fnext-runtime"
|
53 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
|
54 |
|
|
if ![string match "" $lines] then {
|
55 |
|
|
fail "unclaimed-category-1a.o"
|
56 |
|
|
} else {
|
57 |
|
|
dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-fnext-runtime"
|
58 |
|
|
file delete unclaimed-category-1a.o
|
59 |
|
|
}
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
#
|
63 |
|
|
# load-category-1 test
|
64 |
|
|
#
|
65 |
|
|
# This test is similar to the one above. We compile load-category-1.m
|
66 |
|
|
# and load-category-1a.m, link them together, and execute the result.
|
67 |
|
|
set add_flags "additional_flags=-I${srcdir}/../../libobjc"
|
68 |
|
|
lappend add_flags "additional_flags=-fgnu-runtime"
|
69 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
|
70 |
|
|
if ![string match "" $lines] then {
|
71 |
|
|
fail "load-category-1a.o"
|
72 |
|
|
} else {
|
73 |
|
|
dg-runtest "$srcdir/$subdir/load-category-1.m" "load-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
|
74 |
|
|
file delete load-category-1a.o
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
if [istarget "*-*-darwin*" ] {
|
78 |
|
|
set add_flags ""
|
79 |
|
|
lappend add_flags "additional_flags=-fnext-runtime"
|
80 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
|
81 |
|
|
if ![string match "" $lines] then {
|
82 |
|
|
fail "load-category-1a.o"
|
83 |
|
|
} else {
|
84 |
|
|
dg-runtest "$srcdir/$subdir/load-category-1.m" "load-category-1a.o" "-fnext-runtime"
|
85 |
|
|
file delete load-category-1a.o
|
86 |
|
|
}
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
#
|
90 |
|
|
# load-category-2 test
|
91 |
|
|
#
|
92 |
|
|
# This test is similar to the one above. We compile load-category-2.m
|
93 |
|
|
# and load-category-2a.m, link them together, and execute the result.
|
94 |
|
|
set add_flags "additional_flags=-I${srcdir}/../../libobjc"
|
95 |
|
|
lappend add_flags "additional_flags=-fgnu-runtime"
|
96 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
|
97 |
|
|
if ![string match "" $lines] then {
|
98 |
|
|
fail "load-category-2a.o"
|
99 |
|
|
} else {
|
100 |
|
|
dg-runtest "$srcdir/$subdir/load-category-2.m" "load-category-2a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
|
101 |
|
|
file delete load-category-2a.o
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
if [istarget "*-*-darwin*" ] {
|
105 |
|
|
set add_flags ""
|
106 |
|
|
lappend add_flags "additional_flags=-fnext-runtime"
|
107 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
|
108 |
|
|
if ![string match "" $lines] then {
|
109 |
|
|
fail "load-category-2a.o"
|
110 |
|
|
} else {
|
111 |
|
|
dg-runtest "$srcdir/$subdir/load-category-2.m" "load-category-2a.o" "-fnext-runtime"
|
112 |
|
|
file delete load-category-2a.o
|
113 |
|
|
}
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
#
|
117 |
|
|
# load-category-3 test
|
118 |
|
|
#
|
119 |
|
|
# This test is similar to the one above. We compile load-category-3.m
|
120 |
|
|
# and load-category-3a.m, link them together, and execute the result.
|
121 |
|
|
set add_flags "additional_flags=-I${srcdir}/../../libobjc"
|
122 |
|
|
lappend add_flags "additional_flags=-fgnu-runtime"
|
123 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
|
124 |
|
|
if ![string match "" $lines] then {
|
125 |
|
|
fail "load-category-3a.o"
|
126 |
|
|
} else {
|
127 |
|
|
dg-runtest "$srcdir/$subdir/load-category-3.m" "load-category-3a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
|
128 |
|
|
file delete load-category-3a.o
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
if [istarget "*-*-darwin*" ] {
|
132 |
|
|
set add_flags ""
|
133 |
|
|
lappend add_flags "additional_flags=-fnext-runtime"
|
134 |
|
|
set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
|
135 |
|
|
if ![string match "" $lines] then {
|
136 |
|
|
fail "load-category-3a.o"
|
137 |
|
|
} else {
|
138 |
|
|
dg-runtest "$srcdir/$subdir/load-category-3.m" "load-category-3a.o" "-fnext-runtime"
|
139 |
|
|
file delete load-category-3a.o
|
140 |
|
|
}
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
# All done.
|
144 |
|
|
dg-finish
|
145 |
|
|
|