From 47772cc955f4f43f7046fa599af77e0eeec3046c Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Thu, 18 Dec 2008 23:02:53 +0000 Subject: [PATCH] Make testing more rigorous in terms of testing for WCKey values being set --- testsuite/expect/globals | 30 ++++++++++++++++++++++++++++++ testsuite/expect/test21.23 | 15 ++++----------- testsuite/expect/test21.24 | 19 ++++++++++++++++--- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 62781b94953..28dea26ebb7 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -533,6 +533,36 @@ proc test_assoc_enforced { } { return $assoc_enforced } +################################################################ +# +# Proc: test_track_wckey +# +# Purpose: Determine if we track workload characterization keys. +# This is based upon the value of TrackWCKey in the slurm.conf. +# +# Returns value of TrackWCKey +# +################################################################ +proc test_track_wckey { } { + global scontrol number + + log_user 0 + set track_wckey 0 + spawn $scontrol show config + expect { + -re "TrackWCKey *= ($number)" { + set track_wckey $expect_out(1,string) + exp_continue + } + eof { + wait + } + } + + log_user 1 + return $track_wckey +} + ################################################################ # Proc: test_wiki_sched # diff --git a/testsuite/expect/test21.23 b/testsuite/expect/test21.23 index 230a678aef7..3f6187392b4 100755 --- a/testsuite/expect/test21.23 +++ b/testsuite/expect/test21.23 @@ -46,6 +46,10 @@ if { [test_account_storage] == 0 } { send_user "\nWARNING: This test can't be run without a usable AccountStorageType\n" exit 0 } +if { [test_track_wckey] == 0} { + send_user "\nWARNING: This test can't be run without TrackWCKey being set\n" + exit 0 +} if { [string compare [check_accounting_admin_level] "Administrator"] } { send_user "\nWARNING: This test can't be run without being an Accounting administrator.\nUse sacctmgr mod user \$USER_NAME set admin=admin.\n" @@ -133,7 +137,6 @@ expect { # Spawn a job via salloc using this wckey # set job_id 0 -set have_wckey 0 set matches 0 set timeout $max_job_delay spawn $salloc -N1 --account=$test_acct --wckey=$wk @@ -145,14 +148,9 @@ expect { exp_continue } -re "WCKey=$wk" { - incr have_wckey incr matches exp_continue } - -re "WCKey=" { - incr have_wckey - exp_continue - } timeout { send_user "\nFAILURE: salloc not responding\n" set exit_code 1 @@ -161,11 +159,6 @@ expect { wait } } -if {$have_wckey == 0} { - send_user "\nWARNING: TrackWCKey is disabled, can not continue test\n" - exec $sacctmgr -i delete account $test_acct - exit $exit_code -} spawn $sacct -j $job_id --fields=wckey expect { diff --git a/testsuite/expect/test21.24 b/testsuite/expect/test21.24 index 2de61ea272f..167a125af20 100755 --- a/testsuite/expect/test21.24 +++ b/testsuite/expect/test21.24 @@ -220,6 +220,7 @@ if { [test_account_storage] == 0 } { send_user "\nWARNING: This test can't be run without a usable AccountStorageType\n" exit 0 } +set track_wckey [test_track_wckey] if { [string compare [check_accounting_admin_level] "Administrator"] } { send_user "\nWARNING: This test can't be run without being an Accounting administrator.\nUse sacctmgr mod user \$USER_NAME admin=admin.\n" @@ -1435,7 +1436,11 @@ expect { # Same as above, but without DefaultWCKey= or WCKeys= -re "($usr - $us3:$dac='$nm3':$al='$ala':$fs=$fs3:$gm=$gm3:$gc=$gc3:$gj=$gj3:$gn=$gn3:$gs=$gs3:$gw=$gw3:$mp=$mm3:$mu=$mc3:$mj=$mj3:$mnj=$mn3:$ms=$ms3:$md=$mw3:$qs='$qs2')" { send_user "\nmatch 5b\n" - incr matches + if {$track_wckey == 0} { + incr matches + } else { + send_user "\nFAILURE: Missing DefaultWCKey or WCKeys\n" + } exp_continue } @@ -1473,7 +1478,11 @@ expect { # Same as above but without DefaultWCKey= or WCKeys= -re "($usr - $us1:$dac='$nm2':$fs=$fs1:$gm=$gm1:$gc=$gc1:$gj=$gj1:$gn=$gn1:$gs=$gs1:$gw=$gw1:$mp=$mm1:$mu=$mc1:$mj=$mj1:$mnj=$mn1:$ms=$ms1:$md=$mw1:$qs='$qs2')" { send_user "\nmatch 10b\n" - incr matches + if {$track_wckey == 0} { + incr matches + } else { + send_user "\nFAILURE: Missing DefaultWCKey or WCKeys\n" + } exp_continue } @@ -1486,7 +1495,11 @@ expect { # Same as above but without DefaultWCKey= or WCKeys= -re "($usr - $us2:$dac='$nm2':$al='$alo':$fs=$fs2:$gm=$gm2:$gc=$gc2:$gj=$gj2:$gn=$gn2:$gs=$gs2:$gw=$gw2:$mp=$mm2:$mu=$mc2:$mj=$mj2:$mnj=$mn2:$ms=$ms2:$md=$mw2:$qs='$qs2')" { send_user "\nmatch 11b\n" - incr matches + if {$track_wckey == 0} { + incr matches + } else { + send_user "\nFAILURE: Missing DefaultWCKey or WCKeys\n" + } exp_continue } -- GitLab