liblog: don't sleep in the middle of tests
A lot of liblog tests follow this pattern: 1) Write a log message 2) Sleep ~1 second 3) Use the non_blocking log reader to dump all log messages 4) Test those log messages This causes running back to back tests to be very slow and still allows for some amount of flakiness if the system is very loaded. This change replaces that pattern with the following: 1) Write a log message 2) Set an alarm for 2 seconds as a test timeout 3) Read logs with the blocking reader until finding the expected log messages 4) Test those log messages 5) Use the non_blocking reader to dump all log messages 6) Re-test those log messages, to ensure no duplicates, etc, which isn't done in step 3). Despite dumping the logs twice, the tests are orders of magnitude faster in the good case, and should be less prone to flakes. Test: liblog-unit-tests Change-Id: Iedf473316576b8007746fe3560815bde1813787a
Loading
Please register or sign in to comment