summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-09-19 22:36:51 +0100
committerTorne (Richard Coles) <torne@google.com>2013-09-19 22:36:51 +0100
commitd0247b1b59f9c528cb6df88b4f2b9afaf80d181e (patch)
tree5c397fadc190cc71bffe2ffad1efc27a5b95309d /testing
parentf7571f5f07547e2f3e0addf48d1f2a7ec3632957 (diff)
downloadchromium_org-d0247b1b59f9c528cb6df88b4f2b9afaf80d181e.tar.gz
Merge from Chromium at DEPS revision 224184
This commit was generated by merge_to_master.py. Change-Id: Ia3424df5abed9bea642c522b9e2358dceabd8423
Diffstat (limited to 'testing')
-rw-r--r--testing/android/AndroidManifest.xml3
-rw-r--r--testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java7
-rw-r--r--testing/gtest_prod.target.darwin-arm.mk4
-rw-r--r--testing/gtest_prod.target.darwin-mips.mk4
-rw-r--r--testing/gtest_prod.target.darwin-x86.mk4
-rw-r--r--testing/gtest_prod.target.linux-arm.mk4
-rw-r--r--testing/gtest_prod.target.linux-mips.mk4
-rw-r--r--testing/gtest_prod.target.linux-x86.mk4
-rw-r--r--testing/iossim/iossim.mm93
9 files changed, 84 insertions, 43 deletions
diff --git a/testing/android/AndroidManifest.xml b/testing/android/AndroidManifest.xml
index 73a0c14881..a1afb569d4 100644
--- a/testing/android/AndroidManifest.xml
+++ b/testing/android/AndroidManifest.xml
@@ -12,7 +12,8 @@ found in the LICENSE file.
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
- <application android:label="ChromeNativeTests">
+ <application android:label="ChromeNativeTests"
+ android:name="org.chromium.base.ChromiumApplication">
<activity android:name=".ChromeNativeTestActivity"
android:label="ChromeNativeTest"
android:configChanges="orientation|keyboardHidden">
diff --git a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
index 6486a14f3c..b8e41c830d 100644
--- a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
+++ b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestActivity.java
@@ -7,23 +7,18 @@ package org.chromium.native_test;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.os.Environment;
import android.os.Handler;
import android.util.Log;
-import org.chromium.base.ChromiumActivity;
import org.chromium.base.PathUtils;
import org.chromium.base.PowerMonitor;
-
// TODO(cjhopman): This should not refer to content. NativeLibraries should be moved to base.
import org.chromium.content.app.NativeLibraries;
-import java.io.File;
-
// Android's NativeActivity is mostly useful for pure-native code.
// Our tests need to go up to our own java classes, which is not possible using
// the native activity class loader.
-public class ChromeNativeTestActivity extends ChromiumActivity {
+public class ChromeNativeTestActivity extends Activity {
private static final String TAG = "ChromeNativeTestActivity";
private static final String EXTRA_RUN_IN_SUB_THREAD = "RunInSubThread";
// We post a delayed task to run tests so that we do not block onCreate().
diff --git a/testing/gtest_prod.target.darwin-arm.mk b/testing/gtest_prod.target.darwin-arm.mk
index 03a41f4977..a872cba2a4 100644
--- a/testing/gtest_prod.target.darwin-arm.mk
+++ b/testing/gtest_prod.target.darwin-arm.mk
@@ -63,7 +63,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -145,7 +145,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/gtest_prod.target.darwin-mips.mk b/testing/gtest_prod.target.darwin-mips.mk
index 75da259e50..9f36d7c4d1 100644
--- a/testing/gtest_prod.target.darwin-mips.mk
+++ b/testing/gtest_prod.target.darwin-mips.mk
@@ -63,7 +63,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -145,7 +145,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/gtest_prod.target.darwin-x86.mk b/testing/gtest_prod.target.darwin-x86.mk
index 7a5179ee15..360be8f8f0 100644
--- a/testing/gtest_prod.target.darwin-x86.mk
+++ b/testing/gtest_prod.target.darwin-x86.mk
@@ -65,7 +65,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -150,7 +150,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/gtest_prod.target.linux-arm.mk b/testing/gtest_prod.target.linux-arm.mk
index 03a41f4977..a872cba2a4 100644
--- a/testing/gtest_prod.target.linux-arm.mk
+++ b/testing/gtest_prod.target.linux-arm.mk
@@ -63,7 +63,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -145,7 +145,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/gtest_prod.target.linux-mips.mk b/testing/gtest_prod.target.linux-mips.mk
index 75da259e50..9f36d7c4d1 100644
--- a/testing/gtest_prod.target.linux-mips.mk
+++ b/testing/gtest_prod.target.linux-mips.mk
@@ -63,7 +63,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -145,7 +145,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/gtest_prod.target.linux-x86.mk b/testing/gtest_prod.target.linux-x86.mk
index 7a5179ee15..360be8f8f0 100644
--- a/testing/gtest_prod.target.linux-x86.mk
+++ b/testing/gtest_prod.target.linux-x86.mk
@@ -65,7 +65,7 @@ MY_CFLAGS_Debug := \
MY_DEFS_Debug := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
@@ -150,7 +150,7 @@ MY_CFLAGS_Release := \
MY_DEFS_Release := \
'-DANGLE_DX11' \
- '-DWTF_VECTOR_INITIAL_SIZE=16' \
+ '-DWTF_VECTOR_INITIAL_SIZE=4' \
'-D_FILE_OFFSET_BITS=64' \
'-DNO_TCMALLOC' \
'-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \
diff --git a/testing/iossim/iossim.mm b/testing/iossim/iossim.mm
index ac03dcd1b1..152f2bea4c 100644
--- a/testing/iossim/iossim.mm
+++ b/testing/iossim/iossim.mm
@@ -128,6 +128,7 @@ void LogWarning(NSString* format, ...) {
@private
NSString* stdioPath_;
NSString* developerDir_;
+ NSString* simulatorHome_;
NSThread* outputThread_;
NSBundle* simulatorBundle_;
BOOL appRunning_;
@@ -147,11 +148,13 @@ void LogWarning(NSString* format, ...) {
// Specifies the file locations of the simulated app's stdout and stderr.
- (SimulatorDelegate*)initWithStdioPath:(NSString*)stdioPath
- developerDir:(NSString*)developerDir {
+ developerDir:(NSString*)developerDir
+ simulatorHome:(NSString*)simulatorHome {
self = [super init];
if (self) {
stdioPath_ = [stdioPath copy];
developerDir_ = [developerDir copy];
+ simulatorHome_ = [simulatorHome copy];
}
return self;
@@ -280,29 +283,70 @@ void LogWarning(NSString* format, ...) {
}
}
- // Check if the simulated app exited abnormally by looking for system log
- // messages from launchd that refer to the simulated app's PID. Limit query
- // to messages in the last minute since PIDs are cyclical.
- aslmsg query = asl_new(ASL_TYPE_QUERY);
- asl_set_query(query, ASL_KEY_SENDER, "launchd",
- ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING);
- asl_set_query(query, ASL_KEY_REF_PID,
- [[[session simulatedApplicationPID] stringValue] UTF8String],
- ASL_QUERY_OP_EQUAL);
- asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL);
-
- // 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);
+ // Try to determine if the simulated app crashed or quit with a non-zero
+ // status code. iOS Simluator handles things a bit differently depending on
+ // the version, so first determine the iOS version being used.
BOOL badEntryFound = NO;
- aslmsg entry;
- while ((entry = aslresponse_next(response)) != NULL) {
- 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;
+ NSString* versionString =
+ [[[session sessionConfig] simulatedSystemRoot] sdkVersion];
+ NSInteger majorVersion = [[[versionString componentsSeparatedByString:@"."]
+ objectAtIndex:0] intValue];
+ if (majorVersion <= 6) {
+ // In iOS 6 and before, logging from the simulated apps went to the main
+ // system logs, so use ASL to check if the simulated app exited abnormally
+ // by looking for system log messages from launchd that refer to the
+ // simulated app's PID. Limit query to messages in the last minute since
+ // PIDs are cyclical.
+ aslmsg query = asl_new(ASL_TYPE_QUERY);
+ asl_set_query(query, ASL_KEY_SENDER, "launchd",
+ ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_SUBSTRING);
+ asl_set_query(query, ASL_KEY_REF_PID,
+ [[[session simulatedApplicationPID] stringValue] UTF8String],
+ ASL_QUERY_OP_EQUAL);
+ asl_set_query(query, ASL_KEY_TIME, "-1m", ASL_QUERY_OP_GREATER_EQUAL);
+
+ // 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);
+ aslmsg entry;
+ while ((entry = aslresponse_next(response)) != NULL) {
+ 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;
+ }
+ } else {
+ // Otherwise, the iOS Simulator's system logging is sandboxed, so parse the
+ // sandboxed system.log file for known errors.
+ NSString* relativePathToSystemLog =
+ [NSString stringWithFormat:
+ @"Library/Logs/iOS Simulator/%@/system.log", versionString];
+ NSString* path =
+ [simulatorHome_ stringByAppendingPathComponent:relativePathToSystemLog];
+ NSFileManager* fileManager = [NSFileManager defaultManager];
+ if ([fileManager fileExistsAtPath:path]) {
+ NSString* content =
+ [NSString stringWithContentsOfFile:path
+ encoding:NSUTF8StringEncoding
+ error:NULL];
+ NSArray* lines = [content componentsSeparatedByCharactersInSet:
+ [NSCharacterSet newlineCharacterSet]];
+ for (NSString* line in lines) {
+ NSString* const kErrorString = @"Service exited with abnormal code:";
+ if ([line rangeOfString:kErrorString].location != NSNotFound) {
+ LogWarning(@"Console message: %@", line);
+ badEntryFound = YES;
+ break;
+ }
+ }
+ // Remove the log file so subsequent invocations of iossim won't be
+ // looking at stale logs.
+ remove([path fileSystemRepresentation]);
+ } else {
+ LogWarning(@"Unable to find sandboxed system log.");
+ }
}
// If the query returned any nasty-looking results, iossim should exit with
@@ -700,7 +744,8 @@ int main(int argc, char* const argv[]) {
deviceFamily);
SimulatorDelegate* delegate =
[[[SimulatorDelegate alloc] initWithStdioPath:stdioPath
- developerDir:developerDir] autorelease];
+ developerDir:developerDir
+ simulatorHome:simHomePath] autorelease];
DTiPhoneSimulatorSession* session = BuildSession(delegate);
// Start the simulator session.