2019-05-05 23:00:38 +03:00
#!/bin/bash
set -e
set -x
2019-05-12 06:57:10 +03:00
set -u
REPO_ROOT = ${ REPO_ROOT :- $( pwd ) }
2019-05-05 23:00:38 +03:00
2019-05-14 14:47:56 +03:00
sudo bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list"
2019-05-09 00:23:55 +03:00
sudo apt-get update -y
sudo apt-get build-dep systemd -y
2019-07-08 22:28:10 +03:00
sudo apt-get install -y ninja-build python3-pip python3-setuptools quota
2019-12-17 21:19:02 +03:00
# The following should be dropped when debian packaging has been updated to include them
2019-11-21 01:34:21 +03:00
sudo apt-get install -y libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
2020-01-25 19:48:23 +03:00
pip3 install meson
2019-05-09 00:23:55 +03:00
2019-05-05 23:00:38 +03:00
cd $REPO_ROOT
2019-05-14 14:47:56 +03:00
export PATH = " $HOME /.local/bin/: $PATH "
2019-05-09 00:23:55 +03:00
tools/oss-fuzz.sh
2020-02-18 01:54:42 +03:00
./out/fuzz-unit-file -max_total_time= 5
2019-05-09 00:23:55 +03:00
git clean -dxff
2019-05-06 01:15:28 +03:00
git clone https://github.com/google/oss-fuzz /tmp/oss-fuzz
cd /tmp/oss-fuzz
sudo ./infra/helper.py pull_images
2019-05-12 06:57:10 +03:00
2019-05-16 18:53:57 +03:00
# docker doesn't like colons in filenames so let's create a directory
# whose name can be consumed by the -v option.
# https://github.com/google/oss-fuzz/issues/2428
t = $( mktemp -d)
sudo mount --bind " $REPO_ROOT " " $t "
2019-05-12 06:57:10 +03:00
# helper.py is wrapped in script to trick it into thinking it's "interactive"
# See https://github.com/systemd/systemd/pull/12542#issuecomment-491563572
2019-05-16 18:53:57 +03:00
sudo script -e -c " ./infra/helper.py build_fuzzers --clean --sanitizer=memory systemd $t "
2019-05-16 06:48:06 +03:00
sudo script -e -c "./infra/helper.py check_build --sanitizer=memory -e ALLOWED_BROKEN_TARGETS_PERCENTAGE=0 systemd"