From 48b4c4b13ab6e07341870d5acf84600aaa7e8ab8 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Wed, 7 Feb 2007 14:37:33 +0000 Subject: [PATCH] _check_sids previously grepped the entire output of dm_getall_sessions for sids, which is: ret=dm_getall_sessions return value rnelem=number of sessions sids="sid1 sid2 ... sidn " If the session id of a previously destroyed session matches the current number of sessions (rnelem), then _check_sids() $PREV_DESTROYED_SID will _not_ flag ERROR: SID(s) not created. This fix also makes _check_sids() not rely on sids being consecutive. DMF may be running on a FS in background. Tested on Linux and Irix. Merge of master-melb:xfs-cmds:28043a by kenmcd. change _check_sids to go through sids line 1 by 1 checking for matches --- 151 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/151 b/151 index 0afeaaf5..218f7809 100755 --- a/151 +++ b/151 @@ -38,11 +38,15 @@ _filter_sid_list() _check_sids() { - ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions | grep "$@" > /dev/null - if [ $? -ne 0 ] ; then - echo "ERROR: SID(s) not created" - ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions >>$seq.full - fi + for i in $@; do + CHECKED_SID=`${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions \ + | perl -ne "if (/^sids.*[\"|\s]($i)[\"|\s].*/) {print \$1} ;"` + if [ -z "$CHECKED_SID" ] ; then + echo "ERROR: SID(s) not created" + ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions >>$seq.full + return + fi + done } # get standard environment, filters and checks @@ -67,18 +71,18 @@ _dm_create_session sid3=$newsid echo "*** check 3 sessions exist" -_check_sids "$sid1 $sid2 $sid3" +_check_sids $sid1 $sid2 $sid3 echo "*** destroy first session" ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid1 #should fail echo "*** check first session no longer exists" -_check_sids "$sid1" +_check_sids $sid1 #should still remain echo "*** check last 2 session exist" -_check_sids "$sid2 $sid3" +_check_sids $sid2 $sid3 echo "*** query" ${DMAPI_QASUITE1_DIR}../simple/dm_query_session -s $sid2 @@ -88,10 +92,10 @@ ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid2 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid3 echo "*** check second session no longer exists" -_check_sids "$sid2" +_check_sids $sid2 echo "*** check third session no longer exists" -_check_sids "$sid3" +_check_sids $sid3 status=0 exit -- 2.30.2