Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit dbc4815d authored by Tom Cherry's avatar Tom Cherry
Browse files

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
parent 6b0e789a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment