summaryrefslogtreecommitdiff
path: root/fuzz/build-coverage
blob: af9f8df9632b48ebfdb5584ac43260e87c779297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash -eux
#
# Copyright (c) 2019 Yubico AB. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

LIBCBOR=$1
LIBFIDO2=$2

CC=${CC:-clang}
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-${LIBCBOR}/install/lib/pkgconfig}
export CC PKG_CONFIG_PATH

# Clean up.
rm -rf ${LIBCBOR}/build ${LIBCBOR}/install ${LIBFIDO2}/build

# Patch, build, and install libcbor.
(cd ${LIBCBOR} && patch -N -l -s -p0 < ${LIBFIDO2}/fuzz/README) || true
mkdir ${LIBCBOR}/build ${LIBCBOR}/install
(cd ${LIBCBOR}/build && cmake -DCMAKE_INSTALL_PREFIX=${LIBCBOR}/install ..)
make -C ${LIBCBOR}/build all install

# Build libfido2.
mkdir -p ${LIBFIDO2}/build
(cd ${LIBFIDO2}/build && cmake -DFUZZ=1 -DLIBFUZZER=1 -DCOVERAGE=1 \
	-DCMAKE_BUILD_TYPE=Debug ..)
make -C ${LIBFIDO2}/build