Merge from mainline (168000:168310).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / special / special.exp
blobbab6798d97a4dea0c95f25b152c3ec110eaa7dce
1 # GCC Objective-C testsuite that uses the `dg.exp' driver.
2 # Copyright (C) 1997, 2001, 2007, 2010 Free Software Foundation, Inc.
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.
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 # <http://www.gnu.org/licenses/>.
18 # Load support procs.
19 load_lib objc-dg.exp
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 ""
27 # Initialize `dg'.
28 dg-init
30 # TODO: All these testcases compile and link two Objective-C modules.
31 # Remove code duplication and factor the common code out.
34 # unclaimed-category-1 test
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
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
63 # load-category-1 test
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
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
90 # load-category-2 test
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
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
117 # load-category-3 test
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
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
143 # All done.
144 dg-finish