[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/36] tests/docker: add test-fuzz
From: |
Alex Bennée |
Subject: |
[PATCH v3 09/36] tests/docker: add test-fuzz |
Date: |
Tue, 27 Jun 2023 17:09:16 +0100 |
Running the fuzzer requires some hoop jumping and some problems only
show up in containers. This basically replicates the build-oss-fuzz
job from our CI so we can run in the same containers we use in CI.
Message-Id: <20230626215926.2522656-10-alex.bennee@linaro.org>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v3
- checkpatch cleanups
---
MAINTAINERS | 1 +
tests/docker/test-fuzz | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
create mode 100755 tests/docker/test-fuzz
diff --git a/MAINTAINERS b/MAINTAINERS
index e07746ac7d..3cfc389db0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3106,6 +3106,7 @@ R: Qiuhao Li <Qiuhao.Li@outlook.com>
S: Maintained
F: tests/qtest/fuzz/
F: tests/qtest/fuzz-*test.c
+F: tests/docker/test-fuzz
F: scripts/oss-fuzz/
F: hw/mem/sparse-mem.c
F: docs/devel/fuzzing.rst
diff --git a/tests/docker/test-fuzz b/tests/docker/test-fuzz
new file mode 100755
index 0000000000..7e506ae1f6
--- /dev/null
+++ b/tests/docker/test-fuzz
@@ -0,0 +1,28 @@
+#!/bin/bash -e
+#
+# Compile and check with oss-fuzz.
+#
+# Copyright (c) 2023 Linaro Ltd.
+#
+# Authors:
+# Alex Bennée <alex.bennee@linaro.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. common.rc
+
+requires_binary clang
+
+# the build script runs out of $src so we need to copy across
+cd "$BUILD_DIR"
+cp -a $QEMU_SRC .
+cd src
+mkdir build-oss-fuzz
+export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt
+env CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
./scripts/oss-fuzz/build.sh
+export ASAN_OPTIONS="fast_unwind_on_malloc=0"
+for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f | grep -v
slirp); do
+ grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
+ echo Testing ${fuzzer} ... ;
+ "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
+done
--
2.39.2
- [PATCH v3 00/36] maintainer omnibus: testing, fuzz, plugins, documentation, gdbstub (pre-PR), Alex Bennée, 2023/06/27
- [PATCH v3 01/36] gitlab: explicit set artifacts publishing criteria, Alex Bennée, 2023/06/27
- [PATCH v3 03/36] gitlab: reduce testing scope of check-gcov, Alex Bennée, 2023/06/27
- [PATCH v3 02/36] gitlab: ensure coverage job also publishes meson log, Alex Bennée, 2023/06/27
- [PATCH v3 04/36] docs/devel: remind developers to run CI container pipeline when updating images, Alex Bennée, 2023/06/27
- [PATCH v3 05/36] tests/tcg: add mechanism to handle plugin arguments, Alex Bennée, 2023/06/27
- [PATCH v3 11/36] tests/lcitool: update to latest version, Alex Bennée, 2023/06/27
- [PATCH v3 09/36] tests/docker: add test-fuzz,
Alex Bennée <=
- [PATCH v3 14/36] tests/lcitool: introduce qemu-minimal, Alex Bennée, 2023/06/27
- [PATCH v3 08/36] tests/qtests: clean-up and fix leak in generic_fuzz, Alex Bennée, 2023/06/27
- [PATCH v3 13/36] tests/lcitool: add an explicit gcc-native package, Alex Bennée, 2023/06/27
- [PATCH v3 07/36] scripts/oss-fuzz: add a suppression for keymap, Alex Bennée, 2023/06/27
- [PATCH v3 15/36] tests/docker: convert riscv64-cross to lcitool, Alex Bennée, 2023/06/27
- [PATCH v3 16/36] tests/avocado: update firmware to enable sbsa-ref/max, Alex Bennée, 2023/06/27