Repository navigation
omamobile-mmd: the bridge tests wait for the signals they read - #638
Conversation
Three tests waited for a property and then read the client's recorded signals at once. A property read can show a change before the main loop has handed the client the signals sent with it, so on a slow machine the list was short or empty: test_sim_appears_later saw one InterfacesAdded of four, test_enable_goes_to_sitd_radio and test_sitd_going_away_and_coming_back raised IndexError. Seen when the package was built on a Pixel 7 Pro (derekross#461), and on a laptop with the tests pinned to one loaded core, where every run failed in one of the three. Each of the three now waits for the signal it checks, through one helper. On the loaded core ten runs of test_bridge in a row pass. Tests only, no version change.
|
Thank you, @W4HO-ham, that was quick, and the cause is the right one: the I checked that this covers both failures I had on the 7 Pro. Plain load on On this head all 23 pass, and main with #461 and this on top passes all 37, Two small things for whenever you're next in that file, neither needed Merging this as it is. |
…ross#638) Three tests in test_bridge.py waited for a property and then read the client's recorded signals at once. A property read can return before the main loop has delivered the signals sent with it, so on a slow machine (seen building the package on a Pixel 7 Pro, derekross#461) test_sim_appears_later saw one InterfacesAdded of four and test_enable_goes_to_sitd_radio raised IndexError. Each now waits for the signal it checks, through one helper. Tests only, no version change.
From #461: built on a Pixel 7 Pro,
omamobile-mmd'stest/allfailed incheck(), not the same way twice (a list of modem interfaces, then anIndexErrorintest_enable_goes_to_sitd_radio).Cause. Three tests in
test_bridge.pywait for a property and then read the client's recorded signals at once. The client's signals are handed over by the main loop, and a synchronous property read can return the new value before the loop has dispatched the signals sent with it. On a fast machine the 20 ms spin insidewait_untilhides that; on a slow one the list is short or empty:test_sim_appears_laterInterfacesAdded, thenStateChangedtest_enable_goes_to_sitd_radioStateChangedIndexErrortest_sitd_going_away_and_coming_backInterfacesRemovedIndexErrorReproduced on an x86 laptop by pinning the tests to one core with four busy loops on it (
taskset -c 0 nice -n 10 python3 -m unittest test_bridge): the five runs that finished before I stopped it all failed, each in one or two of these three tests and nowhere else.Change. One helper,
signals(name, wanted, message), waits (5 s, as the other waits) until the recorded signals of that name satisfy the test's condition, and the three reads go through it. The assertions are unchanged. Nothing outsidetest/test_bridge.pyis touched, so no version change.Tested. On the same loaded core, ten runs of
test_bridgein a row pass (about 109 s each, against 8 s unloaded).packages/omamobile-mmd/test/allandtools/pr-checkpass. Not run on a phone.The other signal reads in the file sit behind a fixed
spin(.1)orspin(.2)after a call that has already returned; none of them failed in the loaded runs, so I left them alone.