]> git.ipfire.org Git - thirdparty/systemd.git/blame - travis-ci/managers/debian.sh
ci: add new dependencies to CI
[thirdparty/systemd.git] / travis-ci / managers / debian.sh
CommitLineData
1478aa4e
EV
1#!/bin/bash
2
3# Run this script from the root of the systemd's git repository
4# or set REPO_ROOT to a correct path.
5#
6# Example execution on Fedora:
7# dnf install docker
8# systemctl start docker
9# export CONT_NAME="my-fancy-container"
10# travis-ci/managers/debian.sh SETUP RUN CLEANUP
11
12PHASES=(${@:-SETUP RUN RUN_ASAN CLEANUP})
13DEBIAN_RELEASE="${DEBIAN_RELEASE:-testing}"
14CONT_NAME="${CONT_NAME:-debian-$DEBIAN_RELEASE-$RANDOM}"
15DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
16DOCKER_RUN="${DOCKER_RUN:-docker run}"
17REPO_ROOT="${REPO_ROOT:-$PWD}"
9fd1a0ba
ZJS
18ADDITIONAL_DEPS=(python3-libevdev
19 python3-pyparsing
20 clang
e65f29b4 21 perl
0edd431e 22 libpwquality-dev
e65f29b4
LP
23 libfdisk-dev
24 libp11-kit-dev
25 libssl-dev)
1478aa4e
EV
26
27function info() {
28 echo -e "\033[33;1m$1\033[0m"
29}
30
31set -e
32
33source "$(dirname $0)/travis_wait.bash"
34
35for phase in "${PHASES[@]}"; do
36 case $phase in
37 SETUP)
38 info "Setup phase"
39 info "Using Debian $DEBIAN_RELEASE"
ee6776b4 40 printf "FROM debian:$DEBIAN_RELEASE\nRUN bash -c 'apt-get -y update && apt-get install -y systemd'\n" | docker build -t debian-with-systemd/latest -
1478aa4e 41 info "Starting container $CONT_NAME"
75acb946 42 $DOCKER_RUN -v $REPO_ROOT:/build:rw -e container=docker \
1478aa4e 43 -w /build --privileged=true --name $CONT_NAME \
c5b4b18e 44 -dit --net=host debian-with-systemd/latest /bin/systemd
1478aa4e 45 $DOCKER_EXEC bash -c "echo deb-src http://deb.debian.org/debian $DEBIAN_RELEASE main >>/etc/apt/sources.list"
14157349
FS
46 # Wait for the container to properly boot up, otherwise we were
47 # running following apt-get commands during the initializing/starting
48 # (early/late bootup) phase, which caused nasty race conditions
49 $DOCKER_EXEC bash -c 'systemctl is-system-running --wait || :'
1478aa4e
EV
50 $DOCKER_EXEC apt-get -y update
51 $DOCKER_EXEC apt-get -y build-dep systemd
52 $DOCKER_EXEC apt-get -y install "${ADDITIONAL_DEPS[@]}"
53 ;;
89347371
EV
54 RUN|RUN_CLANG)
55 if [[ "$phase" = "RUN_CLANG" ]]; then
56 ENV_VARS="-e CC=clang -e CXX=clang++"
57 fi
0b0673b6 58 docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true -Dman=true build
1478aa4e 59 $DOCKER_EXEC ninja -v -C build
c47bfb19 60 docker exec -e "TRAVIS=$TRAVIS" -it $CONT_NAME ninja -C build test
1478aa4e 61 ;;
1478aa4e
EV
62 RUN_ASAN|RUN_CLANG_ASAN)
63 if [[ "$phase" = "RUN_CLANG_ASAN" ]]; then
64 ENV_VARS="-e CC=clang -e CXX=clang++"
65 MESON_ARGS="-Db_lundef=false" # See https://github.com/mesonbuild/meson/issues/764
66 fi
67 docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Db_sanitize=address,undefined -Dsplit-usr=true $MESON_ARGS build
68 $DOCKER_EXEC ninja -v -C build
69
70 # Never remove halt_on_error from UBSAN_OPTIONS. See https://github.com/systemd/systemd/commit/2614d83aa06592aedb.
71 travis_wait docker exec --interactive=false \
72 -e UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 \
73 -e ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 \
74 -e "TRAVIS=$TRAVIS" \
75 -t $CONT_NAME \
76 meson test --timeout-multiplier=3 -C ./build/ --print-errorlogs
77 ;;
78 CLEANUP)
79 info "Cleanup phase"
80 docker stop $CONT_NAME
81 docker rm -f $CONT_NAME
82 ;;
83 *)
84 echo >&2 "Unknown phase '$phase'"
85 exit 1
86 esac
87done