Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: testing/iossim/iossim.mm

Issue 11699005: In iossim, ignore harmless messages from launchd. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed review comment Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/iossim/iossim.mm
diff --git a/testing/iossim/iossim.mm b/testing/iossim/iossim.mm
index 47778ca6c8a883bf75a455bdbd5bcb896a4e9efb..7d5dbf872e93cbc9c7e1155fefdbef3cd9caef07 100644
--- a/testing/iossim/iossim.mm
+++ b/testing/iossim/iossim.mm
@@ -291,19 +291,23 @@ void LogWarning(NSString* format, ...) {
ASL_QUERY_OP_EQUAL);
asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL);
- // Log any messages found.
+ // Log any messages found, and take note of any messages that may indicate the
+ // app crashed or did not exit cleanly.
aslresponse response = asl_search(NULL, query);
- BOOL entryFound = NO;
+ BOOL badEntryFound = NO;
aslmsg entry;
while ((entry = aslresponse_next(response)) != NULL) {
- entryFound = YES;
- LogWarning(@"Console message: %s", asl_get(entry, ASL_KEY_MSG));
+ const char* message = asl_get(entry, ASL_KEY_MSG);
+ LogWarning(@"Console message: %s", message);
+ // Some messages are harmless, so don't trigger a failure for them.
+ if (strstr(message, "The following job tried to hijack the service"))
+ continue;
+ badEntryFound = YES;
}
- // launchd only sends messages if the process crashed or exits with a
- // non-zero status, so if the query returned any results iossim should exit
- // with non-zero status.
- if (entryFound) {
+ // If the query returned any nasty-looking results, iossim should exit with
+ // non-zero status.
+ if (badEntryFound) {
LogError(@"Simulated app crashed or exited with non-zero status");
exit(kExitAppCrashed);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698