From dbabd1989842ebc9de25db063d6f0765a78e9c40 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Thu, 18 Apr 2013 16:36:51 -0700 Subject: [PATCH] handle failures in test better --- testsuite/expect/inc21.30.1 | 8 ++-- testsuite/expect/test21.30 | 92 ++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/testsuite/expect/inc21.30.1 b/testsuite/expect/inc21.30.1 index 640d38ef27c..cacb0617781 100644 --- a/testsuite/expect/inc21.30.1 +++ b/testsuite/expect/inc21.30.1 @@ -32,6 +32,7 @@ proc inc21_30_1 {} { #test GrpNode limit global srun salloc acct bin_sleep jobmatch job_id1 job_id2 number + global exit_code set jobmatch 0 spawn $salloc -N1 --account=$acct $srun $bin_sleep 10 @@ -43,7 +44,7 @@ proc inc21_30_1 {} { } timeout { send_user "\nFAILURE: salloc is not reponding\n" - exit 1 + set exit_code 1 } eof { wait @@ -59,7 +60,7 @@ proc inc21_30_1 {} { } timeout { send_user "\nFAILURE: salloc is not reponding\n" - exit 1 + set exit_code 1 } eof { wait @@ -68,7 +69,7 @@ proc inc21_30_1 {} { if {$jobmatch==0} { send_user "\nFAILURE: jobs were not submitted\n" - exit 1 + set exit_code 1 } # checks the state of the job @@ -77,5 +78,4 @@ proc inc21_30_1 {} { #cancels remaining jobs cancel_job $job_id1 cancel_job $job_id2 - } diff --git a/testsuite/expect/test21.30 b/testsuite/expect/test21.30 index 3f749a811eb..021803bb834 100755 --- a/testsuite/expect/test21.30 +++ b/testsuite/expect/test21.30 @@ -120,6 +120,51 @@ proc mod_qos { node cpu job sub mcpu mnode mjobs mjobsub } { } +proc endit { } { + global sacctmgr qostest acct test_id exit_code + # delete qos + spawn $sacctmgr -i delete qos $qostest + expect { + -re "Deleting QOS(s)" { + exp_continue + } + -re "Error" { + send_user "\nFAILURE: QOS was not deleted\n" + } + timeout { + send_user "\nFAILURE: sacctmgr is not responding\n" + } + eof { + wait + } + } + + #delete account + spawn $sacctmgr -i delete account $acct + expect { + -re "Deleting accounts" { + exp_continue + } + -re "Error" { + send_user "\nFAILURE: account was not deleted\n" + set exit_code 1 + } + timeout { + send_user "\nFAILURE: sacctmgr is not responding\n" + set exit_code 1 + } + eof { + wait + } + } + + if {$exit_code == 0} { + print_success $test_id + } + + exit $exit_code +} + #gets user spawn $bin_id -u -n expect { @@ -193,7 +238,9 @@ mod_qos $grn_num -1 -1 -1 -1 -1 -1 -1 sleep 5 #test GrpNode limit inc21_30_1 - +if {$exit_code != 0} { + endit +} mod_qos -1 $grcpu_num -1 -1 -1 -1 -1 -1 @@ -239,45 +286,4 @@ sleep 5 #test MaxJobsSubmits limit inc21_30_8 -# delete qos -spawn $sacctmgr -i delete qos $qostest -expect { - -re "Deleting QOS(s)" { - exp_continue - } - -re "Error" { - send_user "\nFAILURE: QOS was not deleted\n" - } - timeout { - send_user "\nFAILURE: sacctmgr is not responding\n" - } - eof { - wait - } -} - -#delete account -spawn $sacctmgr -i delete account $acct -expect { - -re "Deleting accounts" { - exp_continue - } - -re "Error" { - send_user "\nFAILURE: account was not deleted\n" - set exit_code 1 - } - timeout { - send_user "\nFAILURE: sacctmgr is not responding\n" - set exit_code 1 - } - eof { - wait - } -} - -if {$exit_code==0} { - print_success $test_id -} - -exit $exit_code - +endit -- GitLab