diff --git a/testsuite/expect/globals b/testsuite/expect/globals index ac723d04a66847227ed27ea8ac8856c379bf8e9c..f774de16934d79cf23f0bfa555149a1852641841 100755 --- a/testsuite/expect/globals +++ b/testsuite/expect/globals @@ -923,6 +923,43 @@ proc test_topology { } { return $have_topology } +################################################################ +# +# Proc: test_affinity +# +# Purpose: Determine if system is enforcing affinity +# +# Returns 1 if enforcing, 0 if none +# +################################################################ +proc test_affinity { } { + global scontrol alpha + + log_user 0 + set affinity 0 + spawn $scontrol show config + expect { + -re "TaskPlugin *= task/($alpha)" { + if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} { + set affinity 1 + } + exp_continue + } + -re "TaskPlugin *= ($alpha)" { + if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} { + set affinity 1 + } + exp_continue + } + eof { + wait + } + } + + log_user 1 + return $affinity +} + ################################################################ # # Proc: test_track_wckey diff --git a/testsuite/expect/test1.89 b/testsuite/expect/test1.89 index c691194c8ccded40c3e0e8af4d57455b3458ecc5..809af2b6628b7a81236d0896bb633cb3a8a2412b 100755 --- a/testsuite/expect/test1.89 +++ b/testsuite/expect/test1.89 @@ -48,22 +48,7 @@ if {[test_serial]} { # # Test if task affinity support is supported. # -set affinity 0 -log_user 0 -spawn $scontrol show config -expect { - -re "TaskPlugin *= task/($alpha)" { - if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} { - set affinity 1 - } - exp_continue - } - eof { - wait - } -} -log_user 1 -if {$affinity == 0} { +if {![test_affinity]} { send_user "\nWARNING: task affinity not supported on this system\n" exit 0 } diff --git a/testsuite/expect/test1.90 b/testsuite/expect/test1.90 index bc10c07f57237f62319891142c75178b15c8fd16..1a0374b9929cc63708d4f86528f56c569d147a2c 100755 --- a/testsuite/expect/test1.90 +++ b/testsuite/expect/test1.90 @@ -48,7 +48,7 @@ if { [test_launch_poe] } { # # Test if memory affinity support is supported. # -set affinity 0 +set affinity [test_affinity] set fast_sched 0 log_user 0 spawn $scontrol show config @@ -57,12 +57,6 @@ expect { set fast_sched $expect_out(1,string) exp_continue } - -re "TaskPlugin *= task/($alpha)" { - if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} { - set affinity 1 - } - exp_continue - } eof { wait } diff --git a/testsuite/expect/test1.91 b/testsuite/expect/test1.91 index 68019d4fa8da3c5341c1a7d576a153de45f5ac71..51e014d9d748acbb554e2d07851f1481d61c9fce 100755 --- a/testsuite/expect/test1.91 +++ b/testsuite/expect/test1.91 @@ -52,22 +52,7 @@ if {[test_launch_poe]} { # # Test if task affinity support is supported. # -set affinity 0 -log_user 0 -spawn $scontrol show config -expect { - -re "TaskPlugin *= task/($alpha)" { - if {![string compare $expect_out(1,string) "affinity"] || ![string compare $expect_out(1,string) "cgroup"]} { - set affinity 1 - } - exp_continue - } - eof { - wait - } -} -log_user 1 -if {$affinity == 0} { +if {![test_affinity]} { send_user "\nWARNING: task affinity not supported on this system\n" exit 0 }