Skip to content

Commit 63f7dc7

Browse files
committed
fuzz: Better log from installation script
Print last commit from each git repo. Also use master branch for zlib.
1 parent a2b2c6a commit 63f7dc7

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

tests/fuzz/oss-fuzz-build.sh

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ in_oss_fuzz()
55
test -n "$FUZZING_ENGINE"
66
}
77

8-
echo "Running cryptsetup OSS-Fuzz build script."
9-
env
10-
set -ex
8+
last_commit()
9+
{
10+
echo "$(git -C "$1" log --format="%h %s" -n 1) ($1)"
11+
}
12+
13+
echo "Running cryptsetup OSS-Fuzz build script for ${SANITIZER:-address} sanitizer."
14+
#env ; set -x
15+
set -e
1116
XPWD="$(pwd)"
1217

1318
export LC_CTYPE=C.UTF-8
@@ -36,6 +41,7 @@ mkdir -p $OUT
3641
mkdir -p $DEPS_PATH
3742
cd $SRC
3843

44+
echo "Installing dependencies"
3945
LIBFUZZER_PATCH="$XPWD/unpoison-mutated-buffers-from-libfuzzer.patch"
4046
in_oss_fuzz && LIBFUZZER_PATCH="$XPWD/cryptsetup/tests/fuzz/unpoison-mutated-buffers-from-libfuzzer.patch"
4147

@@ -44,20 +50,40 @@ in_oss_fuzz && apt-get update && apt-get install -y \
4450
sharutils gettext expect keyutils ninja-build \
4551
bison flex
4652

47-
[ ! -d zlib ] && git clone --depth 1 https://github.com/madler/zlib.git
53+
echo "Cloning git repositories"
54+
# FIXME: temporary use branch master instead of develop
55+
[ ! -d zlib ] && git clone -q --depth 1 --branch master https://github.com/madler/zlib.git
56+
last_commit zlib
57+
4858
# Upstream repo has disabled cloning https://git.tukaani.org/xz.git
49-
[ ! -d xz ] && git clone --depth 1 https://github.com/tukaani-project/xz
50-
[ ! -d json-c ] && git clone --depth 1 https://github.com/json-c/json-c.git
51-
[ ! -d lvm2 ] && git clone --depth 1 https://gitlab.com/lvmteam/lvm2
52-
[ ! -d popt ] && git clone --depth 1 https://github.com/rpm-software-management/popt.git
59+
[ ! -d xz ] && git clone -q --depth 1 https://github.com/tukaani-project/xz
60+
last_commit xz
61+
62+
[ ! -d json-c ] && git clone -q --depth 1 https://github.com/json-c/json-c.git
63+
last_commit json-c
64+
65+
[ ! -d lvm2 ] && git clone -q --depth 1 https://gitlab.com/lvmteam/lvm2
66+
last_commit lvm2
67+
68+
[ ! -d popt ] && git clone -q --depth 1 https://github.com/rpm-software-management/popt.git
69+
last_commit popt
70+
5371
# FIXME: temporary fix until libprotobuf stops shuffling C++ requirements
5472
# [ ! -d libprotobuf-mutator ] && git clone --depth 1 https://github.com/google/libprotobuf-mutator.git \
55-
[ ! -d libprotobuf-mutator ] && git clone --depth 1 --branch v1.1 https://github.com/google/libprotobuf-mutator.git \
56-
&& [ "$SANITIZER" == "memory" ] && ( cd libprotobuf-mutator; patch -p1 < $LIBFUZZER_PATCH )
57-
[ ! -d openssl ] && git clone --depth 1 https://github.com/openssl/openssl
58-
[ ! -d util-linux ] && git clone --depth 1 https://github.com/util-linux/util-linux
59-
[ ! -d cryptsetup_fuzzing ] && git clone --depth 1 https://gitlab.com/cryptsetup/cryptsetup_fuzzing.git
73+
[ ! -d libprotobuf-mutator ] && git clone -q --depth 1 --branch v1.1 -c advice.detachedHead=false \
74+
https://github.com/google/libprotobuf-mutator.git &&
75+
[ "$SANITIZER" == "memory" ] && ( cd libprotobuf-mutator; patch -p1 < $LIBFUZZER_PATCH )
76+
last_commit libprotobuf-mutator
77+
78+
[ ! -d openssl ] && git clone -q --depth 1 https://github.com/openssl/openssl
79+
last_commit openssl
80+
81+
[ ! -d util-linux ] && git clone -q --depth 1 https://github.com/util-linux/util-linux
82+
last_commit util-linux
83+
84+
[ ! -d cryptsetup_fuzzing ] && git clone -q --depth 1 https://gitlab.com/cryptsetup/cryptsetup_fuzzing.git
6085

86+
echo "Building libraries from git"
6187
cd openssl
6288
./Configure --prefix="$DEPS_PATH" --libdir=lib no-shared no-module no-asm
6389
make build_generated
@@ -128,6 +154,7 @@ cd external.protobuf;
128154
cp -Rf bin lib include "$DEPS_PATH";
129155
cd ../../..
130156

157+
echo "Building cryptsetup fuzzers"
131158
if in_oss_fuzz; then
132159
mkdir -p cryptsetup/tests/fuzz/build
133160
ln -s ../../../../static_lib_deps cryptsetup/tests/fuzz/build/static_lib_deps
@@ -140,6 +167,7 @@ fi
140167
make clean
141168
make -j fuzz-targets
142169

170+
echo "Installing fuzzers"
143171
for fuzzer in $ENABLED_FUZZERS; do
144172
cp tests/fuzz/$fuzzer $OUT
145173
cp $SRC/cryptsetup_fuzzing/${fuzzer}_seed_corpus.zip $OUT

0 commit comments

Comments
 (0)