From c84289fbf7cdecb694a8ab92e96b219fe7a20e35 Mon Sep 17 00:00:00 2001 From: Nathan Yee <nyee32@schedmd.com> Date: Thu, 3 Sep 2015 16:03:16 -0700 Subject: [PATCH] Fix test_select_type_params to be more robust (not get CR_CORE_DEFAULT... when looking for CR_CORE_MEMORY) --- testsuite/expect/globals | 71 +++++++++++++++++++++++--------------- testsuite/expect/test1.97 | 2 +- testsuite/expect/test17.34 | 3 +- testsuite/expect/test17.36 | 7 ++-- testsuite/expect/test17.40 | 4 +-- testsuite/expect/test21.21 | 2 +- testsuite/expect/test21.30 | 6 ++-- testsuite/expect/test21.34 | 2 +- testsuite/expect/test3.11 | 3 +- testsuite/expect/test4.12 | 9 +++-- testsuite/expect/test9.8 | 2 +- 11 files changed, 61 insertions(+), 50 deletions(-) diff --git a/testsuite/expect/globals b/testsuite/expect/globals index 355cf7d7696..304507b0ad6 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -145,7 +145,7 @@ cset prompt "(%|#|\\\$|]|\[^>]>) *(|\[^ ]* *)$" # Specify locations of other executable files used # Only the shell names (e.g. bin_bash) must be full pathnames # -cset bin_awk "awk" +cset bin_awk "awk" cset bin_bash [exec which bash | tail -n 1] cset bin_cat "cat" cset bin_cc "gcc" @@ -1537,11 +1537,11 @@ proc get_default_acct { user } { if { !$user } { spawn $bin_id -un expect { - -re "($alpha_numeric_under)" { - set user $expect_out(1,string) + -re "($alpha_numeric_under)" { + set user $expect_out(1,string) } eof { - wait + wait } } } @@ -1943,10 +1943,11 @@ proc test_select_type { } { # ################################################################ -proc test_select_type_params { } { +proc test_select_type_params { type } { global scontrol bin_bash bin_grep alpha_numeric_comma log_user 0 + set ret 0 set params "" spawn -noecho $bin_bash -c "exec $scontrol show config | $bin_grep SelectTypeParameters" expect { @@ -1958,9 +1959,25 @@ proc test_select_type_params { } { wait } } + + set params [split $params ,] + + if {[string compare -nocase $type "MEMORY"]} { + foreach item $params { + if {[string first $type $item] == 0} { + set ret 1 + } + } + } else { + foreach item $params { + if {[string compare -nocase $type $item] == 0} { + set ret 1 + } + } + } log_user 1 - return $params + return $ret } ################################################################ @@ -2386,13 +2403,13 @@ proc check_acct_associations { } { set rc 1 log_user 0 send_user "Testing Associations\n" - # - # Use sacctmgr to check associations - # - set s_pid [spawn $sacctmgr -n -p list assoc wopi wopl withd format=lft,rgt,cluster] - expect { + # + # Use sacctmgr to check associations + # + set s_pid [spawn $sacctmgr -n -p list assoc wopi wopl withd format=lft,rgt,cluster] + expect { -re "($number)\\|($number)\\|($alpha_numeric_under)\\|" { - # Here we are checking if we have duplicates and + # Here we are checking if we have duplicates and # setting up an array to check for holes later set cluster $expect_out(3,string) @@ -2401,7 +2418,7 @@ proc check_acct_associations { } { set c_max($cluster) -1 } - set num1 $expect_out(1,string) + set num1 $expect_out(1,string) set num2 $expect_out(2,string) set first [info exists found($cluster,$num1)] set sec [info exists found($cluster,$num2)] @@ -2417,15 +2434,15 @@ proc check_acct_associations { } { set found($cluster,$num2) 1 if { $c_min($cluster) == -1 || $c_min($cluster) > $num1 } { - set c_min($cluster) $num1 + set c_min($cluster) $num1 } if { $c_max($cluster) == -1 || $c_max($cluster) < $num2 } { - set c_max($cluster) $num2 + set c_max($cluster) $num2 } } exp_continue - } + } timeout { send_user "FAILURE: sacctmgr add not responding\n" slow_kill $s_pid @@ -2550,19 +2567,19 @@ proc check_accounting_admin_level { } { } if { ![string length $user_name] } { - send_user "FAILURE: No name returned from id\n" + send_user "FAILURE: No name returned from id\n" return "" } - # - # Use sacctmgr to check admin_level - # - set s_pid [spawn $sacctmgr -n -P list user $user_name format=admin] - expect { + # + # Use sacctmgr to check admin_level + # + set s_pid [spawn $sacctmgr -n -P list user $user_name format=admin] + expect { -re "($alpha)" { - set admin_level $expect_out(1,string) + set admin_level $expect_out(1,string) exp_continue - } + } timeout { send_user "FAILURE: sacctmgr add not responding\n" slow_kill $s_pid @@ -2690,9 +2707,9 @@ proc get_bluegene_psets { } { # Purpose: Determine what kind of bluegene system we are running # # Returns 'L' for bluegene/L, -# 'P' for bluegene/P, +# 'P' for bluegene/P, # 'Q' for bluegene/Q, -# 0 if not set +# 0 if not set # ################################################################ @@ -3233,7 +3250,7 @@ proc get_fs_damping_factor { } { # Proc: slurmctld_plug_stack_nonstop # # Purpose: Use scontrol to determine that the -# SlurmctldPlugstack is set to nonstop. +# SlurmctldPlugstack is set to nonstop. # # Returns: 1 if the value is set to nonstop. # diff --git a/testsuite/expect/test1.97 b/testsuite/expect/test1.97 index 833f647ca87..57811a8ab3b 100755 --- a/testsuite/expect/test1.97 +++ b/testsuite/expect/test1.97 @@ -47,7 +47,7 @@ set timeout 60 print_header $test_id -if {![string match *CR_PACK_NODES* [test_select_type_params]]} { +if {![test_select_type_params "CR_PACK_NODES"]} { send_user "\nWARNING: this test requires " send_user "SelectTypeParameters=CR_PACK_NODES\n" exit 0 diff --git a/testsuite/expect/test17.34 b/testsuite/expect/test17.34 index 0fb14021ba2..42c5caa5a65 100755 --- a/testsuite/expect/test17.34 +++ b/testsuite/expect/test17.34 @@ -183,8 +183,7 @@ if {![string compare $select_type "linear"]} { send_user "\nWARNING: This test is incompatible with select/$select_type\n" exit 0 } -set select_type_params [test_select_type_params] -if {[string match "*CR_SOCKET*" $select_type_params]} { +if {[test_select_type_params "CR_SOCKET"]} { send_user "\nWARNING: This test is incompatible with CR_SOCKET allocations\n" exit 0 } diff --git a/testsuite/expect/test17.36 b/testsuite/expect/test17.36 index e70bbbe5b5b..b00e93e74a2 100755 --- a/testsuite/expect/test17.36 +++ b/testsuite/expect/test17.36 @@ -57,15 +57,14 @@ if {[is_super_user] == 0} { send_user "\nWARNING: This test can't be run except as SlurmUser\n" exit 0 } -set select_type_params [test_select_type_params] -if {[string first "CR_SOCKET" $select_type_params] != -1} { +if {[test_select_type_params "CR_SOCKET"]} { send_user "\nWARNING: This test is incompatible with CR_SOCKET allocations\n" exit 0 } -if {[string first "CR_CORE" $select_type_params] != -1} { +if {[test_select_type_params "CR_CORE"]} { set cr_core 1 } -if {[string first "CR_CPU" $select_type_params] != -1} { +if {[test_select_type_params "CR_CPU"]} { set cr_cpu 1 } diff --git a/testsuite/expect/test17.40 b/testsuite/expect/test17.40 index 5b419183714..9f37e45559e 100755 --- a/testsuite/expect/test17.40 +++ b/testsuite/expect/test17.40 @@ -183,8 +183,8 @@ if {![string compare $select_type "linear"] || ![string compare $select_type "se send_user "\nWARNING: This test is incompatible with select/$select_type\n" exit 0 } -set select_type_params [test_select_type_params] -if {[string match "*CR_SOCKET*" $select_type_params]} { + +if {[test_select_type_params "CR_SOCKET"]} { send_user "\nWARNING: This test is incompatible with CR_SOCKET allocations\n" exit 0 } diff --git a/testsuite/expect/test21.21 b/testsuite/expect/test21.21 index b2c063d0219..50d9a328b79 100755 --- a/testsuite/expect/test21.21 +++ b/testsuite/expect/test21.21 @@ -84,7 +84,7 @@ array set acct_mod_assoc_test_vals { print_header $test_id # Determine what the selecttype param is -if {[string first "CR_CORE" [test_select_type_params]] != -1} { +if {[test_select_type_params "CR_CORE"]} { set selectparam 1 } diff --git a/testsuite/expect/test21.30 b/testsuite/expect/test21.30 index 4b1e62ab82a..4f1553dc0f2 100755 --- a/testsuite/expect/test21.30 +++ b/testsuite/expect/test21.30 @@ -174,7 +174,7 @@ proc check_state { job } { } # Determine what the selecttype param is -if {[string first "CR_CORE" [test_select_type_params]] != -1} { +if {[test_select_type_params "CR_CORE"]} { set selectparam 1 } @@ -334,8 +334,7 @@ if {![string compare $select_type "linear"] || [default_part_exclusive]} { send_user "\nWARNING: This test is incompatible with exclusive node allocations\n" exit 0 } -set select_type_params [test_select_type_params] -if {[string match "*CR_SOCKET*" $select_type_params]} { +if {[test_select_type_params "CR_SOCKET"]} { send_user "\nWARNING: This test is incompatible with CR_SOCKET allocations\n" exit 0 } @@ -455,7 +454,6 @@ set mod_qos_vals(GrpNodes) "-1" # Test GrpCpus # set mod_qos_vals(GrpCpus) $grcpu_num -send_user "\nmoding qos\n" mod_qos $qostest [array get mod_qos_vals] sleep $time_spacing inc21_30_2 diff --git a/testsuite/expect/test21.34 b/testsuite/expect/test21.34 index 7713e918b99..4550e48db88 100755 --- a/testsuite/expect/test21.34 +++ b/testsuite/expect/test21.34 @@ -269,7 +269,7 @@ if {$tmpc == 0 || $tmpn == 0} { } # Determine what the selecttype param is -if {[string first "CR_CORE" [test_select_type_params]] != -1} { +if {[test_select_type_params "CR_CORE"]} { set selectparam 1 } diff --git a/testsuite/expect/test3.11 b/testsuite/expect/test3.11 index f714e479d0d..962d310c47c 100755 --- a/testsuite/expect/test3.11 +++ b/testsuite/expect/test3.11 @@ -411,8 +411,7 @@ set node_count [available_nodes $def_partition ""] set cluster_cpus [expr $cores_per_node * $node_count] set cr_socket 0 -set select_type_params [test_select_type_params] -if {[string match "*CR_SOCKET*" $select_type_params]} { +if {[test_select_type_params "CR_SOCKET"]} { set cr_socket 1 } diff --git a/testsuite/expect/test4.12 b/testsuite/expect/test4.12 index e481e538c96..1046f6d0e75 100755 --- a/testsuite/expect/test4.12 +++ b/testsuite/expect/test4.12 @@ -450,16 +450,15 @@ if {![string compare $select_type "bluegene"]} { } elseif {![string compare $select_type "linear"]} { set smallest $inode_procs } else { - set select_params [test_select_type_params] if {$part_exclusive == 1} { set smallest $inode_procs - } elseif {[string first "CR_CPU" $select_params] != -1} { + } elseif {[test_select_type_params "CR_CPU"]} { set smallest $inode_threads_per_core - } elseif {![string compare $select_params "NONE"]} { + } elseif {[test_select_type_params "NONE"]} { set smallest $inode_threads_per_core - } elseif {[string first "CR_CORE" $select_params] != -1} { + } elseif {[test_select_type_params "CR_CORE"]} { set smallest $inode_threads_per_core - } elseif {[string first "CR_SOCKET" $select_params] != -1} { + } elseif {[test_select_type_params "CR_SOCKET"]} { set smallest [expr $inode_cores_per_socket *$inode_threads_per_core] } else { send_user "\nWARNING: failed to parse SelectTypeParameters '$select_params'\n" diff --git a/testsuite/expect/test9.8 b/testsuite/expect/test9.8 index 4dd15168950..6e56f9fa476 100755 --- a/testsuite/expect/test9.8 +++ b/testsuite/expect/test9.8 @@ -51,7 +51,7 @@ if {[test_alps]} { exit $exit_code } -if {[string first "Memory" test_select_type_params] == -1} { +if {[test_select_type_params "Memory"]} { set mem_per_step 0 } elseif {[test_launch_poe]} { set mem_per_step 200 -- GitLab