The branch, master has been updated via b03a171 s3:test: mark the net_registry_roundtrip test as knownfail via fca4238 s3:test: add the registry roundtrip test as samba3.blackbox.net_s3_registry_roundtrip via df4044e s3:test: move the registry roundtrip test to a test script of its own via 7fb4f2e s3:test: add comment header to test_net_registry.sh via dbc7896 s3:test: use the blackbox subunit test driver in the net_registry tests. via ad6c3ec s3:test: use the blackbox subunit test driver in the net_misc tests. via 2e18c34 s3:test: add the "blackbox.failure" test to the knownfail tests via 18f4940 s3:test: add the failure blackbox test as samba3.blackbox.failure via 1430d17 s3:test: add a simple failing blackbox testsuite via ca2b960 s3:test: add the success blackbox test as samba3.blackbox.success via 9164a57 s3:test: add a simple blackbox test that succeeds. via 7c72ce9 testprogs/blackbox/subunit: add testok() for easier integration of s3 tests. via fbfa5c6 s3:net: fix usage for "net rpc registry export" from bfa7964 s3-ipasam: Add aliases for trusted domain user
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit b03a171c13e4ecb2758a4cead777bbf24a49b63a Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 12:38:26 2011 +0100 s3:test: mark the net_registry_roundtrip test as knownfail Autobuild-User: Michael Adam <ob...@samba.org> Autobuild-Date: Wed Feb 16 13:45:09 CET 2011 on sn-devel-104 commit fca423832f92f5e3c6dcf4048bd7a75b16dcb84d Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 11:54:58 2011 +0100 s3:test: add the registry roundtrip test as samba3.blackbox.net_s3_registry_roundtrip commit df4044ed33fdd07421c6a631c47f2524baa35ddd Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 11:52:39 2011 +0100 s3:test: move the registry roundtrip test to a test script of its own commit 7fb4f2e0d595ca0ac8f867317c88710d0af45acf Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 11:50:57 2011 +0100 s3:test: add comment header to test_net_registry.sh commit dbc7896e3375e3ec14b8057fb77e85223e0a3467 Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 22:54:06 2011 +0100 s3:test: use the blackbox subunit test driver in the net_registry tests. commit ad6c3ec3e52c7578884f65a3cf366bf9a6aafbda Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 22:54:06 2011 +0100 s3:test: use the blackbox subunit test driver in the net_misc tests. commit 2e18c34d6247573d8215905e8989e3c010f144d6 Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 11:53:24 2011 +0100 s3:test: add the "blackbox.failure" test to the knownfail tests This is designed to fail. Its purpose is to test our test infrastructure. commit 18f4940de21f997a5d95a8c9a29916cce5c168be Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 22:53:01 2011 +0100 s3:test: add the failure blackbox test as samba3.blackbox.failure commit 1430d17f2abdb7cc51449b85a9a16592f096451d Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 16:08:49 2011 +0100 s3:test: add a simple failing blackbox testsuite commit ca2b960c414affb3b757bb46f7dc3a808290c4d6 Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 16:05:45 2011 +0100 s3:test: add the success blackbox test as samba3.blackbox.success commit 9164a574574fb31851f0c1358455f3e7a9f6aa80 Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 16:05:06 2011 +0100 s3:test: add a simple blackbox test that succeeds. commit 7c72ce9f48eced7b22773c49663fdda3c43a15e1 Author: Michael Adam <ob...@samba.org> Date: Tue Feb 15 16:03:58 2011 +0100 testprogs/blackbox/subunit: add testok() for easier integration of s3 tests. commit fbfa5c62b8a539e9cf6e291faaa8d7c90c58a839 Author: Michael Adam <ob...@samba.org> Date: Wed Feb 16 11:45:52 2011 +0100 s3:net: fix usage for "net rpc registry export" ----------------------------------------------------------------------- Summary of changes: source3/script/tests/test_failure.sh | 39 +++++++ source3/script/tests/test_net_misc.sh | 4 +- source3/script/tests/test_net_registry.sh | 98 ++---------------- .../script/tests/test_net_registry_roundtrip.sh | 109 ++++++++++++++++++++ source3/script/tests/test_success.sh | 26 +++++ source3/selftest/knownfail | 2 + source3/selftest/tests.sh | 4 + source3/utils/net_rpc_registry.c | 3 +- testprogs/blackbox/subunit.sh | 9 ++ 9 files changed, 201 insertions(+), 93 deletions(-) create mode 100755 source3/script/tests/test_failure.sh create mode 100755 source3/script/tests/test_net_registry_roundtrip.sh create mode 100755 source3/script/tests/test_success.sh Changeset truncated at 500 lines: diff --git a/source3/script/tests/test_failure.sh b/source3/script/tests/test_failure.sh new file mode 100755 index 0000000..8af0f3a --- /dev/null +++ b/source3/script/tests/test_failure.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Blackbox test that should fail one of three subtests. +# +# Copyright (C) 2011 Michael Adam <ob...@samba.org> + +# include the blackbox subunit infrastructure +# if not run from classical s3 test script: +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { + incdir=`dirname $0`/../../../testprogs/blackbox + . $incdir/subunit.sh +} + +failed=0 + +test_failure() +{ + false +} + +test_success() +{ + true +} + +testit "success" \ + test_success || \ + failed=`expr $failed + 1` + +testit "failure" \ + test_failure || \ + failed=`expr $failed + 1` + +testit "success" \ + test_success || \ + failed=`expr $failed + 1` + +testok $0 $failed + diff --git a/source3/script/tests/test_net_misc.sh b/source3/script/tests/test_net_misc.sh index 8d092f4..5257830 100755 --- a/source3/script/tests/test_net_misc.sh +++ b/source3/script/tests/test_net_misc.sh @@ -8,8 +8,8 @@ NETTIME="${NET} time" NETLOOKUP="${NET} lookup" test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { -incdir=`dirname $0` -. $incdir/test_functions.sh +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh } failed=0 diff --git a/source3/script/tests/test_net_registry.sh b/source3/script/tests/test_net_registry.sh index 525e13a..6482628 100755 --- a/source3/script/tests/test_net_registry.sh +++ b/source3/script/tests/test_net_registry.sh @@ -1,6 +1,10 @@ #!/bin/sh - -# Tests for the "net registry" and "net rpc registry" commands. +# +# Blackbox tests for the "net registry" and "net rpc registry" commands. +# +# Copyright (C) 2010-2011 Michael Adam <ob...@samba.org> +# Copyright (C) 2010 Gregor Beck <gb...@sernet.de> +# # rpc tests are chose by specifying "rpc" as commandline parameter. RPC="$1" @@ -14,8 +18,8 @@ else fi test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { -incdir=`dirname $0` -. $incdir/test_functions.sh +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh } failed=0 @@ -345,92 +349,6 @@ take_administrative_rights() fi } -SED_INVALID_PARAMS="{ -s/lock directory/;&/g -s/modules dir/;&/g -s/logging/;&/g -s/status/;&/g -s/logdir/;&/g -s/read prediction/;&/g -s/mkprofile/;&/g -s/valid chars/;&/g -s/timesync/;&/g -s/sambaconf/;&/g -s/logtype/;&/g -s/servername/;&/g -}" - -REGPATH="HKLM\Software\Samba" - -conf_roundtrip_step() { - echo $* >>$LOG - $@ 2>>$LOG -# echo -n . -} - -conf_roundtrip() -{ - local DIR=$(mktemp -d --tmpdir=$PREFIX conf_roundtrip_XXXX) - local LOG=$DIR/log - - echo conf_roundtrip $1 > $LOG - - sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in - - conf_roundtrip_step $NET conf drop - test -z "$($NET conf list)" 2>>$LOG - if [ "$?" = "1" ]; then - echo "ERROR: conf drop failed" | tee -a $LOG - return 1 - fi - - conf_roundtrip_step $NET conf import $DIR/conf_in - conf_roundtrip_step $NET conf list > $DIR/conf_exp - - grep "\[global\]" $DIR/conf_exp >/dev/null 2>>$LOG - if [ "$?" = "1" ]; then - echo "ERROR: conf import => conf export failed" | tee -a $LOG - return 1 - fi - - conf_roundtrip_step $NET -d10 registry export $REGPATH $DIR/conf_exp.reg - - conf_roundtrip_step $NET conf drop - test -z "$($NET conf list)" 2>>$LOG - if [ "$?" = "1" ]; then - echo "ERROR: conf drop failed" | tee -a $LOG - return 1 - fi - - conf_roundtrip_step $NET registry import $DIR/conf_exp.reg - - conf_roundtrip_step $NET conf list >$DIR/conf_out - diff -q $DIR/conf_out $DIR/conf_exp >> $LOG - if [ "$?" = "1" ]; then - echo "ERROR: registry import => conf export failed" | tee -a $LOG - return 1 - fi - - conf_roundtrip_step $NET registry export $REGPATH $DIR/conf_out.reg - diff -q $DIR/conf_out.reg $DIR/conf_exp.reg >>$LOG - if [ "$?" = "1" ]; then - echo "Error: registry import => registry export failed" | tee -a $LOG - return 1 - fi - rm -r $DIR -} - -CONF_FILES=${CONF_FILES:-$(find $SRCDIR/.. -name *.conf | xargs grep -l "\[global\]")} - -for conf_file in $CONF_FILES -do - conf_file=${conf_file#$SRCDIR/} - testit "conf_roundtrip $conf_file" \ - conf_roundtrip $conf_file \ - || failed=`expr $failed + 1` -done - - if test "x${RPC}" = "xrpc" ; then testit "giving user ${USERNAME} administrative rights" \ diff --git a/source3/script/tests/test_net_registry_roundtrip.sh b/source3/script/tests/test_net_registry_roundtrip.sh new file mode 100755 index 0000000..7f13bc2 --- /dev/null +++ b/source3/script/tests/test_net_registry_roundtrip.sh @@ -0,0 +1,109 @@ +#!/bin/sh +# +# Blackbox test for net conf/registry roundtrips. +# +# Copyright (C) 2010 Gregor Beck <gb...@sernet.de> +# Copyright (C) 2011 Michael Adam <ob...@samba.org> + +NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" + + +if test "x${RPC}" = "xrpc" ; then + NETREG="${NET} -U${USERNAME}%${PASSWORD} -I ${SERVER_IP} rpc registry" +else + NETREG="${NET} registry" +fi + +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh +} + +failed=0 + +SED_INVALID_PARAMS="{ +s/lock directory/;&/g +s/modules dir/;&/g +s/logging/;&/g +s/status/;&/g +s/logdir/;&/g +s/read prediction/;&/g +s/mkprofile/;&/g +s/valid chars/;&/g +s/timesync/;&/g +s/sambaconf/;&/g +s/logtype/;&/g +s/servername/;&/g +}" + +REGPATH="HKLM\Software\Samba" + +conf_roundtrip_step() { + echo $* >>$LOG + $@ 2>>$LOG +# echo -n . +} + +conf_roundtrip() +{ + local DIR=$(mktemp -d --tmpdir=$PREFIX conf_roundtrip_XXXX) + local LOG=$DIR/log + + echo conf_roundtrip $1 > $LOG + + sed -e "$SED_INVALID_PARAMS" $1 >$DIR/conf_in + + conf_roundtrip_step $NET conf drop + test -z "$($NET conf list)" 2>>$LOG + if [ "$?" = "1" ]; then + echo "ERROR: conf drop failed" | tee -a $LOG + return 1 + fi + + conf_roundtrip_step $NET conf import $DIR/conf_in + conf_roundtrip_step $NET conf list > $DIR/conf_exp + + grep "\[global\]" $DIR/conf_exp >/dev/null 2>>$LOG + if [ "$?" = "1" ]; then + echo "ERROR: conf import => conf export failed" | tee -a $LOG + return 1 + fi + + conf_roundtrip_step $NET -d10 registry export $REGPATH $DIR/conf_exp.reg + + conf_roundtrip_step $NET conf drop + test -z "$($NET conf list)" 2>>$LOG + if [ "$?" = "1" ]; then + echo "ERROR: conf drop failed" | tee -a $LOG + return 1 + fi + + conf_roundtrip_step $NET registry import $DIR/conf_exp.reg + + conf_roundtrip_step $NET conf list >$DIR/conf_out + diff -q $DIR/conf_out $DIR/conf_exp >> $LOG + if [ "$?" = "1" ]; then + echo "ERROR: registry import => conf export failed" | tee -a $LOG + return 1 + fi + + conf_roundtrip_step $NET registry export $REGPATH $DIR/conf_out.reg + diff -q $DIR/conf_out.reg $DIR/conf_exp.reg >>$LOG + if [ "$?" = "1" ]; then + echo "Error: registry import => registry export failed" | tee -a $LOG + return 1 + fi + rm -r $DIR +} + +CONF_FILES=${CONF_FILES:-$(find $SRCDIR/ -name '*.conf' | xargs grep -l "\[global\]")} + +for conf_file in $CONF_FILES +do + testit "conf_roundtrip $conf_file" \ + conf_roundtrip $conf_file \ + || failed=`expr $failed + 1` +done + +testok $0 $failed + diff --git a/source3/script/tests/test_success.sh b/source3/script/tests/test_success.sh new file mode 100755 index 0000000..09e7264 --- /dev/null +++ b/source3/script/tests/test_success.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Blackbox test that should simply succeed. +# +# Copyright (C) 2011 Michael Adam <ob...@samba.org> + +# include the blackbox subunit infrastructure +# if not run from classical s3 test script: +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { + incdir=`dirname $0`/../../../testprogs/blackbox + . $incdir/subunit.sh +} + +failed=0 + +test_success() +{ + true +} + +testit "success" \ + test_success || \ + failed=`expr $failed + 1` + +testok $0 $failed + diff --git a/source3/selftest/knownfail b/source3/selftest/knownfail index 661ec50..9f80919 100644 --- a/source3/selftest/knownfail +++ b/source3/selftest/knownfail @@ -1,3 +1,4 @@ +samba3.blackbox.failure # this is designed to fail, for testing our test infrastructure .*printer.*print_test_extended # fails on some hosts due to timing issues ? .*printer.*print_test # fails on some hosts due to timing issues ? samba3.posix_s3.rap.printing # fails sometimes on sn-devel @@ -5,3 +6,4 @@ samba3.posix_s3.rpc.spoolss.*printserver.enum_printers_old # fails on some hosts samba3.posix_s3.rpc.spoolss.printer.*addprinterex.print_test # another intermittent failure samba3.posix_s3.smb2.lock.*.rw-exclusive # another intermittent failure .*driver.add_driver_timestamps # we only can store dates, not timestamps +samba3.blackbox.net_s3_registry_roundtrip # this test needs fixing diff --git a/source3/selftest/tests.sh b/source3/selftest/tests.sh index abac442..a91ae01 100755 --- a/source3/selftest/tests.sh +++ b/source3/selftest/tests.sh @@ -79,6 +79,9 @@ export PASSWORD LOCAL_PATH="\$LOCAL_PATH" export LOCAL_PATH +plantest "blackbox.success" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_success.sh +plantest "blackbox.failure" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_failure.sh + ( shift $# testitprefix="local_s3." @@ -152,6 +155,7 @@ plantest "blackbox.smbclient_s3.crypt" dc BINDIR="$BINDIR" script/tests/test_smb plantest "blackbox.net_s3_misc" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_misc.sh plantest "blackbox.net_s3_registry" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry.sh plantest "blackbox.net_s3_registry_rpc" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry.sh rpc +plantest "blackbox.net_s3_registry_roundtrip" dc:local BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_net_registry_roundtrip.sh plantest "blackbox.testparm_s3" dc:local LOCAL_PATH="$LOCAL_PATH" BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" SERVERCONFFILE="\$SMB_CONF_PATH" script/tests/test_testparm_s3.sh ( diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 32c2023..c98fc07 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -2100,7 +2100,8 @@ int net_rpc_registry(struct net_context *c, int argc, const char **argv) "export", rpc_registry_export, NET_TRANSPORT_RPC, - N_("net registry export\n" + N_("Export .reg file"), + N_("net rpc registry export\n" " Export .reg file") }, {NULL, NULL, 0, NULL, NULL} diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh index b8e5b5b..9b047a2 100755 --- a/testprogs/blackbox/subunit.sh +++ b/testprogs/blackbox/subunit.sh @@ -84,6 +84,15 @@ testit_expect_failure () { return $status } +testok () { + name=`basename $1` + shift + failed=$2 + shift + + exit $failed +} + # work out the top level source directory if [ -d source4 ]; then SRCDIR="." -- Samba Shared Repository