printf "Checking state of collection... "
- jobstate=`${LBJOBSTATUS} $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
- if [ "${jobstate}" = "Purged" ]; then
- printf "${jobstate}"
+ ${LBJOBSTATUS} $jobid > $$_collstate.tmp 2> $$_collstate_err.tmp
+ jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+ $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+ if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+
+ if [ "${jobstate}" = "Purged" ]; then
+ printf "${jobstate}"
+ else
+ printf "Identifier removed"
+ fi
test_done
printf "Checking state of subjob #1... "
- jobstate=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
- if [ "${jobstate}" = "Purged" ]; then
- printf "${jobstate}"
+ ${LBJOBSTATUS} ${subjobs[0]} > $$_collstate.tmp 2> $$_collstate_err.tmp
+ jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+ $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+ if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+ if [ "${jobstate}" = "Purged" ]; then
+ printf "${jobstate}"
+ else
+ printf "Identifier removed"
+ fi
test_done
else
test_failed
fi
printf "Checking state of subjob #2... "
- jobstate=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'`
- if [ "${jobstate}" = "Purged" ]; then
- printf "${jobstate}"
+ ${LBJOBSTATUS} ${subjobs[1]} > $$_collstate.tmp 2> $$_collstate_err.tmp
+ jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp`
+ $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null
+ if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
+ if [ "${jobstate}" = "Purged" ]; then
+ printf "${jobstate}"
+ else
+ printf "Identifier removed"
+ fi
test_done
else
test_failed
fi
$SYS_RM $$_jobs_to_purge_test.txt
+ $SYS_RM $$_collstate.tmp
+ $SYS_RM $$_collstate_err.tmp
fi
${LBPURGE} -j ${joblist} > /dev/null
$SYS_RM ${joblist}
- jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'`
- printf "Test job purged. Testing state... ($jobstate)"
-
- if [ "${jobstate}" = "Purged" ]; then
+ printf "Test job purged. Testing state..."
+ ${LBJOBSTATUS} $jobid > $$_jobreg.tmp 2> $$_jobreg_err.tmp
+ jobstate=`$SYS_CAT $$_jobreg.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_jobreg.tmp`
+ $SYS_GREP "Identifier removed" $$_jobreg_err.tmp > /dev/null
+ if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
test_done
-
${LBJOBREG} -h 2>&1 | $SYS_GREP '\-E' > /dev/null
if [ $? = 0 ]; then
test_done
fi
- printf "Checking state (expecting state 'Purged'). "
- jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'`
-
- if [ "${jobstate}" = "Purged" ]; then
+ printf "Checking state (expecting state 'Purged' or EIDRM). "
+ ${LBJOBSTATUS} $jobid > $$_jobreg.tmp 2> $$_jobreg_err.tmp
+ jobstate=`$SYS_CAT $$_jobreg.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_jobreg.tmp`
+ $SYS_GREP "Identifier removed" $$_jobreg_err.tmp > /dev/null
+ if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then
test_done
else
printf " Option may be off on server side"
test_skipped
fi
+ $SYS_RM $$_jobreg.tmp
+ $SYS_RM $$_jobreg_err.tmp
fi
fi
test_end
-} &> $logfile
+}
+#} &> $logfile
-if [ $flag -ne 1 ]; then
- cat $logfile
- $SYS_RM $logfile
-fi
+#if [ $flag -ne 1 ]; then
+# cat $logfile
+# $SYS_RM $logfile
+#fi
exit $TEST_OK
test_printf ("** Check zombies\n");
$failed = 0;
+$errfile = $prefix . "_stat_err.tmp";
+$statfile = $prefix . "_stat.tmp";
+
for (values(%old),values(%new)) {
+ $jobid = $_;
$stat = 'nic moc';
- $stat = `$status $_ | head -2 | tail -1`;
+ system("$status $jobid > $statfile 2> $errfile");
+ $stat = `cat $statfile | head -2 | tail -1`;
chomp $stat;
$stat =~ s/state :\s*//;
-
- print "$_ $stat ";
- if ($stat ne 'Purged') { $failed = 1; test_failed(); }
+
+ $exitcode = system("grep \"Identifier removed\" $errfile > /dev/null");
+ if ( ! $exitcode ) { print "$jobid returned EIDRM"; }
+ else { print "$jobid $stat "; }
+ if ($stat ne 'Purged' && $exitcode ne 0) { $failed = 1; test_failed(); }
else { test_done(); }
}
-die "Jobs should be known and purged\n" if $failed;
+die "EIDRM or state Purged should have been returned for zombies\n" if $failed;
test_printf ("\n** All tests passed **");
test_done();