From 0ef8f510c50391e99eb0402e0999499d7502d679 Mon Sep 17 00:00:00 2001 From: Moandor Date: Thu, 30 Jul 2020 02:36:06 +0800 Subject: [PATCH] [test] fix network name capturing in expect scripts (#5284) This fixes some expect test failures caused by the following scenario: Sometimes the command prompt > can be put after the echo of the input command when inputs come too fast, because we are sending the next command as soon as we see Done, we don't wait for the next > . This commit adds expect "> " before sending the command to fix this. --- tests/scripts/expect/cli-scan-discover.exp | 1 + tests/scripts/expect/posix-scan-tx-to-sleep.exp | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/scripts/expect/cli-scan-discover.exp b/tests/scripts/expect/cli-scan-discover.exp index 79482b71a..5d0b7c9ff 100755 --- a/tests/scripts/expect/cli-scan-discover.exp +++ b/tests/scripts/expect/cli-scan-discover.exp @@ -51,6 +51,7 @@ expect "extpanid" expect -re {([0-9a-f]{16})} set extpan $expect_out(1,string) expect "Done" +expect "> " send "networkname\n" expect "networkname" expect -re {[\r\n]([^\r\n]+?)[\r\n]} diff --git a/tests/scripts/expect/posix-scan-tx-to-sleep.exp b/tests/scripts/expect/posix-scan-tx-to-sleep.exp index b70ef450f..33e7958b6 100755 --- a/tests/scripts/expect/posix-scan-tx-to-sleep.exp +++ b/tests/scripts/expect/posix-scan-tx-to-sleep.exp @@ -63,6 +63,7 @@ expect "extpanid" expect -re {([0-9a-f]{16})} set extpan $expect_out(1,string) expect "Done" +expect "> " send "networkname\n" expect "networkname" expect -re {[\r\n]([^\r\n]+)[\r\n]}