From ff5a3e0737222b9914e012e9f303d094d13704f7 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 1 Apr 2020 12:19:41 -0700 Subject: [PATCH] [toranj] update test-602-channel-select to add extra wait (#4777) This commit changes the `test-602-channel-manager-channel-select` to wait for sample count to reach a limit (within a wait interval). This should help make the test more robust (e.g., in RCP/POSIX mode) when the simulation processing time may require more time (note that this test is run with very high speed-up). --- .../test-602-channel-manager-channel-select.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/toranj/test-602-channel-manager-channel-select.py b/tests/toranj/test-602-channel-manager-channel-select.py index fe771f3c7..b2a02d2be 100644 --- a/tests/toranj/test-602-channel-manager-channel-select.py +++ b/tests/toranj/test-602-channel-manager-channel-select.py @@ -88,11 +88,23 @@ verify( int(node.get(wpan.WPAN_CHANNEL_MANAGER_SUPPORTED_CHANNEL_MASK), 0) == all_channels_mask) +WAIT_TIME = 15 +EXPECTED_SAMEPLE_COUNT = 970 + # Sleep for 4.5 second with speedup factor of 10,000 this is more than 12 -# hours. +# hours. We sleep instead of immediately checking the sample counter in +# order to not add more actions/events into simulation (specially since +# we are running at very high speedup). time.sleep(4.5) -verify(int(node.get(wpan.WPAN_CHANNEL_MONITOR_SAMPLE_COUNT), 0) > 970) + +def check_sample_count(): + verify( + int(node.get(wpan.WPAN_CHANNEL_MONITOR_SAMPLE_COUNT), 0) > + EXPECTED_SAMEPLE_COUNT) + + +wpan.verify_within(check_sample_count, WAIT_TIME) # Verify the initial value of `NEW_CHANNEL` (should be zero if there has # been no channel change so far).