Parallelize fuzz-test.sh
Run each "argument" test (e.g. "-nVxr" and "-nr") simultaneously in the background. This should speed up our tests without reducing the amount of fuzzing that we do. Change-Id: I737d1dc09b31e07910d56632bec62da0f35fe222 Reviewed-on: https://code.wireshark.org/review/14432 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
54798eee3b
commit
d877dcc1c4
@ -197,6 +197,8 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
RUNNER_PIDS=
|
||||||
|
RUNNER_ERR_FILES=
|
||||||
for ARGS in "${RUNNER_ARGS[@]}" ; do
|
for ARGS in "${RUNNER_ARGS[@]}" ; do
|
||||||
if [ $DONE -eq 1 ]; then
|
if [ $DONE -eq 1 ]; then
|
||||||
break # We caught a signal
|
break # We caught a signal
|
||||||
@ -210,6 +212,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
|
|||||||
(
|
(
|
||||||
ulimit -S -t $MAX_CPU_TIME -s $MAX_STACK
|
ulimit -S -t $MAX_CPU_TIME -s $MAX_STACK
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
SUBSHELL_PID=$($SHELL -c 'echo $PPID')
|
||||||
|
|
||||||
# Don't enable ulimit -v when using ASAN. See
|
# Don't enable ulimit -v when using ASAN. See
|
||||||
# https://github.com/google/sanitizers/wiki/AddressSanitizer#ulimit--v
|
# https://github.com/google/sanitizers/wiki/AddressSanitizer#ulimit--v
|
||||||
@ -218,9 +221,17 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
"$RUNNER" $COMMON_ARGS $ARGS $TMP_DIR/$TMP_FILE \
|
"$RUNNER" $COMMON_ARGS $ARGS $TMP_DIR/$TMP_FILE \
|
||||||
> /dev/null 2>> $TMP_DIR/$ERR_FILE
|
> /dev/null 2>> $TMP_DIR/$ERR_FILE.$SUBSHELL_PID
|
||||||
)
|
) &
|
||||||
|
RUNNER_PID=$!
|
||||||
|
RUNNER_PIDS="$RUNNER_PIDS $RUNNER_PID"
|
||||||
|
RUNNER_ERR_FILES="$RUNNER_ERR_FILES $TMP_DIR/$ERR_FILE.$RUNNER_PID"
|
||||||
|
done
|
||||||
|
|
||||||
|
for RUNNER_PID in $RUNNER_PIDS ; do
|
||||||
|
wait $RUNNER_PID
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
mv $TMP_DIR/$ERR_FILE.$RUNNER_PID $TMP_DIR/$ERR_FILE
|
||||||
|
|
||||||
# Uncomment the next two lines to enable dissector bug
|
# Uncomment the next two lines to enable dissector bug
|
||||||
# checking.
|
# checking.
|
||||||
@ -243,6 +254,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $DONE -ne 1 -a \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 -o $VG_ERR_CNT -ne 0 \) ] ; then
|
if [ $DONE -ne 1 -a \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 -o $VG_ERR_CNT -ne 0 \) ] ; then
|
||||||
|
rm -f $RUNNER_ERR_FILES
|
||||||
ws_exit_error
|
ws_exit_error
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
3
tshark.c
3
tshark.c
@ -1103,6 +1103,9 @@ main(int argc, char *argv[])
|
|||||||
g_string_free(comp_info_str, TRUE);
|
g_string_free(comp_info_str, TRUE);
|
||||||
g_string_free(runtime_info_str, TRUE);
|
g_string_free(runtime_info_str, TRUE);
|
||||||
|
|
||||||
|
/* Fail sometimes. Useful for testing fuzz scripts. */
|
||||||
|
/* if (g_random_int_range(0, 100) < 5) abort(); */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In order to have the -X opts assigned before the wslua machine starts
|
* In order to have the -X opts assigned before the wslua machine starts
|
||||||
* we need to call getopt_long before epan_init() gets called.
|
* we need to call getopt_long before epan_init() gets called.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user