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
2020-01-08 12:44:10 +03:00
# FIXME: temporarily pin the meson version as 0.53 doesn't work with older python 3.5
# See: https://github.com/mesonbuild/meson/issues/6427
pip3 install meson = = 0.52.1
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
timeout --preserve-status 5 ./out/fuzz-unit-file
git clean -dxff
2019-05-05 23:00:38 +03:00
wget https://app.fuzzbuzz.io/releases/cli/latest/linux/fuzzbuzz
chmod +x fuzzbuzz
./fuzzbuzz validate
./fuzzbuzz target test fuzz-unit-file --all
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"