]> git.ipfire.org Git - thirdparty/systemd.git/blame - travis-ci/managers/fedora.sh
ci: add dependencies for repart + cryptsetup's pkcs#11 support
[thirdparty/systemd.git] / travis-ci / managers / fedora.sh
CommitLineData
a9145fc4
FS
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:
0d589dfc 7# dnf install docker
a9145fc4
FS
8# systemctl start docker
9# export CONT_NAME="my-fancy-container"
10# travis-ci/managers/fedora.sh SETUP RUN CLEANUP
11
79f6178e 12PHASES=(${@:-SETUP RUN RUN_ASAN CLEANUP})
a9145fc4
FS
13FEDORA_RELEASE="${FEDORA_RELEASE:-rawhide}"
14CONT_NAME="${CONT_NAME:-fedora-$FEDORA_RELEASE-$RANDOM}"
15DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
16DOCKER_RUN="${DOCKER_RUN:-docker run}"
17REPO_ROOT="${REPO_ROOT:-$PWD}"
9fd1a0ba 18ADDITIONAL_DEPS=(dnf-plugins-core
738606e4 19 jq iputils
9fd1a0ba
ZJS
20 hostname libasan
21 python3-pyparsing
22 python3-evdev
23 libubsan
24 clang
25 llvm
e65f29b4
LP
26 perl
27 libfdisk-devel
28 openssl-devel
29 p11-kit-devel)
a9145fc4
FS
30
31function info() {
32 echo -e "\033[33;1m$1\033[0m"
33}
34
35set -e
36
d419b75c
EV
37source "$(dirname $0)/travis_wait.bash"
38
a9145fc4
FS
39for phase in "${PHASES[@]}"; do
40 case $phase in
41 SETUP)
42 info "Setup phase"
43 info "Using Fedora $FEDORA_RELEASE"
a9145fc4
FS
44 # Pull a Docker image and start a new container
45 docker pull fedora:$FEDORA_RELEASE
46 info "Starting container $CONT_NAME"
47 $DOCKER_RUN -v $REPO_ROOT:/build:rw \
a9145fc4
FS
48 -w /build --privileged=true --name $CONT_NAME \
49 -dit --net=host fedora:$FEDORA_RELEASE /sbin/init
14157349
FS
50 # Wait for the container to properly boot up, otherwise we were
51 # running following dnf commands during the initializing/starting
52 # (early/late bootup) phase, which caused nasty race conditions
53 $DOCKER_EXEC bash -c 'systemctl is-system-running --wait || :'
a9145fc4
FS
54 $DOCKER_EXEC dnf makecache
55 # Install necessary build/test requirements
532a92fb 56 $DOCKER_EXEC dnf -y --exclude selinux-policy\* upgrade
a9145fc4
FS
57 $DOCKER_EXEC dnf -y install "${ADDITIONAL_DEPS[@]}"
58 $DOCKER_EXEC dnf -y builddep systemd
59 ;;
60 RUN)
61 info "Run phase"
62 # Build systemd
7970a525 63 $DOCKER_EXEC meson --werror -Dtests=unsafe -Dslow-tests=true build
eeec5f2a 64 $DOCKER_EXEC ninja -v -C build
1667d63a 65 $DOCKER_EXEC ninja -C build test
79f6178e 66 ;;
37cbcd46 67 RUN_CLANG)
0b0673b6 68 docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dman=true build
37cbcd46
EV
69 $DOCKER_EXEC ninja -v -C build
70 $DOCKER_EXEC ninja -C build test
71 ;;
b8366c54
EV
72 RUN_ASAN|RUN_CLANG_ASAN)
73 if [[ "$phase" = "RUN_CLANG_ASAN" ]]; then
74 ENV_VARS="-e CC=clang -e CXX=clang++"
75 MESON_ARGS="-Db_lundef=false" # See https://github.com/mesonbuild/meson/issues/764
76 fi
77 docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Db_sanitize=address,undefined $MESON_ARGS build
1667d63a 78 $DOCKER_EXEC ninja -v -C build
6dfe7f43
EV
79
80 # Never remove halt_on_error from UBSAN_OPTIONS. See https://github.com/systemd/systemd/commit/2614d83aa06592aedb.
b6b35f0e
EV
81 travis_wait docker exec --interactive=false \
82 -e UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 \
83 -e ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 \
f5f9a580 84 -e "TRAVIS=$TRAVIS" \
b6b35f0e
EV
85 -t $CONT_NAME \
86 meson test --timeout-multiplier=3 -C ./build/ --print-errorlogs
a9145fc4
FS
87 ;;
88 CLEANUP)
89 info "Cleanup phase"
90 docker stop $CONT_NAME
91 docker rm -f $CONT_NAME
92 ;;
93 *)
94 echo >&2 "Unknown phase '$phase'"
95 exit 1
96 esac
97done