From f6d1b3f125b06fcc4847be3cfb35e8ce21905676 Mon Sep 17 00:00:00 2001 From: Guang Zhu Date: Tue, 26 Apr 2011 16:41:13 -0700 Subject: Make DRT pull data over network command format: adb shell am instrument -w -e class \ com.android.dumprendertree.LoadTestsAutoTest#runPageCyclerTest \ -e suite moz \ -e iteration 1 \ -e forward android-browser-test:80/page_cycler/ \ com.android.dumprendertree/.LayoutTestsAutoRunner Change-Id: Ib4e9db28953f6be155517bb4b139e4477305c2c2 --- tests/DumpRenderTree/assets/run_page_cycler.py | 31 ++++++++++++++- .../dumprendertree/LayoutTestsAutoRunner.java | 39 +++++++++++-------- .../dumprendertree/LayoutTestsAutoTest.java | 9 ----- .../android/dumprendertree/LoadTestsAutoTest.java | 45 ++++++++++++++++++++-- .../dumprendertree/forwarder/Forwarder.java | 3 +- 5 files changed, 96 insertions(+), 31 deletions(-) diff --git a/tests/DumpRenderTree/assets/run_page_cycler.py b/tests/DumpRenderTree/assets/run_page_cycler.py index 692f32e479ea..f995086095e3 100755 --- a/tests/DumpRenderTree/assets/run_page_cycler.py +++ b/tests/DumpRenderTree/assets/run_page_cycler.py @@ -33,10 +33,16 @@ def main(options, args): # Include all tests if none are specified. if not args: print "need a URL, e.g. file:///sdcard/webkit/page_cycler/moz/start.html\?auto=1\&iterations=10" + print " or remote:android-browser-test:80/page_cycler/" sys.exit(1) else: path = ' '.join(args); + if path[:7] == "remote:": + remote_path = path[7:] + else: + remote_path = None + adb_cmd = "adb "; if options.adb_options: adb_cmd += options.adb_options @@ -56,7 +62,20 @@ def main(options, args): run_load_test_cmd_postfix = " -w com.android.dumprendertree/.LayoutTestsAutoRunner" # Call LoadTestsAutoTest::runTest. - run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runPageCyclerTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runPageCyclerTest -e timeout " + timeout_ms + + if remote_path: + if options.suite: + run_load_test_cmd += " -e suite %s -e forward %s " % (options.suite, + remote_path) + else: + print "for network mode, need to specify --suite as well." + sys.exit(1) + if options.iteration: + run_load_test_cmd += " -e iteration %s" % options.iteration + else: + run_load_test_cmd += " -e path \"%s\" " % path + if options.drawtime: run_load_test_cmd += " -e drawtime true " @@ -130,5 +149,15 @@ if '__main__' == __name__: default=None, help="stores rendered page to a location on device.") + option_parser.add_option("-u", "--suite", + default=None, + help="(for network mode) specify the suite to" + " run by name") + + option_parser.add_option("-i", "--iteration", + default="5", + help="(for network mode) specify how many iterations" + " to run") + options, args = option_parser.parse_args(); main(options, args) diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java index e058f3221080..3ba3488be920 100755 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java @@ -25,7 +25,7 @@ import junit.framework.TestSuite; /** * Instrumentation Test Runner for all DumpRenderTree tests. - * + * * Running all tests: * * adb shell am instrument \ @@ -57,7 +57,7 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { e.printStackTrace(); } } - + String delay_str = (String) icicle.get("delay"); if(delay_str != null) { try { @@ -66,30 +66,37 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { } } - String r = (String)icicle.get("rebaseline"); + String r = icicle.getString("rebaseline"); this.mRebaseline = (r != null && r.toLowerCase().equals("true")); - String logtime = (String) icicle.get("logtime"); + String logtime = icicle.getString("logtime"); this.mLogtime = (logtime != null && logtime.toLowerCase().equals("true")); - String drawTime = (String) icicle.get("drawtime"); + String drawTime = icicle.getString("drawtime"); this.mGetDrawTime = (drawTime != null && drawTime.toLowerCase().equals("true")); - mSaveImagePath = (String) icicle.get("saveimage"); + mSaveImagePath = icicle.getString("saveimage"); - mJsEngine = (String) icicle.get("jsengine"); + mJsEngine = icicle.getString("jsengine"); + + mPageCyclerSuite = icicle.getString("suite"); + mPageCyclerForwardHost = icicle.getString("forward"); + mPageCyclerIteration = icicle.getString("iteration", "5"); super.onCreate(icicle); } - - public String mTestPath; - public String mSaveImagePath; - public int mTimeoutInMillis; - public int mDelay; - public boolean mRebaseline; - public boolean mLogtime; - public boolean mGetDrawTime; - public String mJsEngine; + + String mPageCyclerSuite; + String mPageCyclerForwardHost; + String mPageCyclerIteration; + String mTestPath; + String mSaveImagePath; + int mTimeoutInMillis; + int mDelay; + boolean mRebaseline; + boolean mLogtime; + boolean mGetDrawTime; + String mJsEngine; } diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java index 050b77953e11..7ac0665c07b0 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java @@ -401,15 +401,6 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2 { @@ -41,13 +46,15 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2 0) { os.write(buffer, 0, length); } -- cgit v1.2.3-59-g8ed1b