Skip to content

Commit

Permalink
[tests] enhance expect test for link metrics manager feature (openthr…
Browse files Browse the repository at this point in the history
…ead#10035)

This commit enhances the expect test against link metrics manager
feature to ensure that the feature can be continuously turned on or
off and work well. Because the feature will be controlled by the
feature flag in ot-br-posix.
  • Loading branch information
Irving-cl authored Apr 17, 2024
1 parent 8692f2f commit b6a1dc8
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions tests/scripts/expect/v1_2-linkmetricsmgr.exp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,81 @@ expect_line "Done"
send "linkmetricsmgr xxx\n"
expect_line "InvalidCommand"

# Test continuous enable
send "linkmetricsmgr enable\n"
expect_line "Done"
send "linkmetricsmgr enable\n"
expect_line "Done"
send "linkmetricsmgr enable\n"
expect_line "Done"

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

sleep 10

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

send "linkmetricsmgr show\n"
expect -re {ExtAddr:([0-9a-f]){16}, LinkMargin:\d+, Rssi:\-?\d+}
expect "Done"

# Test continuous disable
send "linkmetricsmgr disable\n"
expect_line "Done"
send "linkmetricsmgr disable\n"
expect_line "Done"
send "linkmetricsmgr disable\n"
expect_line "Done"

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

sleep 10

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

send "linkmetricsmgr show\n"
expect_line "Done"

# Test continuous switch
send "linkmetricsmgr enable\n"
expect_line "Done"
send "linkmetricsmgr disable\n"
expect_line "Done"
send "linkmetricsmgr enable\n"
expect_line "Done"

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

sleep 10

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

send "linkmetricsmgr show\n"
expect -re {ExtAddr:([0-9a-f]){16}, LinkMargin:\d+, Rssi:\-?\d+}
expect "Done"

send "linkmetricsmgr disable\n"
expect_line "Done"
send "linkmetricsmgr enable\n"
expect_line "Done"
send "linkmetricsmgr disable\n"
expect_line "Done"

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

sleep 10

send "ping $addr\n"
expect "16 bytes from $addr: icmp_seq="

send "linkmetricsmgr show\n"
expect_line "Done"

dispose_all

0 comments on commit b6a1dc8

Please sign in to comment.