From 23a4e8816266e2cac98d7980ca66748a55b0e09f Mon Sep 17 00:00:00 2001 From: Guang Zhu Date: Thu, 16 Apr 2009 10:16:36 -0700 Subject: [PATCH 1/3] * Update the way that run_page_cycler.py detectes instrumentation failures. * Use Debug.getMemoryInfo to collect memory information in LoadTestAutoTest. --- tests/DumpRenderTree/run_page_cycler.py | 3 +- .../dumprendertree/LoadTestsAutoTest.java | 60 ++++++++++++------- 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/tests/DumpRenderTree/run_page_cycler.py b/tests/DumpRenderTree/run_page_cycler.py index 9a099b52694b4..7f728a38245ab 100755 --- a/tests/DumpRenderTree/run_page_cycler.py +++ b/tests/DumpRenderTree/run_page_cycler.py @@ -59,7 +59,8 @@ def main(options, args): run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd_postfix (adb_output, adb_error) = subprocess.Popen(run_load_test_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() - if adb_output.find('INSTRUMENTATION_FAILED') != -1: + if adb_output.find('INSTRUMENTATION_FAILED') != -1 or \ + adb_output.find('Process crashed.') != -1: logging.error("Error happened : " + adb_output) sys.exit(1) diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java index b064dbb404290..637f1259bf2d7 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java @@ -16,14 +16,14 @@ package com.android.dumprendertree; -import android.app.Activity; import android.app.Instrumentation; -import android.app.Instrumentation.ActivityMonitor; import android.content.Intent; import android.util.Log; import android.os.Bundle; +import android.os.Debug; +import android.os.Debug.MemoryInfo; import android.test.ActivityInstrumentationTestCase2; import com.android.dumprendertree.TestShellActivity; @@ -33,6 +33,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.PrintStream; class StreamPipe extends Thread { InputStream in; @@ -92,35 +93,54 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2 Date: Thu, 16 Apr 2009 10:25:54 -0700 Subject: [PATCH 2/3] Removing unused StreamPipe class, also stripping some white spaces --- .../dumprendertree/LoadTestsAutoTest.java | 53 +++++-------------- 1 file changed, 14 insertions(+), 39 deletions(-) diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java index 637f1259bf2d7..9e1e9ed253b0d 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java @@ -29,40 +29,15 @@ import android.test.ActivityInstrumentationTestCase2; import com.android.dumprendertree.TestShellActivity; import com.android.dumprendertree.TestShellCallback; -import java.io.InputStream; -import java.io.OutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -class StreamPipe extends Thread { - InputStream in; - OutputStream out; - - StreamPipe(InputStream in, OutputStream out) { - this.in = in; - this.out = out; - } - - public void run() { - try { - byte[] buf = new byte[1024]; - int nofb = this.in.read(buf); - while (nofb != -1) { - this.out.write(buf, 0, nofb); - nofb = this.in.read(buf); - } - } catch (IOException e) { - e.printStackTrace(); - } - } -} - public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2 { private final static String LOGTAG = "LoadTest"; private final static String LOAD_TEST_RESULT = "/sdcard/load_test_result.txt"; - + public LoadTestsAutoTest() { super("com.android.dumprendertree", TestShellActivity.class); } @@ -75,7 +50,7 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2 Date: Thu, 16 Apr 2009 10:41:27 -0700 Subject: [PATCH 3/3] update onCreate method to work around InstrumentationTestRunner limitation. --- .../src/com/android/dumprendertree/LayoutTestsAutoRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java index 8f968b43972a0..ebdc9c72305c5 100755 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java @@ -51,7 +51,6 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { @Override public void onCreate(Bundle icicle) { - super.onCreate(icicle); this.mTestPath = (String) icicle.get("path"); String timeout_str = (String) icicle.get("timeout"); if (timeout_str != null) { @@ -64,6 +63,7 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { String r = (String)icicle.get("rebaseline"); this.mRebaseline = (r != null && r.toLowerCase().equals("true")); + super.onCreate(icicle); } public String mTestPath = null;