blob: 893fd9e216f2f4e06a9eb1f1b70acc099e72176e (
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
|
#!/bin/bash
user_workspace="$PWD"
tcwg_regression_rev=master
getopt -o w:t:h -l tarball:,workspace:,help,tcwg-regression-rev: -Q
while test $# -gt 0; do
case $1 in
-w|--workspace) user_workspace=$2; shift ;;
-t|--tarball) tarball_url=$2; shift ;;
--tcwg-regression-rev) tcwg_regression_rev=$2; shift ;;
--) break ;;
esac
shift
done
testdir=${user_workspace}/_test
# Create a test directory
if test ! -d ${testdir}; then
mkdir -p ${testdir}
fi
. jenkins-helpers.sh
url_basename=$(basename "$tarball_url")
rm -f $url_basename
wget_wildcard_url "$tarball_url"
file="$(ls $url_basename)"
mv $file $testdir/
file="$(basename "$file")"
tarball_name="${testdir}/${file}"
# Extract the tarball
dir="`echo ${file} | sed -e 's:.tar.xz::'`"
tar Jxf ${tarball_name} --directory=${testdir}
if test $? -gt 0; then
echo "ERROR: ${tarball_name} is corrupted!"
exit 1
fi
# Create a simple test case
if test ! -e ${testdir}/hello.cpp; then
# Create the usual Hello World! test case
cat <<EOF > ${testdir}/hello.cpp
#include <iostream>
int
main(int argc, char *argv[])
{
std::cout << "Hello World!" << std::endl;
}
EOF
fi
target="`echo ${dir} | egrep -o '(arm|aarch64)[_0-9a-z-]*' | sed -e 's:-\$::'`"
host="`echo "$dir" | grep -oP '\-[0-9]{4}\.[0-9]{1,2}\-(rc[0-9]+\-)?\\K.*' | sed -r 's:_?'"$target"'::'`"
win32="`echo ${file} | grep -c mingw`"
# We want to execute as many tests as possible, and not stop on the
# first failing one.
status=0
# For Windows releases, check for symlinks in the release tarball. Some
# extractors for Windows do not handle symlinks well, so Abe should
# generate tarballs without symlinks.
if test ${win32} -ne 0; then
find "${testdir}" -type l > ${testdir}/symlinks.txt 2>&1
SYMLINKS="$(grep -c ^ ${testdir}/symlinks.txt)"
if [ "$SYMLINKS" -eq 0 ]; then
echo "PASS: No symlinks found in release"
else
cat ${testdir}/symlinks.txt
echo "FAILED: Found symlinks in release"
status=1
fi
fi
# Bare metal builds need special care
baremetal="`echo ${target} | egrep -c "\-eabi|\-elf"`"
if test ${baremetal} -gt 0; then
case ${target} in
aarch64*)
# AArch64 needs specs
rdimon="`find ${testdir} -name rdimon.specs | head -1`"
specs="${rdimon:+--specs=${rdimon}}"
;;
arm*)
# ARM does not need specs, but the default cpu implies
# undefined references to __sync_synchronize
specs="-mcpu=cortex-a9"
;;
esac
fi
# Compile the test case
rm -f ${testdir}/hi
params="-o ${testdir}/hi ${testdir}/hello.cpp ${specs-} -static"
if test ${win32} -eq 0; then
${testdir}/${dir}/bin/${target}-c++ ${params}
else
# Compilation may fail if the paths are too long.
# Create a G: drive, as a shortcut makes wine automagically use
# it.
# Make sure WINEPREFIX exists by running a dummy command
declare WINEPREFIX
WINEPREFIX="$(pwd)/dotwine"
export WINEPREFIX
echo "ECHO Hello" | wine cmd
rm -f ${WINEPREFIX}/dosdevices/g:
ln -s ${testdir}/${dir} ${WINEPREFIX}/dosdevices/g:
wine ${testdir}/${dir}/bin/${target}-c++ ${params}
fi
# See if the compilation worked
if test -e ${testdir}/hi; then
echo PASS: Compilation of hello.cpp
else
echo FAILED: Compilation of hello.cpp
status=1
fi
clone_or_update_repo tcwg-regression $tcwg_regression_rev https://git-us.linaro.org/toolchain/tcwg-regression
make -C tcwg-regression check TOOLCHAIN=${testdir}/${dir} TARGET=${target} HOST=${host}
if [ $? -ne 0 ]; then
echo "TCWG regression tests FAILED"
status=1
fi
exit $status
|