log_handler test: Ignore unknown categories

Tests run parallel in multiple threads. This makes the log_handler test
flaky because it may see log messages triggered by other threads. Make
the handler ignore all messages not in the category we care about.
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-09-04 14:02:55 +02:00 committed by Sebastian Dröge
parent 168db3b948
commit 5149dc254d

View file

@ -457,7 +457,13 @@ mod tests {
_object: Option<&glib::Object>,
message: &DebugMessage| {
let cat = DebugCategory::get("test-cat-log").unwrap();
assert_eq!(category, cat);
if category != cat {
// This test can run in parallel with other tests, including new_and_log above.
// We cannot be certain we only see our own messages.
return;
}
assert_eq!(level, DebugLevel::Info);
assert_eq!(message.get(), Some("meh"));
let _ = sender.lock().unwrap().send(());