Improve rhizome stress test

Generate test files from 2KiB to 32MiB in size, instead of all about 13 bytes
in size.  Guess what?  Found a bug!
This commit is contained in:
Andrew Bettison 2012-10-31 18:17:06 +10:30
parent d9fb8d7956
commit 03f71dcccf
3 changed files with 16 additions and 12 deletions

View File

@ -309,7 +309,8 @@ extract_manifest_vars() {
rhizome_add_file() { rhizome_add_file() {
local name="$1" local name="$1"
[ -e "$name" ] || echo "File $name" >"$name" local size="${2:-64}"
[ -e "$name" ] || create_file "$name" $size
local sidvar="SID$instance_name" local sidvar="SID$instance_name"
executeOk_servald rhizome add file "${!sidvar}" '' "$name" "$name.manifest" executeOk_servald rhizome add file "${!sidvar}" '' "$name" "$name.manifest"
executeOk_servald rhizome list '' executeOk_servald rhizome list ''

View File

@ -138,10 +138,11 @@ runTests() {
_tfw_invoking_script=$(abspath "${BASH_SOURCE[1]}") _tfw_invoking_script=$(abspath "${BASH_SOURCE[1]}")
_tfw_suite_name="${_tfw_invoking_script##*/}" _tfw_suite_name="${_tfw_invoking_script##*/}"
_tfw_cwd=$(abspath "$PWD") _tfw_cwd=$(abspath "$PWD")
_tfw_tmpdir="${TFW_TMPDIR:-${TMPDIR:-/tmp}}/_tfw-$$" _tfw_tmpdir="$(_tfw_abspath -P "${TFW_TMPDIR:-${TMPDIR:-/tmp}}")"
trap '_tfw_status=$?; _tfw_killtests; rm -rf "$_tfw_tmpdir"; exit $_tfw_status' EXIT SIGHUP SIGINT SIGTERM _tfw_tmpmain="$_tfw_tmpdir/_tfw-$$"
rm -rf "$_tfw_tmpdir" trap '_tfw_status=$?; _tfw_killtests; rm -rf "$_tfw_tmpmain"; exit $_tfw_status' EXIT SIGHUP SIGINT SIGTERM
mkdir -p "$_tfw_tmpdir" || return $? rm -rf "$_tfw_tmpmain"
mkdir -p "$_tfw_tmpmain" || return $?
_tfw_logdir="${TFW_LOGDIR:-$_tfw_cwd/testlog}/$_tfw_suite_name" _tfw_logdir="${TFW_LOGDIR:-$_tfw_cwd/testlog}/$_tfw_suite_name"
_tfw_trace=false _tfw_trace=false
_tfw_verbose=false _tfw_verbose=false
@ -175,7 +176,7 @@ runTests() {
_tfw_fatal "--verbose is incompatible with --jobs=$njobs" _tfw_fatal "--verbose is incompatible with --jobs=$njobs"
fi fi
# Create an empty results directory. # Create an empty results directory.
_tfw_results_dir="$_tfw_tmpdir/results" _tfw_results_dir="$_tfw_tmpmain/results"
mkdir "$_tfw_results_dir" || return $? mkdir "$_tfw_results_dir" || return $?
# Create an empty log directory. # Create an empty log directory.
mkdir -p "$_tfw_logdir" || return $? mkdir -p "$_tfw_logdir" || return $?
@ -226,7 +227,7 @@ runTests() {
# All files created by this test belong inside a temporary directory. # All files created by this test belong inside a temporary directory.
# The path name must be kept short because it is used to construct # The path name must be kept short because it is used to construct
# named socket paths, which have a limited length. # named socket paths, which have a limited length.
_tfw_tmp=/tmp/_tfw-$_tfw_unique _tfw_tmp=$_tfw_tmpdir/_tfw-$_tfw_unique
trap '_tfw_status=$?; rm -rf "$_tfw_tmp"; exit $_tfw_status' EXIT SIGHUP SIGINT SIGTERM trap '_tfw_status=$?; rm -rf "$_tfw_tmp"; exit $_tfw_status' EXIT SIGHUP SIGINT SIGTERM
local start_time=$(_tfw_timestamp) local start_time=$(_tfw_timestamp)
local finish_time=unknown local finish_time=unknown
@ -282,7 +283,7 @@ runTests() {
_tfw_harvest_processes _tfw_harvest_processes
done done
# Clean up working directory. # Clean up working directory.
rm -rf "$_tfw_tmpdir" rm -rf "$_tfw_tmpmain"
trap - EXIT SIGHUP SIGINT SIGTERM trap - EXIT SIGHUP SIGINT SIGTERM
# Echo result summary and exit with success if no failures or errors. # Echo result summary and exit with success if no failures or errors.
s=$([ $_tfw_testcount -eq 1 ] || echo s) s=$([ $_tfw_testcount -eq 1 ] || echo s)
@ -642,11 +643,11 @@ tfw_cat() {
tfw_core_backtrace() { tfw_core_backtrace() {
local executable="$1" local executable="$1"
local corefile="$2" local corefile="$2"
echo backtrace >"$_tfw_tmpdir/backtrace.gdb" echo backtrace >"$_tfw_tmpmain/backtrace.gdb"
tfw_log "#----- gdb backtrace from $executable $corefile -----" tfw_log "#----- gdb backtrace from $executable $corefile -----"
gdb -n -batch -x "$_tfw_tmpdir/backtrace.gdb" "$executable" "$corefile" </dev/null gdb -n -batch -x "$_tfw_tmpmain/backtrace.gdb" "$executable" "$corefile" </dev/null
tfw_log "#-----" tfw_log "#-----"
rm -f "$_tfw_tmpdir/backtrace.gdb" rm -f "$_tfw_tmpmain/backtrace.gdb"
} }
assertExitStatus() { assertExitStatus() {

View File

@ -55,10 +55,12 @@ setup_FileTransferStress() {
do do
eval "bundles$i=()" eval "bundles$i=()"
set_instance +$i set_instance +$i
let j=0
for n in 1 2 3 4 5 6 7 8 9 a b c d e f g for n in 1 2 3 4 5 6 7 8 9 a b c d e f g
do do
rhizome_add_file file-$i-$n rhizome_add_file file-$i-$n $((2 ** (j + 10)))
eval "bundles$i+=(\$BID:\$VERSION)" eval "bundles$i+=(\$BID:\$VERSION)"
let j=j+1
done done
done done
} }