Remove obsolete tests, rename others

This commit is contained in:
Andrew Bettison 2012-06-04 18:25:11 +09:30
parent b5581c9861
commit 05721d3725
5 changed files with 0 additions and 287 deletions

View File

@ -1,79 +0,0 @@
#!/bin/bash
# Tests for Serval DNA bit error performance.
#
# Copyright 2012 Paul Gardner-Stephen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
source "${0%/*}/../testframework.sh"
source "${0%/*}/../testdefs.sh"
# Default teardown function
teardown() {
stop_servald_server
}
# Test case, transcribed from ../testdna
doc_BitErrorCreateSID='Create new SID despite bit errors'
setup_BitErrorCreateSID() {
ber=0.001
setup_servald
start_servald_server -B $ber
}
test_BitErrorCreateSID() {
local iterations=10
local i=0
local fails=0
local totaltime_ms=0
local maxtime_ms=0
while [ $i -lt $iterations ]; do
executeOk $servald -B $ber -d 0427679796 -C
sid=`replayStdout | grep '^OK:' | cut -f2 -d:`
let totaltime_ms=totaltime_ms+realtime_ms
[ $realtime_ms -gt $maxtime_ms ] && maxtime_ms=$realtime_ms
if [ -z "$sid" ]; then
let fails=fails+1
echo "# iteration $i: no sid after ${realtime_ms} ms"
else
echo "# iteration $i: sid=$sid after ${realtime_ms} ms"
fi
let i=i+1
done
let meantime_ms=totaltime_ms/iterations
echo "# average time = $meantime_ms ms"
echo "# maximum time = $maxtime_ms ms"
assertExpr --message='packet loss was properly injected' $meantime_ms '>' 25
assertExpr --message="reliable at BER=$ber packet loss" $fails '<=' 4
assertExpr --message="timeout works at BER=$ber packet loss" $totaltime_ms '<=' 3000 '&&' $maxtime_ms '<=' 330
}
# Test case, transcribed from ../testdna
doc_SetVarBigValueBitErrors='Can set variable with multi-packet value despite bit errors'
setup_SetVarBigValueBitErrors() {
ber=0.00001
setup_servald
start_servald_server -B $ber
echo_long_message >$DNATMP/servaldtest.in
}
test_SetVarBigValueBitErrors() {
executeOk $servald -B $ber -s $sid -i 0 -W note="@servaldtest.in"
assertStdoutGrep --matches=1 --message='variable write confirmed' "^WROTE:$sid$"
executeOk $servald -v verbose -B $ber -s $sid -O $DNATMP/servaldtest.out -i 0 -R note
assertStdoutGrep --matches=1 --message='variable new value returned' "^NOTE:$sid:[0-9]\+:0"
assert --message='long value read correctly' cmp --quiet $DNATMP/servaldtest.in $DNATMP/servaldtest.out
}
runTests "$@"

View File

@ -1,208 +0,0 @@
#!/bin/bash
# Tests for Serval DNA HLR operations.
#
# Copyright 2012 Paul Gardner-Stephen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
source "${0%/*}/../testframework.sh"
source "${0%/*}/../testdefs.sh"
# Default teardown function
teardown() {
stop_servald_server
}
# Utility function
create_sid() {
executeOk $servald "$@" -d 0427679796 -C
assertStdoutGrep --matches=1 '^OK:'
sid=`replayStdout | grep '^OK:' | cut -f2 -d:`
}
# Utility function
set_short_var() {
executeOk $servald -s $sid -i 0 -W note="a short literal value"
}
# Utility function
echo_long_message() {
local i=0
while [ $i -lt 100 ]; do
echo "${i}ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-${i}"
let i=i+1
done
}
# Test case, transcribed from ../testdna
doc_CreateSID='Create new SID'
setup_CreateSID() {
setup_servald
start_servald_server
}
test_CreateSID() {
create_sid
assertRealTime '<' 0.5
assertExpr --stdout --message='valid SID was returned' "$sid" '~' '[0-9A-F]+'
}
# Test case, transcribed from ../testdna
doc_GetShortVar='Get short variable'
setup_GetShortVar() {
setup_servald
start_servald_server
create_sid
}
test_GetShortVar() {
executeOk $servald -d 0427679796 -R dids
assertRealTime '>' 2.9 # Waited for all replies
assertStdoutGrep --message='received an existing DID' "^DIDS:${sid}:[0-9]\+:0:0427679796"
assertStdoutGrep --matches=1 --message='filtered out duplicate responses' "^DIDS:${sid}:[0-9]\+:0:0427679796"
}
# Test case, transcribed from ../testdna
doc_SetShortVar='Set short variable'
setup_SetShortVar() {
setup_servald
start_servald_server
create_sid
}
test_SetShortVar() {
set_short_var
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable write confirmed' "^WROTE:$sid$"
}
# Test case, transcribed from ../testdna
doc_SetGetShortVar='Set then get short variable'
setup_SetGetShortVar() {
setup_servald
start_servald_server
create_sid
set_short_var
}
test_SetGetShortVar() {
executeOk $servald -s $sid -i 0 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='read variable correctly' "^NOTE:$sid:[0-9]\+:0:a short literal value"
}
# Test case, transcribed from ../testdna
doc_GetShortVarToFile='Get variable into a file'
setup_GetShortVarToFile() {
setup_servald
start_servald_server
create_sid
set_short_var
}
test_GetShortVarToFile() {
echo "WARNING: Known issue: output to file does not work with DID lists"
servaldtest_dat=$DNATMP/servaldtest.dat
executeOk $servald -s $sid -O $servaldtest_dat -i 0 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='read variable into file' "^NOTE:$sid:[0-9]\+:0"
assertFileContents $servaldtest_dat 'a short literal value'
}
# Test case, transcribed from ../testdna
doc_SetMultiShortVar='Set multiple instances of a short variable'
setup_SetMultiShortVar() {
setup_servald
start_servald_server
create_sid
set_short_var
}
test_SetMultiShortVar() {
executeOk $servald -s $sid -i 1 -W note='$414243'
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable write confirmed' "^WROTE:$sid$"
executeOk $servald -s $sid -i 1 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='new variable correctly set in hex' "^NOTE:$sid:[0-9]\+:1:ABC$"
}
# Test case, transcribed from ../testdna
doc_GetMultiShortVar='Get multiple instances of a short variable'
setup_GetMultiShortVar() {
setup_servald
start_servald_server
create_sid
set_short_var
executeOk $servald -s $sid -i 1 -W note='$414243'
executeOk $servald -s $sid -i 2 -W note
}
test_GetMultiShortVar() {
executeOk $servald -s $sid -m -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='first variable read correctly' "^NOTE:$sid:[0-9]\+:0:a short literal value$"
assertStdoutGrep --matches=1 --message='second variable read correctly' "^NOTE:$sid:[0-9]\+:1:ABC$"
assertStdoutGrep --matches=1 --message='third variable read correctly' "^NOTE:$sid:[0-9]\+:2$"
}
# Test case, transcribed from ../testdna
doc_OverwriteVarNoUpdate='Set does not overwrite variable'
setup_OverwriteVarNoUpdate() {
setup_servald
start_servald_server
create_sid
set_short_var
}
test_OverwriteVarNoUpdate() {
executeOk $servald -s $sid -i 0 -W note="replacement short literal value"
assertRealTime '<' 0.5
assertStdoutGrep --matches=0 --message='variable write not confirmed' "^WROTE:$sid$"
executeOk $servald -s $sid -i 0 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable retains original value' "^NOTE:$sid:[0-9]\+:0:a short literal value"
}
# Test case, transcribed from ../testdna
doc_UpdateVar='Update overwrites variable'
setup_UpdateVar() {
setup_servald
start_servald_server
create_sid
set_short_var
}
test_UpdateVar() {
executeOk $servald -s $sid -i 0 -U note="replacement short literal value"
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable write confirmed' "^WROTE:$sid$"
executeOk $servald -s $sid -i 0 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable has new value' "^NOTE:$sid:[0-9]\+:0:replacement short literal value"
}
# Test case, transcribed from ../testdna
doc_UpdateVarBigValue='Can set variable with multi-packet value'
setup_UpdateVarBigValue() {
setup_servald
start_servald_server
create_sid
set_short_var
echo_long_message >$DNATMP/servaldtest.in
}
test_UpdateVarBigValue() {
executeOk $servald -s $sid -i 0 -U note="@servaldtest.in"
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable write confirmed' "^WROTE:$sid$"
executeOk $servald -v verbose -s $sid -O $DNATMP/servaldtest.out -i 0 -R note
assertRealTime '<' 0.5
assertStdoutGrep --matches=1 --message='variable new value returned' "^NOTE:$sid:[0-9]\+:0"
assert --message='long value read correctly' cmp --quiet $DNATMP/servaldtest.in $DNATMP/servaldtest.out
}
runTests "$@"