OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |