2016-06-18 22:53:25 +00:00
#!/bin/sh -ex
2017-11-29 03:52:27 +00:00
type sudo >/dev/null 2>& 1 && sudo = sudo || sudo =
2018-05-06 22:44:45 +02:00
common_packages = 'autoconf automake faketime file gawk gcc-multilib git gzip libbluetooth-dev make xz-utils'
2017-11-29 03:52:27 +00:00
2018-07-03 13:23:19 +00:00
retry_if_failed( )
{
for i in ` seq 0 99` ; do
" $@ " && i = && break || sleep 1
done
[ -z " $i " ]
}
2016-06-18 22:53:25 +00:00
updated =
apt_get_install( )
{
[ -n " $updated " ] || {
2018-07-03 13:23:19 +00:00
retry_if_failed $sudo apt-get -qq update
2016-06-18 22:53:25 +00:00
updated = 1
}
2018-07-03 13:23:19 +00:00
retry_if_failed $sudo \
apt-get -qq --no-install-suggests --no-install-recommends \
2016-06-18 22:53:25 +00:00
install -y " $@ "
}
2018-03-13 15:12:14 +00:00
git_installed =
clone_repo( )
{
2018-06-06 15:10:37 +00:00
local src dst branch
2018-03-13 15:12:14 +00:00
src = " $1 " ; shift
dst = " $1 " ; shift
2018-06-06 15:10:37 +00:00
branch = " ${ 1 - } "
2018-03-13 15:12:14 +00:00
[ -n " $git_installed " ] || {
apt_get_install git ca-certificates
git_installed = 1
}
2018-03-13 15:12:14 +00:00
case " $src " in
*://*) ; ;
*) local url path
url = " $( git config remote.origin.url) "
path = " ${ url #* : //*/ } "
src = " ${ url % $path } $src "
; ;
esac
2018-07-03 13:23:19 +00:00
retry_if_failed \
git clone --depth= 1 ${ branch : +--branch $branch } " $src " " $dst "
2018-03-13 15:12:14 +00:00
}
2018-08-19 10:26:18 +00:00
case " $CC " in
gcc-*)
retry_if_failed \
$sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt_get_install $common_packages " $CC " -multilib
; ;
clang*)
apt_get_install $common_packages " $CC "
; ;
*)
apt_get_install $common_packages
; ;
esac
2017-04-13 18:24:09 +00:00
case " $KHEADERS " in
*/*)
2018-06-06 15:10:37 +00:00
clone_repo https://github.com/" $KHEADERS " kernel ${ KBRANCH - }
2017-11-29 03:52:27 +00:00
$sudo make -C kernel headers_install INSTALL_HDR_PATH = /opt/kernel
$sudo rm -rf kernel
2017-04-13 18:24:09 +00:00
KHEADERS_INC = /opt/kernel/include
; ;
*)
KHEADERS_INC = /usr/include
; ;
esac
2016-06-18 22:53:25 +00:00
case " $CC " in
musl-gcc)
2018-03-13 15:12:14 +00:00
clone_repo strace/musl musl
2016-08-04 00:40:33 +00:00
cd musl
CC = gcc
2016-09-08 17:11:51 +00:00
build =
case " ${ TARGET - } " in
x32)
CC = " $CC -mx32 "
; ;
x86)
CC = " $CC -m32 "
build = '--build=i686-pc-linux-gnu --target=i686-pc-linux-gnu'
; ;
esac
./configure --prefix= /opt/musl --exec-prefix= /usr ${ build }
2016-08-04 00:40:33 +00:00
make
2017-11-29 03:52:27 +00:00
$sudo make install
2016-08-04 00:40:33 +00:00
cd -
rm -rf musl
2017-11-29 03:52:27 +00:00
$sudo ln -s \
2017-04-13 18:24:09 +00:00
$KHEADERS_INC /asm* \
$KHEADERS_INC /linux \
$KHEADERS_INC /mtd \
2016-08-04 00:40:33 +00:00
/opt/musl/include/
2016-06-18 22:53:25 +00:00
; ;
esac
ci: add more variants of unwinder to test matrices
Check x86_64 builds with libdw, with libunwind, and without stacktrace.
As Travis CI doesn't provide a suitable libdw, do not test libdw there.
* ci/install-dependencies.sh (common_packages): Remove libdw-dev.
Install libdw-dev or libunwind8-dev depending on $STACKTRACE.
* ci/run-build-and-tests.sh: Specify --with-libdw=yes,
--with-libunwind=yes, or --without-stacktrace depending on $STACKTRACE.
* .gitlab-ci.yml (gcc-x86_64): Rename to gcc-x86_64-libdw,
add STACKTRACE=libdw.
(gcc-x86): Rename to gcc-x86-nounwind, add STACKTRACE=no.
(clang-x86_64): Rename to clang-x86_64-libdw, add STACKTRACE=libdw.
(clang-x86): Rename to clang-x86-nounwind, add STACKTRACE=no.
(gcc-x86_64-libunwind, gcc-x86_64-nounwind, gcc-x86-nounwind,
clang-x86_64-libunwind, clang-x86_64-nounwind, clang-x86-nounwind):
New test matrix entries.
* .travis.yml: Add STACKTRACE=libunwind to all x86_64 test matrix
entries except musl-gcc, add STACKTRACE=no to other matrix entries,
add test matrix entries with STACKTRACE=no variants on x86_64.
2018-05-04 23:13:45 +00:00
case " ${ STACKTRACE - } " in
libdw)
2018-05-05 14:38:38 +00:00
apt_get_install libdw-dev
ci: add more variants of unwinder to test matrices
Check x86_64 builds with libdw, with libunwind, and without stacktrace.
As Travis CI doesn't provide a suitable libdw, do not test libdw there.
* ci/install-dependencies.sh (common_packages): Remove libdw-dev.
Install libdw-dev or libunwind8-dev depending on $STACKTRACE.
* ci/run-build-and-tests.sh: Specify --with-libdw=yes,
--with-libunwind=yes, or --without-stacktrace depending on $STACKTRACE.
* .gitlab-ci.yml (gcc-x86_64): Rename to gcc-x86_64-libdw,
add STACKTRACE=libdw.
(gcc-x86): Rename to gcc-x86-nounwind, add STACKTRACE=no.
(clang-x86_64): Rename to clang-x86_64-libdw, add STACKTRACE=libdw.
(clang-x86): Rename to clang-x86-nounwind, add STACKTRACE=no.
(gcc-x86_64-libunwind, gcc-x86_64-nounwind, gcc-x86-nounwind,
clang-x86_64-libunwind, clang-x86_64-nounwind, clang-x86-nounwind):
New test matrix entries.
* .travis.yml: Add STACKTRACE=libunwind to all x86_64 test matrix
entries except musl-gcc, add STACKTRACE=no to other matrix entries,
add test matrix entries with STACKTRACE=no variants on x86_64.
2018-05-04 23:13:45 +00:00
; ;
libunwind)
apt_get_install libunwind8-dev
; ;
esac
2016-12-18 00:12:48 +00:00
case " ${ CHECK - } " in
coverage)
apt_get_install lcov
2018-07-03 13:23:19 +00:00
retry_if_failed \
pip install --user codecov
2016-12-18 00:12:48 +00:00
; ;
2017-07-22 18:46:16 +00:00
valgrind)
apt_get_install valgrind
; ;
2016-12-18 00:12:48 +00:00
esac