_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
This commit is contained in:
David Disseldorp
2007-02-07 14:37:33 +00:00
parent dfd5bd939e
commit 48b4c4b13a
+14 -10
View File
@@ -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