]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/objc.dg/special/special.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / objc.dg / special / special.exp
CommitLineData
7ae6f08b 1# GCC Objective-C testsuite that uses the `dg.exp' driver.
f1717362 2# Copyright (C) 1997-2016 Free Software Foundation, Inc.
7ae6f08b 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
f63ff66b 6# the Free Software Foundation; either version 3 of the License, or
7ae6f08b 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
f63ff66b 15# along with GCC; see the file COPYING3. If not see
16# <http://www.gnu.org/licenses/>.
7ae6f08b 17
18# Load support procs.
19load_lib objc-dg.exp
20
21# If a testcase doesn't have special options, use these.
22global DEFAULT_CFLAGS
23if ![info exists DEFAULT_CFLAGS] then {
24 set DEFAULT_CFLAGS ""
25}
26
27# Initialize `dg'.
28dg-init
29
6e4aa40c 30# TODO: All these testcases compile and link two Objective-C modules.
31# Remove code duplication and factor the common code out.
32
7ae6f08b 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.
18f8dbe7 39# for all systems we point to the libobjc includes and use the -fgnu-runtime
40set add_flags "additional_flags=-I${srcdir}/../../libobjc"
41lappend add_flags "additional_flags=-fgnu-runtime"
42set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
7ae6f08b 43if ![string match "" $lines] then {
44 fail "unclaimed-category-1a.o"
45} else {
18f8dbe7 46 dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
7ae6f08b 47 file delete unclaimed-category-1a.o
48}
49
18f8dbe7 50if [istarget "*-*-darwin*" ] {
51set add_flags ""
52lappend add_flags "additional_flags=-fnext-runtime"
53set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
54if ![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
b3e841a5 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.
67set add_flags "additional_flags=-I${srcdir}/../../libobjc"
68lappend add_flags "additional_flags=-fgnu-runtime"
69set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
70if ![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
77if [istarget "*-*-darwin*" ] {
78set add_flags ""
79lappend add_flags "additional_flags=-fnext-runtime"
80set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
81if ![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
6e4aa40c 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.
94set add_flags "additional_flags=-I${srcdir}/../../libobjc"
95lappend add_flags "additional_flags=-fgnu-runtime"
96set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
97if ![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
104if [istarget "*-*-darwin*" ] {
105set add_flags ""
106lappend add_flags "additional_flags=-fnext-runtime"
107set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
108if ![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.
121set add_flags "additional_flags=-I${srcdir}/../../libobjc"
122lappend add_flags "additional_flags=-fgnu-runtime"
123set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
124if ![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
131if [istarget "*-*-darwin*" ] {
132set add_flags ""
133lappend add_flags "additional_flags=-fnext-runtime"
134set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
135if ![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
7ae6f08b 143# All done.
144dg-finish
145