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 =
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
common_packages = 'autoconf automake faketime file gawk gcc-multilib git gzip make pkg-config xz-utils'
2017-11-29 03:52:27 +00:00
2016-06-18 22:53:25 +00:00
updated =
apt_get_install( )
{
[ -n " $updated " ] || {
2017-11-29 03:52:27 +00:00
$sudo apt-get -qq update
2016-06-18 22:53:25 +00:00
updated = 1
}
2017-11-29 03:52:27 +00:00
$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( )
{
local src dst
src = " $1 " ; shift
dst = " $1 " ; shift
[ -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-03-13 15:12:14 +00:00
git clone --depth= 1 " $src " " $dst "
}
2017-04-13 18:24:09 +00:00
case " $KHEADERS " in
*/*)
2018-03-13 15:12:14 +00:00
clone_repo https://github.com/" $KHEADERS " kernel
apt_get_install $common_packages
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
gcc)
2017-11-29 03:52:27 +00:00
apt_get_install $common_packages
2016-06-18 22:53:25 +00:00
; ;
2017-04-12 03:06:32 +00:00
gcc-*)
2017-11-29 03:52:27 +00:00
$sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt_get_install $common_packages " $CC " -multilib
2017-04-12 03:06:32 +00:00
; ;
2017-11-29 03:52:27 +00:00
clang*)
apt_get_install $common_packages " $CC "
2016-06-18 22:53:25 +00:00
; ;
musl-gcc)
2018-03-13 15:12:14 +00:00
clone_repo strace/musl musl
2018-03-13 15:12:14 +00:00
apt_get_install $common_packages
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)
apt_get_install libdw-dev libz-dev liblzma-dev
; ;
libunwind)
apt_get_install libunwind8-dev
; ;
esac
2016-12-18 00:12:48 +00:00
case " ${ CHECK - } " in
coverage)
apt_get_install lcov
pip install --user codecov
; ;
2017-07-22 18:46:16 +00:00
valgrind)
apt_get_install valgrind
; ;
2016-12-18 00:12:48 +00:00
esac