From 4a99bce73633db42dff632d209e379f45d9aec22 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 1 Apr 2008 15:35:12 +0200 Subject: test: fix net_registry tests to correctly capture output of commands inside one test so that failure output is not clobbered by output of previous successful commands. Michael (This used to be commit cb3dafe5fd8867b000e01979d4232968d994d376) --- source3/script/tests/test_net_registry.sh | 37 +++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'source3/script/tests') diff --git a/source3/script/tests/test_net_registry.sh b/source3/script/tests/test_net_registry.sh index 4c6dd19100..82861bae10 100755 --- a/source3/script/tests/test_net_registry.sh +++ b/source3/script/tests/test_net_registry.sh @@ -73,8 +73,11 @@ test_createkey() BASEKEY=`dirname $KEY` SUBKEY=`basename $KEY` - ${NETREG} createkey ${KEY} + OUTPUT=`${NETREG} createkey ${KEY}` if test "x$?" != "x0" ; then + echo "ERROR: createkey ${KEY} failed" + echo "output:" + printf "%s\n" "$OUTPUT" false return fi @@ -108,14 +111,20 @@ test_deletekey() BASEKEY=`dirname ${KEY}` SUBKEY=`basename ${KEY}` - test_createkey "${KEY}" + OUTPUT=`test_createkey "${KEY}"` if test "x$?" != "x0" ; then + printf "%s\n" "${OUTPUT}" false return fi - ${NETREG} deletekey ${KEY} + OUTPUT=`${NETREG} deletekey ${KEY}` + if test "x$?" != "x0" ; then + printf "%s\n" "${OUTPUT}" + false + return + fi # check enumerate of basekey does not show key anymore: OUTPUT=`${NETREG} enumerate ${BASEKEY}` @@ -148,9 +157,9 @@ test_deletekey_nonexisting() { KEY="$1" - test_deletekey "${KEY}" - + OUTPUT=`test_deletekey "${KEY}"` if test "x$?" != "x0" ; then + printf "%s\n" "${OUTPUT}" false return fi @@ -170,17 +179,19 @@ test_createkey_with_subkey() BASENAME=`dirname ${KEY2}` SUBKEYNAME1=`basename ${KEY2}` - ${NETREG} createkey ${KEY} - + OUTPUT=`${NETREG} createkey ${KEY}` if test "x$?" != "x0" ; then + echo "ERROR: createkey ${KEY} failed" + printf "%s\n" "${OUTPUT}" false return fi # check we can enumerate to level key - ${NETREG} enumerate ${KEY} + OUTPUT=`${NETREG} enumerate ${KEY}` if test "x$?" != "x0" ; then echo "ERROR: failed to enumerate '${KEY}' after creation" + printf "%s\n" "${OUTPUT}" false return fi @@ -194,9 +205,9 @@ test_deletekey_with_subkey() KEY="$1" KEY2=`dirname ${KEY}` - ${NETREG} createkey ${KEY} - + OUTPUT=`${NETREG} createkey ${KEY}` if test "x$?" != "x0" ; then + printf "%s\n" "${OUTPUT}" false return fi @@ -221,15 +232,17 @@ test_setvalue() VALTYPE="$3" VALVALUE="$4" - test_createkey ${KEY} + OUTPUT=`test_createkey ${KEY}` if test "x$?" != "x0" ; then + printf "%s\n" "${OUTPUT}" false return fi - ${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE} ${VALVALUE} + OUTPUT=`${NETREG} setvalue ${KEY} ${VALNAME} ${VALTYPE} ${VALVALUE}` if test "x$?" != "x0" ; then echo "ERROR: failed to set value testval in key ${KEY}" + printf "%s\n" "${OUTPUT}" false return fi -- cgit