OSDN Git Service

net: Provide MemReentrancyGuard * to qemu_new_nic()
[qmiga/qemu.git] / tests / docker / test-fuzz
1 #!/bin/bash -e
2 #
3 # Compile and check with oss-fuzz.
4 #
5 # Copyright (c) 2023 Linaro Ltd.
6 #
7 # Authors:
8 #  Alex BennĂ©e <alex.bennee@linaro.org>
9 #
10 # SPDX-License-Identifier: GPL-2.0-or-later
11
12 . common.rc
13
14 requires_binary clang
15
16 # the build script runs out of $src so we need to copy across
17 cd "$BUILD_DIR"
18 cp -a $QEMU_SRC .
19 cd src
20 mkdir build-oss-fuzz
21 export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt
22 env CC="clang" CXX="clang++" CFLAGS="-fsanitize=address" ./scripts/oss-fuzz/build.sh
23 export ASAN_OPTIONS="fast_unwind_on_malloc=0"
24 for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f | grep -v slirp); do
25         grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
26         echo Testing ${fuzzer} ... ;
27         "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
28 done