From: Egbert Eich Date: Wed Jun 22 14:39:10 2022 +0200 Subject: Fix test 21.41 Patch-mainline: Not yet Git-repo: https://github.com/SchedMD/slurm Git-commit: 21619ffa15d1d656ee11a477ebb8215a06387fdd References: Since expect is not line oriented, the output is not matched line by line. Thus the order in which results are returned by sacctmgr actually matters: If the first test case matches what is returned first, this part will be consumed. If the 2nd test case will then match what is left over, the test will actually succeed. If this is not the case, ie if the first test matches a part that is actually sent later, the earlier parts will actually be forgotten and won't match at all. To make the test resilient to different order of results, the test has been rewritten to only contain a single match line. Signed-off-by: Egbert Eich Signed-off-by: Egbert Eich --- testsuite/expect/test21.41 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/testsuite/expect/test21.41 b/testsuite/expect/test21.41 index c0961522db..1fd921a48f 100755 --- a/testsuite/expect/test21.41 +++ b/testsuite/expect/test21.41 @@ -372,21 +372,21 @@ expect { -re "There was a problem" { fail "There was a problem with the sacctmgr command" } - -re "$user1.$wckey1.($number)." { - set user1wckey1 $expect_out(1,string) - exp_continue - } - -re "$user2.$wckey1.($number)." { - set user2wckey1 $expect_out(1,string) - exp_continue - } - -re "$user1.$wckey2.($number)." { - set user1wckey2 $expect_out(1,string) - exp_continue - } - -re "$user2.$wckey2.($number)." { - set user2wckey2 $expect_out(1,string) - exp_continue + -re "($user1|$user2).($wckey1|$wckey2).($number)." { + if { $expect_out(1,string) eq $user1 } { + if { $expect_out(2,string) eq $wckey1 } { + set user1wckey1 $expect_out(3,string) + } elseif { $expect_out(2,string) eq $wckey2 } { + set user1wckey2 $expect_out(3,string) + } + } elseif { $expect_out(1,string) eq $user2 } { + if { $expect_out(2,string) eq $wckey1 } { + set user2wckey1 $expect_out(3,string) + } elseif { $expect_out(2,string) eq $wckey2 } { + set user2wckey2 $expect_out(3,string) + } + } + exp_continue } timeout { fail "sacctmgr wckeys not responding"