2013-02-11 08:11:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Stress tests for Serval rhizome protocol.
|
|
|
|
#
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
setup_servald
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_keyring_list() {
|
|
|
|
assertStdoutLineCount --stdout --stderr '==' $1
|
|
|
|
tfw_cat --stdout
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_KeyringCreate="Create keyring destroys existing keys"
|
2013-02-11 08:11:36 +00:00
|
|
|
test_KeyringCreate() {
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring add ''
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
2013-02-13 06:19:52 +00:00
|
|
|
assert_keyring_list 2
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring create
|
|
|
|
assert_keyring_list 0
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_Pinless="No keyring PIN with PIN-less identities"
|
|
|
|
test_Pinless() {
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add ''
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 3
|
|
|
|
}
|
|
|
|
|
2013-02-13 06:19:52 +00:00
|
|
|
doc_IdentityPins="No keyring PIN with identity PINs"
|
|
|
|
test_IdentityPins() {
|
2013-02-11 08:11:36 +00:00
|
|
|
executeOk_servald keyring add 'one'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add 'two'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add 'three'
|
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 1
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 2
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'one' --entry-pin 'two' --entry-pin 'three'
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 3
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list --entry-pin 'two' --entry-pin 'three'
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring list --entry-pin 'three'
|
|
|
|
assert_keyring_list 1
|
|
|
|
}
|
|
|
|
|
|
|
|
doc_KeyringPinIdentityPinless="Keyring PIN with PIN-less identities"
|
|
|
|
test_KeyringPinIdentityPinless() {
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
|
|
|
assert_keyring_list 1
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
|
|
|
assert_keyring_list 2
|
|
|
|
executeOk_servald keyring add --keyring-pin=hello ''
|
|
|
|
executeOk_servald keyring list --keyring-pin=hello
|
2013-02-11 08:11:36 +00:00
|
|
|
assert_keyring_list 3
|
2013-02-13 06:19:52 +00:00
|
|
|
executeOk_servald keyring list
|
|
|
|
assert_keyring_list 0
|
2013-02-11 08:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
runTests "$@"
|