llvm_vfio_fuzz: start fuzzer tests in parallel
With corpus files persistent between fuzzer weekend run it may be better to start all test for fraction of time instead of different test every week. Remove `poll_groups_mask` from config, this patch run every test on single core and since then there is no need to specify another mask. Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com> Change-Id: I4448724801bdf1a3c496f829fd168b840c2efa67 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15384 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Michal Berger <michal.berger@intel.com>
This commit is contained in:
parent
770f7abca2
commit
81dcdfe812
@ -29,15 +29,6 @@
|
|||||||
{
|
{
|
||||||
"subsystem": "nvmf",
|
"subsystem": "nvmf",
|
||||||
"config": [
|
"config": [
|
||||||
{
|
|
||||||
"method": "nvmf_set_config",
|
|
||||||
"params": {
|
|
||||||
"poll_groups_mask": "0x1",
|
|
||||||
"admin_cmd_passthru": {
|
|
||||||
"identify_ctrlr": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"method": "nvmf_create_transport",
|
"method": "nvmf_create_transport",
|
||||||
"params": {
|
"params": {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Copyright (C) 2022 Intel Corporation
|
# Copyright (C) 2022 Intel Corporation
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
|
FUZZER=vfio
|
||||||
if [[ $SPDK_TEST_FUZZER_SHORT -eq 0 ]]; then
|
if [[ $SPDK_TEST_FUZZER_SHORT -eq 0 ]]; then
|
||||||
TIME=60000
|
TIME=60000
|
||||||
else
|
else
|
||||||
@ -17,68 +18,57 @@ for i in "$@"; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
VFIOUSER_DIR=/tmp/vfio-user/domain/1
|
|
||||||
VFIOUSER_IO_DIR=/tmp/vfio-user/domain/2
|
|
||||||
mkdir -p $VFIOUSER_DIR
|
|
||||||
mkdir -p $VFIOUSER_IO_DIR
|
|
||||||
|
|
||||||
function start_llvm_fuzz() {
|
function start_llvm_fuzz() {
|
||||||
local fuzzer_type=$1
|
local fuzzer_type=$1
|
||||||
local corpus_dir
|
local timen=$2
|
||||||
|
local core=$3
|
||||||
|
local corpus_dir=$rootdir/../corpus/llvm_vfio_$fuzzer_type
|
||||||
|
local fuzzer_dir=/tmp/vfio-user-$fuzzer_type
|
||||||
|
local vfiouser_dir=$fuzzer_dir/domain/1
|
||||||
|
local vfiouser_io_dir=$fuzzer_dir/domain/2
|
||||||
|
local vfiouser_cfg=$fuzzer_dir/fuzz_vfio_json.conf
|
||||||
|
|
||||||
corpus_dir=$rootdir/../corpus/llvm_vfio_$fuzzer_type
|
mkdir -p $fuzzer_dir $vfiouser_dir $vfiouser_io_dir $corpus_dir
|
||||||
mkdir -p $corpus_dir
|
|
||||||
|
|
||||||
$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz -m 0x1 \
|
# Adjust paths to allow multiply instance of fuzzer
|
||||||
-i 0 \
|
sed -e "s%/tmp/vfio-user/domain/1%$vfiouser_dir%;
|
||||||
-F $VFIOUSER_DIR \
|
s%/tmp/vfio-user/domain/2%$vfiouser_io_dir%" $testdir/fuzz_vfio_json.conf > $vfiouser_cfg
|
||||||
-c $testdir/fuzz_vfio_json.conf \
|
|
||||||
-t $TIME \
|
$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz \
|
||||||
|
-m $core \
|
||||||
|
-s $mem_size \
|
||||||
|
-F $vfiouser_dir \
|
||||||
|
-c $vfiouser_cfg \
|
||||||
|
-t $timen \
|
||||||
-D $corpus_dir \
|
-D $corpus_dir \
|
||||||
-Y $VFIOUSER_IO_DIR \
|
-Y $vfiouser_io_dir \
|
||||||
|
-r $fuzzer_dir/spdk$fuzzer_type.sock \
|
||||||
-Z $fuzzer_type
|
-Z $fuzzer_type
|
||||||
}
|
|
||||||
|
|
||||||
function run_fuzz() {
|
rm -rf $fuzzer_dir
|
||||||
local startday
|
|
||||||
local today
|
|
||||||
local interval=0
|
|
||||||
local weekloop
|
|
||||||
# Get the date number, format is like '22078'
|
|
||||||
# The purpose is when Jenkins schedule one fuzz in Saturday
|
|
||||||
# We can decide which one fuzz will be run , there are lots of fuzz, but only run one of them in Saturday each time
|
|
||||||
# and make sure all fuzz will be tested, so use this function. Such run fuzz 0 in 03/26, and run fuzz 1 in 04/02, run fuzz 2 in 04/09 ....
|
|
||||||
startday=$(date -d '2022-03-19' '+%y%j')
|
|
||||||
today=$(date '+%y%j')
|
|
||||||
interval=$(((today - startday) / 7))
|
|
||||||
weekloop=$((interval / fuzz_num))
|
|
||||||
if [[ $weekloop -lt 1 ]]; then # The first loop of fuzz
|
|
||||||
fuzzer_type=$interval
|
|
||||||
else
|
|
||||||
fuzzer_type=$((interval % fuzz_num))
|
|
||||||
fi
|
|
||||||
start_llvm_fuzz $fuzzer_type &> $output_dir/llvm/llvm_vfio_$fuzzer_type.txt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testdir=$(readlink -f $(dirname $0))
|
testdir=$(readlink -f $(dirname $0))
|
||||||
rootdir=$(readlink -f $testdir/../../../../)
|
rootdir=$(readlink -f $testdir/../../../../)
|
||||||
source $rootdir/test/common/autotest_common.sh
|
source $rootdir/test/common/autotest_common.sh
|
||||||
|
source $rootdir/test/setup/common.sh
|
||||||
|
source $testdir/../common.sh
|
||||||
|
|
||||||
fuzzfile=$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz.c
|
fuzzfile=$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz.c
|
||||||
fuzz_num=$(($(grep -c "fn =" $fuzzfile) - 1))
|
fuzz_num=$(($(grep -c "\.fn =" $fuzzfile) - 1))
|
||||||
[[ $fuzz_num -ne 0 ]]
|
((fuzz_num != 0))
|
||||||
|
|
||||||
trap 'process_shm --id 0; rm -rf $VFIOUSER_DIR $VFIOUSER_IO_DIR; exit 1' SIGINT SIGTERM EXIT
|
trap 'cleanup /tmp/vfio-user-*; exit 1' SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
|
# vfiouser transport is unable to connect if memory is restricted
|
||||||
|
mem_size=0
|
||||||
if [[ $SPDK_TEST_FUZZER_SHORT -eq 1 ]]; then
|
if [[ $SPDK_TEST_FUZZER_SHORT -eq 1 ]]; then
|
||||||
for ((i = 0; i < fuzz_num; i++)); do
|
start_llvm_fuzz_short $fuzz_num $TIME
|
||||||
start_llvm_fuzz $i
|
|
||||||
done
|
|
||||||
elif [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
|
elif [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
|
||||||
run_fuzz
|
get_testn $fuzz_num 1024
|
||||||
|
start_llvm_fuzz_all $TESTN $fuzz_num $TIME
|
||||||
else
|
else
|
||||||
start_llvm_fuzz $1
|
start_llvm_fuzz $1 $TIME 0x1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $VFIOUSER_DIR $VFIOUSER_IO_DIR
|
|
||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
|
Loading…
Reference in New Issue
Block a user