blob: bfbe26f25c339bef56b416520d0fa1421903e9ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
source tests-common.sh
inherit toolchain-funcs
#
# TEST: tc-arch-kernel
#
test-tc-arch-kernel() {
local ret=0
KV=$1 ; shift
for CHOST in "$@" ; do
exp=${CHOST##*:}
CHOST=${CHOST%%:*}
actual=$(tc-arch-kernel)
if [[ ${actual} != ${exp:-${CHOST}} ]] ; then
eerror "Failure for CHOST: ${CHOST} Expected: ${exp} != Actual: ${actual}"
((++ret))
fi
done
return ${ret}
}
tbegin "tc-arch-kernel() (KV=2.6.30)"
test-tc-arch-kernel 2.6.30 \
i{3..6}86:x86 x86_64:x86 \
powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386
tend $?
#
# TEST: tc-arch
#
tbegin "tc-arch"
ret=0
for CHOST in \
alpha arm{,eb}:arm avr32:avr bfin cris hppa i{3..6}86:x86 ia64 m68k \
mips{,eb}:mips nios2 powerpc:ppc powerpc64:ppc64 s390{,x}:s390 \
sh{1..4}{,eb}:sh sparc{,64}:sparc vax x86_64:amd64
do
exp=${CHOST##*:}
CHOST=${CHOST%%:*}
actual=$(tc-arch)
if [[ ${actual} != ${exp:-${CHOST}} ]] ; then
eerror "Failure for CHOST: ${CHOST} Expected: ${exp} != Actual: ${actual}"
: $((++ret))
fi
done
tend ${ret}
#
# TEST: tc-ld-is-gold
#
tbegin "tc-ld-is-gold (bfd selected)"
LD=ld.bfd tc-ld-is-gold && ret=1 || ret=0
tend ${ret}
tbegin "tc-ld-is-gold (gold selected)"
LD=ld.gold tc-ld-is-gold
ret=$?
tend ${ret}
tbegin "tc-ld-is-gold (bfd selected via flags)"
LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold
ret=$?
tend ${ret}
tbegin "tc-ld-is-gold (gold selected via flags)"
LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold
ret=$?
tend ${ret}
#
# TEST: tc-ld-disable-gold
#
tbegin "tc-ld-disable-gold (bfd selected)"
(
export LD=ld.bfd LDFLAGS=
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == "ld.bfd" && -z ${LDFLAGS} ]]
)
tend $?
tbegin "tc-ld-disable-gold (gold selected)"
(
export LD=ld.gold LDFLAGS=
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]]
)
tend $?
tbegin "tc-ld-disable-gold (gold selected via flags)"
(
export LD= LDFLAGS="-fuse-ld=gold"
ewarn() { :; }
tc-ld-disable-gold
[[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]]
)
tend $?
unset CPP
tbegin "tc-get-compiler-type (gcc)"
(
export CC=gcc
[[ $(tc-get-compiler-type) == gcc ]]
)
tend $?
tbegin "tc-is-gcc (gcc)"
(
export CC=gcc
tc-is-gcc
)
tend $?
tbegin "! tc-is-clang (gcc)"
(
export CC=gcc
! tc-is-clang
)
tend $?
if type -P clang &>/dev/null; then
tbegin "tc-get-compiler-type (clang)"
(
export CC=clang
[[ $(tc-get-compiler-type) == clang ]]
)
tend $?
tbegin "! tc-is-gcc (clang)"
(
export CC=clang
! tc-is-gcc
)
tend $?
tbegin "tc-is-clang (clang)"
(
export CC=clang
tc-is-clang
)
tend $?
fi
if type -P pathcc &>/dev/null; then
tbegin "tc-get-compiler-type (pathcc)"
(
export CC=pathcc
[[ $(tc-get-compiler-type) == pathcc ]]
)
tend $?
tbegin "! tc-is-gcc (pathcc)"
(
export CC=pathcc
! tc-is-gcc
)
tend $?
tbegin "! tc-is-clang (pathcc)"
(
export CC=pathcc
! tc-is-clang
)
tend $?
fi
texit
|