OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.test-framework/] [gen_directive_tests] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 300 jeremybenn
#! /bin/bash
2
 
3
########################################################################
4
#
5
# File:    generate_framework_tests
6
# Author:  Janis Johnson
7
# Date:    2004/11/02
8
#
9
# Generate tests of GCC's test framework.  Each test has encoded in
10
# its name the dg commands that are used in the test and the expected
11
# result of the test, *-1.c.  Each test is followed by a test ending
12
# in *-2.c that is expected to pass.
13
#
14
# This script has evolved and could be rewritten to be more compact.
15
#
16
#
17
# Copyright (c) 2004, 2005, 2007 Free Software Foundation, Inc.
18
#
19
# This file is free software; you can redistribute it and/or modify
20
# it under the terms of the GNU General Public License as published by
21
# the Free Software Foundation; either version 3 of the License, or
22
# (at your option) any later version.
23
#
24
# This program is distributed in the hope that it will be useful,
25
# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
# GNU General Public License for more details.
28
#
29
# You should have received a copy of the GNU General Public License
30
# along with GCC; see the file COPYING3.  If not see
31
# .
32
#
33
########################################################################
34
 
35
cd $1
36
 
37
GOOD0='*-*-*'
38
GOOD1="yes"
39
GOOD2='empty-*-* *-*-empty *-*-*'
40
BAD0='empty-empty-empty'
41
BAD1="no"
42
BAD2='empty-*-* *-empty-* *-*-empty'
43
 
44
# Programs used in the tests: good compile and run, bad compile, and
45
# bad run.
46
GOOD_PROG="int main () { return 0; }"
47
BADC_PROG="int missing_body () }"
48
BADR_PROG="extern void abort (void); int main () { abort (); }"
49
 
50
# dg-do commands with a target list.
51
DOT_S0="{ dg-do compile { target ${GOOD0} } }"
52
DOT_S1="{ dg-do compile { target ${GOOD1} } }"
53
DOT_N0="{ dg-do compile { target ${BAD0} } }"
54
DOT_N1="{ dg-do compile { target ${BAD1} } }"
55
 
56
# dg-do commands with an xfail list; the xfail list is ignored for
57
# everything but "run".
58
DOX_P0="{ dg-do run { xfail ${BAD0} } }"
59
DOX_P1="{ dg-do run { xfail ${BAD1} } }"
60
DOX_F0="{ dg-do run { xfail ${GOOD0} } }"
61
DOX_F1="{ dg-do run { xfail ${GOOD1} } }"
62
 
63
# dg-xfail-if commands.
64
XIF_P0="{ dg-xfail-if \"target not matched\" { ${BAD0} } { \"-DY1\" } { \"-DY2\" } }"
65
XIF_P1="{ dg-xfail-if \"target not matched\" { ${BAD0} } { \"-DY1\" } { \"-DN\" } }"
66
XIF_P2="{ dg-xfail-if \"target not matched\" { ${BAD0} } { \"-DN\" } { \"-DY1\" } }"
67
XIF_P3="{ dg-xfail-if \"target not matched\" { ${BAD0} } { \"-DN1\" } { \"-DN2\" } }"
68
XIF_P4="{ dg-xfail-if \"exclude option matched\" { ${GOOD0} } { \"-DY1\" } { \"-DY2\" } }"
69
XIF_P5="{ dg-xfail-if \"include option not matched\" { ${GOOD0} } { \"-DN\" } { \"-DY1\" } }"
70
XIF_P6="{ dg-xfail-if \"include option not matched\" { ${GOOD0} } { \"-DN1\" } { \"-DN2\" } }"
71
XIF_F0="{ dg-xfail-if \"all matches succeed\" { ${GOOD0} } { \"-DY1\" } { \"-DN\" } }"
72
XIF_F1="{ dg-xfail-if \"all matches succeed\" { ${GOOD0} } { \"*\" } { \"-DN\" } }"
73
XIF_F2="{ dg-xfail-if \"all matches succeed\" { ${GOOD0} } { \"-DY1\" } { \"\" } }"
74
XIF_F3="{ dg-xfail-if \"all matches succeed\" { ${GOOD0} } { \"*\" } { \"\" } }"
75
 
76
XIF_P7="{ dg-xfail-if \"target not matched\" { ${BAD1} } { \"-DY1\" } { \"-DY2\" } }"
77
XIF_P8="{ dg-xfail-if \"target not matched\" { ${BAD1} } { \"-DY1\" } { \"-DN\" } }"
78
XIF_P9="{ dg-xfail-if \"target not matched\" { ${BAD1} } { \"-DN\" } { \"-DY1\" } }"
79
XIF_P10="{ dg-xfail-if \"target not matched\" { ${BAD1} } { \"-DN1\" } { \"-DN2\" } }"
80
XIF_P11="{ dg-xfail-if \"exclude option matched\" { ${GOOD1} } { \"-DY1\" } { \"-DY2\" } }"
81
XIF_P12="{ dg-xfail-if \"include option not matched\" { ${GOOD1} } { \"-DN\" } { \"-DY1\" } }"
82
XIF_P13="{ dg-xfail-if \"include option not matched\" { ${GOOD1} } { \"-DN1\" } { \"-DN2\" } }"
83
XIF_F4="{ dg-xfail-if \"all matches succeed\" { ${GOOD1} } { \"-DY1\" } { \"-DN\" } }"
84
XIF_F5="{ dg-xfail-if \"all matches succeed\" { ${GOOD1} } { \"*\" } { \"-DN\" } }"
85
XIF_F6="{ dg-xfail-if \"all matches succeed\" { ${GOOD1} } { \"-DY1\" } { \"\" } }"
86
XIF_F7="{ dg-xfail-if \"all matches succeed\" { ${GOOD1} } { \"*\" } { \"\" } }"
87
 
88
 
89
# dg-skip-if commands.
90
SIF_S0="{ dg-skip-if \"target not matched\" { ${BAD0} } { \"-DY1\" } { \"-DY2\" } }"
91
SIF_S1="{ dg-skip-if \"target not matched\" { ${BAD0} } { \"-DY1\" } { \"-DN\" } }"
92
SIF_S2="{ dg-skip-if \"target not matched\" { ${BAD0} } { \"-DN\" } { \"-DY1\" } }"
93
SIF_S3="{ dg-skip-if \"target not matched\" { ${BAD0} } { \"-DN1\" } { \"-DN2\" } }"
94
SIF_S4="{ dg-skip-if \"exclude option matched\" { ${GOOD0} } { \"-DY1\" } { \"-DY2\" } }"
95
SIF_S5="{ dg-skip-if \"include option not matched\" { ${GOOD0} } { \"-DN\" } { \"-DY1\" } }"
96
SIF_S6="{ dg-skip-if \"include option not matched\" { ${GOOD0} } { \"-DN1\" } { \"-DN2\" } }"
97
SIF_N0="{ dg-skip-if \"all matches succeed\" { ${GOOD0} } { \"-DY1\" } { \"-DN\" } }"
98
SIF_N1="{ dg-skip-if \"all matches succeed\" { ${GOOD0} } { \"*\" } { \"-DN\" } }"
99
SIF_N2="{ dg-skip-if \"all matches succeed\" { ${GOOD0} } { \"-DY1\" } { \"\" } }"
100
SIF_N3="{ dg-skip-if \"all matches succeed\" { ${GOOD0} } { \"*\" } { \"\" } }"
101
SIF_S7="{ dg-skip-if \"target not matched\" { ${BAD1} } { \"-DY1\" } { \"-DY2\" } }"
102
SIF_S8="{ dg-skip-if \"target not matched\" { ${BAD1} } { \"-DY1\" } { \"-DN\" } }"
103
SIF_S9="{ dg-skip-if \"target not matched\" { ${BAD1} } { \"-DN\" } { \"-DY1\" } }"
104
SIF_S10="{ dg-skip-if \"target not matched\" { ${BAD1} } { \"-DN1\" } { \"-DN2\" } }"
105
SIF_S11="{ dg-skip-if \"exclude option matched\" { ${GOOD1} } { \"-DY1\" } { \"-DY2\" } }"
106
SIF_S12="{ dg-skip-if \"include option not matched\" { ${GOOD1} } { \"-DN\" } { \"-DY1\" } }"
107
SIF_S13="{ dg-skip-if \"include option not matched\" { ${GOOD1} } { \"-DN1\" } { \"-DN2\" } }"
108
SIF_N4="{ dg-skip-if \"all matches succeed\" { ${GOOD1} } { \"-DY1\" } { \"-DN\" } }"
109
SIF_N5="{ dg-skip-if \"all matches succeed\" { ${GOOD1} } { \"*\" } { \"-DN\" } }"
110
SIF_N6="{ dg-skip-if \"all matches succeed\" { ${GOOD1} } { \"-DY1\" } { \"\" } }"
111
SIF_N7="{ dg-skip-if \"all matches succeed\" { ${GOOD1} } { \"*\" } { \"\" } }"
112
 
113
# dg-require-* commands, using procedures defined for this set of tests.
114
REQ_S0="{ dg-require-true \"\" }"    # do not skip the test
115
REQ_N0="{ dg-require-false \"\" }"   # skip the test
116
 
117
# scan-assembler-not, which is hoped to be representative of commands
118
# used with dg-final, with a target list.
119
SAT_N0="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${BAD0} } } }"
120
SAT_N1="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${BAD1} } } }"
121
SAT_S0="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${GOOD0} } } }"
122
SAT_S1="{ dg-final { scan-assembler-not \"unexpected gargage\" { target ${GOOD1} } } }"
123
 
124
# scan-assembler-not, which is hoped to be representative of commands
125
# used with dg-final, with an xfail list.
126
SAX_P0="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${BAD0} } } }"
127
SAX_P1="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${BAD1} } } }"
128
SAX_F0="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${GOOD0} } } }"
129
SAX_F1="{ dg-final { scan-assembler-not \"unexpected gargage\" { xfail ${GOOD1} } } }"
130
 
131
KIND_LIST=""
132
 
133
# Expected result of the *-1.c test, encoded into the file name.
134
EXP_PASS="exp-P"
135
EXP_XPASS="exp-XP"
136
EXP_SKIP="exp-U"
137
EXP_FAIL="exp-F"
138
EXP_XFAIL="exp-XF"
139
 
140
get_list() {
141
    KIND=$1
142
    case $KIND in
143
      "dots") KIND_LIST="dots0 dots1";;
144
      "dotn") KIND_LIST="dotn0 dotn1";;
145
      "doxp") KIND_LIST="doxp0 doxp1";;
146
      "doxf") KIND_LIST="doxf0 doxf1";;
147
      "sifs") KIND_LIST="sifs0 sifs1 sifs2 sifs3 sifs4 sifs5 sifs6 sifs7 sifs8 sifs9 sifs10 sifs11 sifs12 sifs13";;
148
      "sifn") KIND_LIST="sifn0 sifn1 sifn2 sifn3 sifn4 sifn5 sifn6 sifn7";;
149
      "xifp") KIND_LIST="xifp0 xifp1 xifp2 xifp3 xifp4 xifp5 xifp6 xifp7 xifp8 xifp9 xifp10 xifp11 xifp12 xifp13";;
150
      "xiff") KIND_LIST="xiff0 xiff1 xiff2 xiff3 xiff4 xiff5 xiff6 xiff7";;
151
      "sats") KIND_LIST="sats0 sats1";;
152
      "satn") KIND_LIST="satn0 satn1";;
153
      "saxp") KIND_LIST="saxp0 saxp1";;
154
      "saxf") KIND_LIST="saxf0 saxf1";;
155
      "reqs") KIND_LIST="reqs0";;
156
      "reqn") KIND_LIST="reqn0";;
157
      *) echo "oops: $KIND"; exit 1;;
158
    esac
159
}
160
 
161
cmd() {
162
    KIND=$1
163
    FILE=$2
164
 
165
    case $KIND in
166
      "dots") echo '/*' "${DOT_S0}" '*/' >> $FILE;;
167
      "dots0") echo '/*' "${DOT_S0}" '*/' >> $FILE;;
168
      "dots1") echo '/*' "${DOT_S1}" '*/' >> $FILE;;
169
      "dots2") echo '/*' "${DOT_S2}" '*/' >> $FILE;;
170
      "dots3") echo '/*' "${DOT_S3}" '*/' >> $FILE;;
171
      "dots4") echo '/*' "${DOT_S4}" '*/' >> $FILE;;
172
      "dotn") echo '/*' "${DOT_N0}" '*/' >> $FILE;;
173
      "dotn0") echo '/*' "${DOT_N0}" '*/' >> $FILE;;
174
      "dotn1") echo '/*' "${DOT_N1}" '*/' >> $FILE;;
175
      "dotn2") echo '/*' "${DOT_N2}" '*/' >> $FILE;;
176
      "dotn3") echo '/*' "${DOT_N3}" '*/' >> $FILE;;
177
      "dotn4") echo '/*' "${DOT_N4}" '*/' >> $FILE;;
178
      "doxp") echo '/*' "${DOX_P0}" '*/' >> $FILE;;
179
      "doxp0") echo '/*' "${DOX_P0}" '*/' >> $FILE;;
180
      "doxp1") echo '/*' "${DOX_P1}" '*/' >> $FILE;;
181
      "doxp2") echo '/*' "${DOX_P2}" '*/' >> $FILE;;
182
      "doxp3") echo '/*' "${DOX_P3}" '*/' >> $FILE;;
183
      "doxp4") echo '/*' "${DOX_P4}" '*/' >> $FILE;;
184
      "doxf") echo '/*' "${DOX_F0}" '*/' >> $FILE;;
185
      "doxf0") echo '/*' "${DOX_F0}" '*/' >> $FILE;;
186
      "doxf1") echo '/*' "${DOX_F1}" '*/' >> $FILE;;
187
      "doxf2") echo '/*' "${DOX_F2}" '*/' >> $FILE;;
188
      "doxf3") echo '/*' "${DOX_F3}" '*/' >> $FILE;;
189
      "doxf4") echo '/*' "${DOX_F4}" '*/' >> $FILE;;
190
      "sifs") echo '/*' "${SIF_S0}" '*/' >> $FILE;;
191
      "sifs0") echo '/*' "${SIF_S0}" '*/' >> $FILE;;
192
      "sifs1") echo '/*' "${SIF_S1}" '*/' >> $FILE;;
193
      "sifs2") echo '/*' "${SIF_S2}" '*/' >> $FILE;;
194
      "sifs3") echo '/*' "${SIF_S3}" '*/' >> $FILE;;
195
      "sifs4") echo '/*' "${SIF_S4}" '*/' >> $FILE;;
196
      "sifs5") echo '/*' "${SIF_S5}" '*/' >> $FILE;;
197
      "sifs6") echo '/*' "${SIF_S6}" '*/' >> $FILE;;
198
      "sifs7") echo '/*' "${SIF_S7}" '*/' >> $FILE;;
199
      "sifs8") echo '/*' "${SIF_S8}" '*/' >> $FILE;;
200
      "sifs9") echo '/*' "${SIF_S9}" '*/' >> $FILE;;
201
      "sifs10") echo '/*' "${SIF_S10}" '*/' >> $FILE;;
202
      "sifs11") echo '/*' "${SIF_S11}" '*/' >> $FILE;;
203
      "sifs12") echo '/*' "${SIF_S12}" '*/' >> $FILE;;
204
      "sifs13") echo '/*' "${SIF_S13}" '*/' >> $FILE;;
205
      "sifn") echo '/*' "${SIF_N0}" '*/' >> $FILE;;
206
      "sifn0") echo '/*' "${SIF_N0}" '*/' >> $FILE;;
207
      "sifn1") echo '/*' "${SIF_N1}" '*/' >> $FILE;;
208
      "sifn2") echo '/*' "${SIF_N2}" '*/' >> $FILE;;
209
      "sifn3") echo '/*' "${SIF_N3}" '*/' >> $FILE;;
210
      "sifn4") echo '/*' "${SIF_N4}" '*/' >> $FILE;;
211
      "sifn5") echo '/*' "${SIF_N5}" '*/' >> $FILE;;
212
      "sifn6") echo '/*' "${SIF_N6}" '*/' >> $FILE;;
213
      "sifn7") echo '/*' "${SIF_N7}" '*/' >> $FILE;;
214
      "xifp") echo '/*' "${XIF_P0}" '*/' >> $FILE;;
215
      "xifp0") echo '/*' "${XIF_P0}" '*/' >> $FILE;;
216
      "xifp1") echo '/*' "${XIF_P1}" '*/' >> $FILE;;
217
      "xifp2") echo '/*' "${XIF_P2}" '*/' >> $FILE;;
218
      "xifp3") echo '/*' "${XIF_P3}" '*/' >> $FILE;;
219
      "xifp4") echo '/*' "${XIF_P4}" '*/' >> $FILE;;
220
      "xifp5") echo '/*' "${XIF_P5}" '*/' >> $FILE;;
221
      "xifp6") echo '/*' "${XIF_P6}" '*/' >> $FILE;;
222
      "xifp7") echo '/*' "${XIF_P7}" '*/' >> $FILE;;
223
      "xifp8") echo '/*' "${XIF_P8}" '*/' >> $FILE;;
224
      "xifp9") echo '/*' "${XIF_P9}" '*/' >> $FILE;;
225
      "xifp10") echo '/*' "${XIF_P10}" '*/' >> $FILE;;
226
      "xifp11") echo '/*' "${XIF_P11}" '*/' >> $FILE;;
227
      "xifp12") echo '/*' "${XIF_P12}" '*/' >> $FILE;;
228
      "xifp13") echo '/*' "${XIF_P13}" '*/' >> $FILE;;
229
      "xiff") echo '/*' "${XIF_F0}" '*/' >> $FILE;;
230
      "xiff0") echo '/*' "${XIF_F0}" '*/' >> $FILE;;
231
      "xiff1") echo '/*' "${XIF_F1}" '*/' >> $FILE;;
232
      "xiff2") echo '/*' "${XIF_F2}" '*/' >> $FILE;;
233
      "xiff3") echo '/*' "${XIF_F3}" '*/' >> $FILE;;
234
      "xiff4") echo '/*' "${XIF_F4}" '*/' >> $FILE;;
235
      "xiff5") echo '/*' "${XIF_F5}" '*/' >> $FILE;;
236
      "xiff6") echo '/*' "${XIF_F6}" '*/' >> $FILE;;
237
      "xiff7") echo '/*' "${XIF_F7}" '*/' >> $FILE;;
238
      "satn") echo '/*' "${SAT_N0}" '*/' >> $FILE;;
239
      "satn0") echo '/*' "${SAT_N0}" '*/' >> $FILE;;
240
      "satn1") echo '/*' "${SAT_N1}" '*/' >> $FILE;;
241
      "satn2") echo '/*' "${SAT_N2}" '*/' >> $FILE;;
242
      "satn3") echo '/*' "${SAT_N3}" '*/' >> $FILE;;
243
      "satn4") echo '/*' "${SAT_N4}" '*/' >> $FILE;;
244
      "sats") echo '/*' "${SAT_S0}" '*/' >> $FILE;;
245
      "sats0") echo '/*' "${SAT_S0}" '*/' >> $FILE;;
246
      "sats1") echo '/*' "${SAT_S1}" '*/' >> $FILE;;
247
      "sats2") echo '/*' "${SAT_S2}" '*/' >> $FILE;;
248
      "sats3") echo '/*' "${SAT_S3}" '*/' >> $FILE;;
249
      "sats4") echo '/*' "${SAT_S4}" '*/' >> $FILE;;
250
      "saxp") echo '/*' "${SAX_P0}" '*/' >> $FILE;;
251
      "saxp0") echo '/*' "${SAX_P0}" '*/' >> $FILE;;
252
      "saxp1") echo '/*' "${SAX_P1}" '*/' >> $FILE;;
253
      "saxp2") echo '/*' "${SAX_P2}" '*/' >> $FILE;;
254
      "saxp3") echo '/*' "${SAX_P3}" '*/' >> $FILE;;
255
      "saxp4") echo '/*' "${SAX_P4}" '*/' >> $FILE;;
256
      "saxf") echo '/*' "${SAX_F0}" '*/' >> $FILE;;
257
      "saxf0") echo '/*' "${SAX_F0}" '*/' >> $FILE;;
258
      "saxf1") echo '/*' "${SAX_F1}" '*/' >> $FILE;;
259
      "saxf2") echo '/*' "${SAX_F2}" '*/' >> $FILE;;
260
      "saxf3") echo '/*' "${SAX_F3}" '*/' >> $FILE;;
261
      "saxf4") echo '/*' "${SAX_F4}" '*/' >> $FILE;;
262
      "reqs") echo '/*' "${REQ_S0}" '*/' >> $FILE;;
263
      "reqs0") echo '/*' "${REQ_S0}" '*/' >> $FILE;;
264
      "reqn") echo '/*' "${REQ_N0}" '*/' >> $FILE;;
265
      "reqn0") echo '/*' "${REQ_N0}" '*/' >> $FILE;;
266
      *) echo "oops: $KIND"; exit 1;;
267
    esac
268
}
269
 
270
# Generate a test using a single dg- command.  If requested, generate a
271
# second version that will fail.
272
one() {
273
    KIND=$1
274
    EXP=$2
275
    FAIL_VERSION=$3
276
 
277
    NAME=${KIND}-${EXP}
278
    FILE1=${NAME}-1.c
279
    FILE2=${NAME}-2.c
280
    rm -f $FILE1
281
    touch $FILE1
282
    cmd $KIND $FILE1
283
    echo "${GOOD_PROG}" >> $FILE1
284
    echo "${GOOD_PROG}" > $FILE2
285
 
286
    if [ "${FAIL_VERSION}" == "yes" ]; then
287
        if [ "${EXP}" == "${EXP_PASS}" ]; then
288
            NAME=${KIND}-${EXP_FAIL}
289
        else
290
            NAME=${KIND}-${EXP_XFAIL}
291
        fi
292
 
293
        FILE1=${NAME}-1.c
294
        FILE2=${NAME}-2.c
295
        rm -f $FILE1
296
        touch $FILE1
297
        cmd $KIND $FILE1
298
        case $KIND in
299
        dox*)   echo "${BADR_PROG}" >> $FILE1;;
300
        *)      echo "${BADC_PROG}" >> $FILE1;;
301
        esac
302
        echo "${GOOD_PROG}" > $FILE2
303
    fi
304
}
305
 
306
# Generate a test using two dg- commands.  If requested, generate a
307
# second version that will fail.
308
two() {
309
    KIND1=$1
310
    KIND2=$2
311
    EXP=$3
312
    FAIL_VERSION=$4
313
 
314
    NAME=${KIND1}-${KIND2}-${EXP}
315
    FILE1=${NAME}-1.c
316
    FILE2=${NAME}-2.c
317
 
318
    rm -f $FILE1
319
    touch $FILE1
320
    cmd $KIND1 $FILE1
321
    cmd $KIND2 $FILE1
322
    echo "${GOOD_PROG}" >> $FILE1
323
    echo "${GOOD_PROG}" > $FILE2
324
 
325
    if [ "${FAIL_VERSION}" == "yes" ]; then
326
        if [ "${EXP}" == "${EXP_PASS}" ]; then
327
            NAME=${KIND1}-${KIND2}-${EXP_FAIL}
328
        else
329
            NAME=${KIND1}-${KIND2}-${EXP_XFAIL}
330
        fi
331
 
332
        FILE1=${NAME}-1.c
333
        FILE2=${NAME}-2.c
334
        rm -f $FILE1
335
        touch $FILE1
336
        cmd $KIND1 $FILE1
337
        cmd $KIND2 $FILE1
338
        # dg-do with an xfail list is only used as the first command.
339
        case $KIND1 in
340
        dox*)   echo "${BADR_PROG}" >> $FILE1;;
341
        *)      echo "${BADC_PROG}" >> $FILE1;;
342
        esac
343
        echo "${GOOD_PROG}" > $FILE2
344
    fi
345
}
346
 
347
# Generate a test using three dg- commands.  If requested generate a
348
# second version that will fail.
349
three() {
350
    KIND1=$1
351
    KIND2=$2
352
    KIND3=$3
353
    EXP=$4
354
    FAIL_VERSION=$5
355
 
356
    NAME=${KIND1}-${KIND2}-${KIND3}-${EXP}
357
    FILE1=${NAME}-1.c
358
    FILE2=${NAME}-2.c
359
    rm -f $FILE1
360
    touch $FILE1
361
    cmd $KIND1 $FILE1
362
    cmd $KIND2 $FILE1
363
    cmd $KIND3 $FILE1
364
    echo "${GOOD_PROG}" >> $FILE1
365
    echo "${GOOD_PROG}" > $FILE2
366
 
367
    if [ "${FAIL_VERSION}" == "${yes}" ]; then
368
        if [ "${EXP}" == "${EXP_PASS}" ]; then
369
            NAME=${KIND1}-${KIND2}-${KIND3}-${EXP_FAIL}
370
        else
371
            NAME=${KIND1}-${KIND2}-${KIND3}-${EXP_XFAIL}
372
        fi
373
 
374
        FILE1=${NAME}-1.c
375
        FILE2=${NAME}-2.c
376
        rm -f $FILE1
377
        touch $FILE1
378
        cmd $KIND1 $FILE1
379
        cmd $KIND2 $FILE1
380
        cmd $KIND3 $FILE1
381
        # dg-do with an xfail list is only used as the first command.
382
        case $KIND1 in
383
        dox*)   echo "${BADR_PROG}" >> $FILE1;;
384
        *)      echo "${BADC_PROG}" >> $FILE1;;
385
        esac
386
        echo "${GOOD_PROG}" > $FILE2
387
    fi
388
}
389
 
390
# Generate tests using one dg- command.  Generate a test for each variant
391
# of KIND.
392
one_all() {
393
    KIND=$1
394
    EXP=$2
395
    FAIL_VERSION=$3
396
 
397
    get_list $KIND
398
    for k in $KIND_LIST; do
399
        one $k $EXP $FAIL_VERSION
400
    done
401
}
402
 
403
# Generate tests using two dg- commands.  For each KIND, generate
404
# a test for each of its variants.
405
two_all() {
406
    KIND1=$1
407
    KIND2=$2
408
    EXP=$3
409
    FAIL_VERSION=$4
410
 
411
    get_list $KIND1
412
    KIND_LIST1="$KIND_LIST"
413
    get_list $KIND2
414
    KIND_LIST2="$KIND_LIST"
415
    for k1 in $KIND_LIST1; do
416
        for k2 in $KIND_LIST2; do
417
            two $k1 $k2 $EXP $FAIL_VERSION
418
        done
419
    done
420
}
421
 
422
# Generate tests using three dg- commands.  For each KIND, generate
423
# a test for each of its variants.
424
three_all() {
425
    KIND1=$1
426
    KIND2=$2
427
    KIND3=$3
428
    EXP=$4
429
    FAIL_VERSION=$5
430
 
431
    get_list $KIND1
432
    KIND_LIST1="$KIND_LIST"
433
    get_list $KIND2
434
    KIND_LIST2="$KIND_LIST"
435
    get_list $KIND3
436
    KIND_LIST3="$KIND_LIST"
437
    for k1 in $KIND_LIST1; do
438
        for k2 in $KIND_LIST2; do
439
            for k3 in $KIND_LIST3; do
440
                three $k1 $k2 $k3 $EXP $FAIL_VERSION
441
            done
442
        done
443
    done
444
}
445
 
446
# Generate a test that uses a dg-do directive with a selector expression.
447
dgdo_progs() {
448
    WHAT=$1
449
    KIND=$2
450
    PROG="$3"
451
    NAME="$4"
452
    XPR="$5"
453
 
454
    FILE1=${NAME}-1.c
455
    FILE2=${NAME}-2.c
456
    rm -f $FILE1
457
    touch $FILE1
458
    echo '/* { dg-do' $WHAT '{' $KIND "$XPR" '} } */' >> $FILE1
459
    echo "${PROG}" >> $FILE1
460
    echo "${GOOD_PROG}" > $FILE2
461
}
462
 
463
# Use various selector-expressions that evaluate to TRUE in dg-do directives.
464
selector_good() {
465
    NUM=101
466
    for xpr in \
467
        "$GOOD0" \
468
        "$GOOD1" \
469
        "$GOOD2" \
470
        "{ ! $BAD0 }" \
471
        "{ ! $BAD1 }" \
472
        "{ ! { $BAD2 } }" \
473
        "{ ! \"${BAD2}\" }" \
474
        "{ $GOOD1 || $GOOD0 }"  \
475
        "{ $BAD1 || $GOOD0 }" \
476
        "{ $GOOD0 && $GOOD1 }"  \
477
        "{ $BAD1 || { \"${GOOD2}\" && $GOOD1 } }" \
478
        "{ { $BAD0 || $GOOD0 } && $GOOD0 }" \
479
        "{ $GOOD1 && { \"${GOOD2}\" || $BAD1 } }" \
480
        "{ \"${GOOD2}\" && { $GOOD1 || $BAD1 } }"
481
    do
482
        dgdo_progs compile target "$GOOD_PROG" "dots${NUM}-exp-P" "$xpr"
483
        dgdo_progs compile target "$BADC_PROG" "dots${NUM}-exp-F" "$xpr"
484
        dgdo_progs run xfail "$GOOD_PROG" "doxf${NUM}-exp-XP" "$xpr"
485
        dgdo_progs run xfail "$BADR_PROG" "doxf${NUM}-exp-XF" "$xpr"
486
        let NUM=NUM+1
487
    done
488
}
489
 
490
# Use various selector-expressions that evaluate to FALSE in dg-do directives.
491
selector_bad() {
492
    NUM=101
493
    for xpr in \
494
        "$BAD0" \
495
        "$BAD1" \
496
        "$BAD2" \
497
        "{ ! $GOOD0 }" \
498
        "{ ! $GOOD1 }" \
499
        "{ ! { $GOOD2 } }" \
500
        "{ ! \"${GOOD2}\" }" \
501
        "{ $BAD1 || $BAD0 }" \
502
        "{ $BAD0 && $GOOD1 }" \
503
        "{ $GOOD1 && $BAD0 }" \
504
        "{ $BAD1 || { $GOOD1 && $BAD0 } }" \
505
        "{ { $GOOD1 || $BAD1 } && $BAD0 }" \
506
        "{ $BAD1 || { \"${BAD2}\" && $GOOD1 } }" \
507
        "{ \"${BAD2}\" && { $GOOD1 || $BAD1 } }"
508
    do
509
        dgdo_progs compile target "$GOOD_PROG" "dotn${NUM}-exp-U" "$xpr"
510
        dgdo_progs run xfail "$GOOD_PROG" "doxp${NUM}-exp-P" "$xpr"
511
        dgdo_progs run xfail "$BADR_PROG" "doxp${NUM}-exp-F" "$xpr"
512
        let NUM=NUM+1
513
    done
514
}
515
 
516
# Write a test whose directive is too long and messy to do as one string.
517
deep_progs() {
518
    PROG="$1"
519
    NAME=$2
520
    CMD1="$3"
521
    CMD2="$4"
522
    CMD3="$5"
523
 
524
    FILE1=${NAME}-1.c
525
    FILE2=${NAME}-2.c
526
    rm -f $FILE1
527
    touch $FILE1
528
    echo "$CMD1" "$CMD2" "$CMD3" > $FILE1
529
    echo "$PROG" >> $FILE1
530
    echo "$GOOD_PROG" > $FILE2
531
}
532
 
533
# Use nested expressions in various test directives.
534
selector_deep() {
535
    GOODXPR="{ \"${GOOD2}\" && { ! { $BAD0 || $BAD1 } } }"
536
    BADXPR="{ ! { \"${GOOD2}\" || { $GOOD1 && $BAD1 } } }"
537
    NUM=100
538
    dgdo_progs compile target "$GOOD_PROG" "dots${NUM}-exp-P" "$GOODXPR"
539
    dgdo_progs compile target "$GOOD_PROG" "dotn${NUM}-exp-U" "$BADXPR"
540
 
541
    deep_progs "$BADC_PROG" "xiff-100-exp-XF" \
542
      '/* { dg-xfail-if "match" { ' "{ $GOODXPR }" ' } { "*" } { "" } } */'
543
    deep_progs "$GOOD_PROG" "xifp-100-exp-P" \
544
      '/* { dg-xfail-if "no match" { ' "{ $BADXPR }" ' } { "*" } { "" } } */'
545
    deep_progs "$BADC_PROG" "xifn-100-exp-U" \
546
      '/* { dg-skip-if "match" { ' "{ $GOODXPR }" ' } { "*" } { "" } } */'
547
    deep_progs "$GOOD_PROG" "xifs-100-exp-P" \
548
      '/* { dg-skip-if "match" { ' "{ $BADXPR }" ' } { "*" } { "" } } */'
549
    deep_progs "$GOOD_PROG" "satn-100-exp-P" \
550
      '/* { dg-final { scan-assembler-not "unexpected garbage" { target ' \
551
      "$GOODXPR" ' } } } */'
552
    deep_progs "$GOOD_PROG" "satn-100-exp-U" \
553
      '/* { dg-final { scan-assembler-not "unexpected garbage" { target ' \
554
      "$BADXPR" ' } } } */'
555
    deep_progs "$GOOD_PROG" "satf-100-exp-XP" \
556
      '/* { dg-final { scan-assembler-not "unexpected garbage" { xfail ' \
557
      "$GOODXPR" ' } } } */'
558
    deep_progs "$GOOD_PROG" "satp-100-exp-P" \
559
      '/* { dg-final { scan-assembler-not "unexpected garbage" { xfail ' \
560
      "$BADXPR" ' } } } */'
561
}
562
 
563
selector_good
564
selector_bad
565
selector_deep
566
 
567
one_all saxp $EXP_PASS no
568
one_all saxf $EXP_XPASS no
569
one_all sats $EXP_PASS no
570
one_all satn $EXP_SKIP no
571
one_all dots $EXP_PASS yes
572
one_all dotn $EXP_SKIP no
573
one_all doxp $EXP_PASS yes
574
one_all doxf $EXP_XPASS yes
575
one_all sifs $EXP_PASS yes
576
one_all sifn $EXP_SKIP no
577
one_all xifp $EXP_PASS yes
578
one_all xiff $EXP_XPASS yes
579
one_all reqs $EXP_PASS yes
580
one_all reqn $EXP_SKIP no
581
 
582
two_all dots xifp $EXP_PASS yes
583
two_all dots xiff $EXP_XPASS yes
584
two_all dots sifs $EXP_PASS yes
585
two_all dots sifn $EXP_SKIP no
586
two_all dotn xifp $EXP_SKIP no
587
two_all dotn sifs $EXP_SKIP no
588
two_all dotn sifn $EXP_SKIP no
589
two_all dotn xiff $EXP_SKIP no
590
two_all dots reqs $EXP_PASS yes
591
two_all dots reqn $EXP_SKIP no
592
two_all dotn reqs $EXP_SKIP no
593
two_all dotn reqn $EXP_SKIP no
594
 
595
two_all doxp xifp $EXP_PASS yes
596
two_all doxp xiff $EXP_PASS yes   # dg-xfail-if applies to compile, not run
597
two_all doxp sifs $EXP_PASS yes
598
two_all doxp sifn $EXP_SKIP no
599
two_all doxf xifp $EXP_XPASS yes
600
two_all doxf xiff $EXP_XPASS yes
601
two_all doxf sifs $EXP_XPASS yes
602
two_all doxf sifn $EXP_SKIP no
603
 
604
two_all doxp reqs $EXP_PASS yes
605
two_all doxp reqn $EXP_SKIP no
606
two_all doxf reqs $EXP_XPASS yes
607
two_all doxf reqn $EXP_SKIP no
608
 
609
two_all reqs xifp $EXP_PASS yes
610
two_all reqs xiff $EXP_XPASS yes
611
two_all reqs sifs $EXP_PASS yes
612
two_all reqs sifn $EXP_SKIP no
613
two_all reqn xifp $EXP_SKIP no
614
two_all reqn xiff $EXP_SKIP no
615
two_all reqn sifs $EXP_SKIP no
616
two_all reqn sifn $EXP_SKIP no
617
 
618
two_all xifp reqs $EXP_PASS yes
619
two_all xiff reqs $EXP_XPASS yes
620
two_all sifs reqs $EXP_PASS yes
621
two_all sifn reqs $EXP_SKIP no
622
two_all xifp reqn $EXP_SKIP no
623
two_all xiff reqn $EXP_SKIP no
624
two_all sifs reqn $EXP_SKIP no
625
two_all sifn reqn $EXP_SKIP no
626
 
627
three_all dots reqs xifp $EXP_PASS yes
628
three_all dots reqs xiff $EXP_XPASS yes
629
three_all dots reqs sifs $EXP_PASS yes
630
three_all dots reqs sifn $EXP_SKIP no
631
three_all dots reqn xifp $EXP_SKIP no
632
three_all dots reqn xiff $EXP_SKIP no
633
three_all dots reqn sifs $EXP_SKIP no
634
three_all dots reqn sifn $EXP_SKIP no
635
three_all dotn reqs xifp $EXP_SKIP no
636
three_all dotn reqs xiff $EXP_SKIP no
637
three_all dotn reqs sifs $EXP_SKIP no
638
three_all dotn reqs sifn $EXP_SKIP no
639
three_all dotn reqn xifp $EXP_SKIP no
640
three_all dotn reqn xiff $EXP_SKIP no
641
three_all dotn reqn sifs $EXP_SKIP no
642
three_all dotn reqn sifn $EXP_SKIP no
643
#
644
three_all dots xifp reqs $EXP_PASS yes
645
three_all dots xiff reqs $EXP_XPASS yes
646
three_all dots sifs reqs $EXP_PASS yes
647
three_all dots sifn reqs $EXP_SKIP no
648
three_all dots xifp reqn $EXP_SKIP no
649
three_all dots xiff reqn $EXP_SKIP no
650
three_all dots sifs reqn $EXP_SKIP no
651
three_all dots sifn reqn $EXP_SKIP no
652
three_all dotn xifp reqs $EXP_SKIP no
653
three_all dotn xiff reqs $EXP_SKIP no
654
three_all dotn sifs reqs $EXP_SKIP no
655
three_all dotn sifn reqs $EXP_SKIP no
656
three_all dotn xifp reqn $EXP_SKIP no
657
three_all dotn xiff reqn $EXP_SKIP no
658
three_all dotn sifs reqn $EXP_SKIP no
659
three_all dotn sifn reqn $EXP_SKIP no
660
 
661
three_all doxp reqs xifp $EXP_PASS yes
662
three_all doxp reqs xiff $EXP_PASS yes # dg-xfail-if applies to compile, not run
663
three_all doxp reqs sifs $EXP_PASS yes
664
three_all doxp reqs sifn $EXP_SKIP no
665
three_all doxp reqn xifp $EXP_SKIP no
666
three_all doxp reqn xiff $EXP_SKIP no
667
three_all doxp reqn sifs $EXP_SKIP no
668
three_all doxp reqn sifn $EXP_SKIP no
669
three_all doxf reqs xifp $EXP_XPASS yes
670
three_all doxf reqs xiff $EXP_XPASS yes
671
three_all doxf reqs sifs $EXP_XPASS yes
672
three_all doxf reqs sifn $EXP_SKIP no
673
three_all doxf reqn xifp $EXP_SKIP no
674
three_all doxf reqn xiff $EXP_SKIP no
675
three_all doxf reqn sifs $EXP_SKIP no
676
three_all doxf reqn sifn $EXP_SKIP no
677
 
678
three_all doxp xifp reqs $EXP_PASS yes
679
three_all doxp xiff reqs $EXP_PASS yes # dg-xfail-if applies to compile, not run
680
three_all doxp sifs reqs $EXP_PASS yes
681
three_all doxp sifn reqs $EXP_SKIP no
682
three_all doxp xifp reqn $EXP_SKIP no
683
three_all doxp xiff reqn $EXP_SKIP no
684
three_all doxp sifs reqn $EXP_SKIP no
685
three_all doxp sifn reqn $EXP_SKIP no
686
three_all doxf xifp reqs $EXP_XPASS yes
687
three_all doxf xiff reqs $EXP_XPASS yes
688
three_all doxf sifs reqs $EXP_XPASS yes
689
three_all doxf sifn reqs $EXP_SKIP no
690
three_all doxf xifp reqn $EXP_SKIP no
691
three_all doxf xiff reqn $EXP_SKIP no
692
three_all doxf sifs reqn $EXP_SKIP no
693
three_all doxf sifn reqn $EXP_SKIP no

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.