serval-dna/tests/compatibility
Andrew Bettison 4851eaf536 Issue #20: remove unique socket names from tests
The recent work on abstract local socket names means that every instance has
its own unique abstract socket name anyway, so there is no need for test
scripts to use $TFWUNIQUE in MDP and Monitor socket names to avoid
intereference when run concurrently.
2013-09-20 14:24:55 +09:30

92 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Tests for network backwards compatibility
#
# Copyright 2012 Serval Project, Inc.
#
# 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"
teardown() {
stop_all_servald_servers
kill_all_servald_processes
assert_no_servald_processes
report_all_servald_servers
}
doc_dna_090_version="Dna lookup of servald in Serval Mesh 0.90"
setup_dna_090_version() {
setup_servald
if ! [ -x "$SERVALD_090" ]; then
error "SERVALD_090 must point to a build being tested for compatibility"
return 1
fi
servald_binary=servald_090
cp "$SERVALD_090" "$SERVALD_VAR/$servald_binary"
export servaldA=$servald_binary
}
start_servald_090() {
# servald configuration and log output has changed, and will continue to change in future
# therefore the operations to start a version 0.90 servald instance are preserved here for future reference
executeOk_servald keyring add
assert [ -e "$SERVALINSTANCE_PATH/serval.keyring" ]
extract_stdout_keyvalue SIDA sid "$rexp_sid"
DIDA=5550001
NAMEA="Agent A. Smith"
executeOk_servald set did $SIDA $DIDA "$NAMEA"
SERVALD_SERVER_CHDIR="$instance_dir" SERVALD_LOG_FILE="$instance_servald_log" executeOk_servald start
wait_until grep "[Ii]nterface .* is up" "$instance_servald_log"
}
test_dna_090_version() {
local DUMMYNET="$SERVALD_VAR/dummy"
>$DUMMYNET
set_instance +A
executeOk_servald config \
set interfaces.0.dummy "$DUMMYNET" \
set debug.overlayframes on
start_servald_090
set_instance +B
executeOk_servald config \
set interfaces.1.file "$DUMMYNET" \
set debug.linkstate on \
set debug.overlayrouting on
create_single_identity
start_servald_server
wait_until grep "LINK STATE; new legacy neighbour $SIDA" "$instance_servald_log"
wait_until grep "REACHABLE VIA BROADCAST sid=$SIDA" "$instance_servald_log"
executeOk_servald route print
tfw_cat --stdout --stderr
assertStdoutGrep --stdout --matches=1 "^${SIDA}:BROADCAST .*:$DUMMYNET:0*\$"
set_instance +A
wait_until grep "PEER REACHABLE, sid=$SIDB" "$instance_servald_log"
executeOk_servald route print
tfw_cat --stdout --stderr
assertStdoutGrep --stdout --matches=1 "^${SIDB}:BROADCAST :0*\$"
executeOk_servald mdp ping $SIDB 1
tfw_cat --stdout --stderr
set_instance +B
executeOk_servald mdp ping $SIDA 1
tfw_cat --stdout --stderr
executeOk_servald dna lookup $DIDA
tfw_cat --stdout --stderr
}
runTests "$@"