pioneers / runtime

Firmware for the PiE kit robots and devices
7 stars 2 forks source link

[TEST] Investigate tc_150_1 failing on Travis #231

Closed levincent06 closed 3 years ago

levincent06 commented 3 years ago

The Travis build on PR #227 has failed a couple of times on tc_150_1. The test passes appears to pass consistently on an actual Raspberry Pi. The build passes when restarted. Here is a sample log:

*********************** Starting Test: "keyboard_input" ************************
DEBUG @ NET_HANDLER (Thu Sep  9 21:28:28 2021) Received connection request from 127.0.0.1:37400
DEBUG @ NET_HANDLER (Thu Sep  9 21:28:28 2021) Starting Shepherd connection
INFO @ DEV_HANDLER  (Thu Sep  9 21:28:28 2021) DEV_HANDLER initialized.
DEBUG @ DEV_HANDLER (Thu Sep  9 21:28:28 2021) Polling now for devices.
INFO @ EXECUTOR (Thu Sep  9 21:28:28 2021) Executor initialized
INFO @ DEV_HANDLER  (Thu Sep  9 21:28:29 2021) Connected SimpleTestDevice (0x0000000000000014) from year 62!
DEBUG @ DEV_HANDLER (Thu Sep  9 21:28:29 2021) Monitoring SimpleTestDevice (0x0000000000000014)
keyboard_input: check 1 passed
DEBUG @ NET_HANDLER (Thu Sep  9 21:28:31 2021) entering TELEOP mode
keyboard_input: check 2 failed
************************** Expected Pressed Buttons: ***************************
0000000000000000000000001000000000000000000000000000000000000000
************************************* Got: *************************************
0000000000000000000000000100000000000000000000000000000000000000
levincent06 commented 3 years ago

Issue is likely because we have 0.1 and 0.8 as an argument to sleep(), which takes an unsigned int. Decimals less than 1 will get casted to an unsigned int, which evaluates to 0.

Since the sleep(0) becomes a no-op, the test doesn't wait enough time for Runtime to process client inputs.