1
0
mirror of https://github.com/samba-team/samba.git synced 2025-09-07 21:44:22 +03:00

tests/tool - Restructure according to new convention

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 89571585d87b391ff79647cd1f0f6ac193079e72)
This commit is contained in:
Martin Schwenke
2012-04-16 14:25:50 +10:00
parent 612f0d91d2
commit 006b18dec4
12 changed files with 13 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, dd_ok, 3 healthy" define_test "all, dd_ok, 3 healthy"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, dd_ok, 2 ok/1 disconnected" define_test "all, dd_ok, 2 ok/1 disconnected"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, current disconnected" define_test "all, current disconnected"

View File

@@ -1,35 +0,0 @@
#!/bin/sh
# Run some IP allocation unit tests.
cd $(dirname "$0")
export TESTS_SUBDIR=$(pwd)
test_dir=$(dirname "$TESTS_SUBDIR")
opts="-d"
for i ; do
case "$i" in
-v)
export TESTS_VERBOSE="yes"
shift
;;
-*)
opts="$opts $i"
shift
;;
*)
break
esac
done
tests=""
if [ -z "$*" ] ; then
tests=$(ls testcases/*.[0-9][0-9][0-9].sh 2>/dev/null)
fi
"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1
echo "All OK"
exit 0

View File

@@ -3,14 +3,11 @@
# Print a message and exit. # Print a message and exit.
die () { echo "$@" >&2 ; exit 1 ; } die () { echo "$@" >&2 ; exit 1 ; }
test_bin="$(dirname ${TESTS_SUBDIR})/bin" test_bin="$(dirname ${TEST_SUBDIR})/bin"
define_test () define_test ()
{ {
_f="$0" _f=$(basename "$0" ".sh")
_f="${_f#./}" # strip leading ./
_f="${_f#testcases/}" # strip leading testcases/
_f="${_f%.sh}" # strip off .sh suffix if any
case "$_f" in case "$_f" in
func.*) func.*)
@@ -30,12 +27,6 @@ define_test ()
printf "%-28s - %s\n" "$_f" "$1" printf "%-28s - %s\n" "$_f" "$1"
} }
required_result ()
{
required_rc="${1:-0}"
required_output=$(cat)
}
simple_test () simple_test ()
{ {
_out=$($test_prog "$@" 2>&1) _out=$($test_prog "$@" 2>&1)
@@ -54,7 +45,7 @@ simple_test ()
fi fi
if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
if [ "$TESTS_VERBOSE" = "yes" ] ; then if [ "$TEST_VERBOSE" = "yes" ] ; then
cat <<EOF cat <<EOF
################################################## ##################################################
Output (Exit status: ${_rc}): Output (Exit status: ${_rc}):

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, 3 nodes, all OK" define_test "all, 3 nodes, all OK"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "-n all, 3 nodes, all OK" define_test "-n all, 3 nodes, all OK"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, 3 nodes, 1 disconnected" define_test "all, 3 nodes, 1 disconnected"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "-n all, 3 nodes, 1 disconnected" define_test "-n all, 3 nodes, 1 disconnected"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "-n all all, 3 nodes, 1 disconnected" define_test "-n all all, 3 nodes, 1 disconnected"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, 3 nodes, all ok" define_test "all, 3 nodes, all ok"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. "${TESTS_SUBDIR}/common.sh" . "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "all, 3 nodes, 1 unhealthy" define_test "all, 3 nodes, 1 unhealthy"