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

Side by Side 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: Created 7 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 #include <asl.h> 6 #include <asl.h>
7 #include <libgen.h> 7 #include <libgen.h>
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 aslmsg query = asl_new(ASL_TYPE_QUERY); 278 aslmsg query = asl_new(ASL_TYPE_QUERY);
279 asl_set_query(query, ASL_KEY_SENDER, "launchd", 279 asl_set_query(query, ASL_KEY_SENDER, "launchd",
280 ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING); 280 ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING);
281 asl_set_query(query, ASL_KEY_REF_PID, 281 asl_set_query(query, ASL_KEY_REF_PID,
282 [[[session simulatedApplicationPID] stringValue] UTF8String], 282 [[[session simulatedApplicationPID] stringValue] UTF8String],
283 ASL_QUERY_OP_EQUAL); 283 ASL_QUERY_OP_EQUAL);
284 asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL); 284 asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL);
285 285
286 // Log any messages found. 286 // Log any messages found.
287 aslresponse response = asl_search(NULL, query); 287 aslresponse response = asl_search(NULL, query);
288 BOOL entryFound = NO; 288 BOOL entryFound = NO;
TVL 2012/12/28 23:47:53 maybe change this to be something like "badEntryFo
lliabraa 2013/01/02 11:48:34 Done.
289 aslmsg entry; 289 aslmsg entry;
290 while ((entry = aslresponse_next(response)) != NULL) { 290 while ((entry = aslresponse_next(response)) != NULL) {
291 const char* message = asl_get(entry, ASL_KEY_MSG);
292 LogWarning(@"Console message: %s", message);
293 // Some messages are harmless, so don't trigger a failure for them.
294 if (strstr(message, "The following job tried to hijack the service"))
295 continue;
291 entryFound = YES; 296 entryFound = YES;
292 LogWarning(@"Console message: %s", asl_get(entry, ASL_KEY_MSG));
293 } 297 }
294 298
295 // launchd only sends messages if the process crashed or exits with a 299 // launchd only sends messages if the process crashed or exits with a
296 // non-zero status, so if the query returned any results iossim should exit 300 // non-zero status, so if the query returned any results iossim should exit
297 // with non-zero status. 301 // with non-zero status.
298 if (entryFound) { 302 if (entryFound) {
299 LogError(@"Simulated app crashed or exited with non-zero status"); 303 LogError(@"Simulated app crashed or exited with non-zero status");
300 exit(EXIT_FAILURE); 304 exit(EXIT_FAILURE);
301 } 305 }
302 exit(EXIT_SUCCESS); 306 exit(EXIT_SUCCESS);
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 [error localizedDescription], 711 [error localizedDescription],
708 [error domain], static_cast<long int>([error code])); 712 [error domain], static_cast<long int>([error code]));
709 } 713 }
710 714
711 // Note that this code is only executed if the simulator fails to start 715 // Note that this code is only executed if the simulator fails to start
712 // because once the main run loop is started, only the delegate calling 716 // because once the main run loop is started, only the delegate calling
713 // exit() will end the program. 717 // exit() will end the program.
714 [pool drain]; 718 [pool drain];
715 return EXIT_FAILURE; 719 return EXIT_FAILURE;
716 } 720 }
OLDNEW
« 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