diff options
author | Steve Block <steveblock@google.com> | 2010-03-01 10:53:22 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-01 10:53:22 -0800 |
commit | 666eecc1e3f1ae168284ba407de77fb2654f8604 (patch) | |
tree | 8decef1f2e58c0d6d6f12b72c8ed12e61070d3af /tests | |
parent | 1be40985283e77d3fc5d98268f9f6453bcc7223e (diff) | |
parent | 12077e1179b4035ae2b1a44ccf9cd540e14b182e (diff) | |
download | frameworks_base-666eecc1e3f1ae168284ba407de77fb2654f8604.zip frameworks_base-666eecc1e3f1ae168284ba407de77fb2654f8604.tar.gz frameworks_base-666eecc1e3f1ae168284ba407de77fb2654f8604.tar.bz2 |
Merge "Adds to DumpRenderTree the ability to look for Android-specific results"
Diffstat (limited to 'tests')
3 files changed, 46 insertions, 14 deletions
diff --git a/tests/DumpRenderTree/assets/run_layout_tests.py b/tests/DumpRenderTree/assets/run_layout_tests.py index c3627bb..7f3ef2d 100755 --- a/tests/DumpRenderTree/assets/run_layout_tests.py +++ b/tests/DumpRenderTree/assets/run_layout_tests.py @@ -26,6 +26,7 @@ --time-out-ms (default is 8000 millis) for each test --adb-options="-e" passes option string to adb --results-directory=..., (default is ./layout-test-results) directory name under which results are stored. + --js-engine the JavaScript engine currently in use, determines which set of Android-specific expected results we should use, should be 'jsc' or 'v8' """ import logging @@ -186,6 +187,16 @@ def main(options, args): run_layout_test_cmd_postfix = " -e path \"" + path + "\" -e timeout " + timeout_ms if options.rebaseline: run_layout_test_cmd_postfix += " -e rebaseline true" + + # If the JS engine is not specified on the command line, try reading the + # JS_ENGINE environment variable, which is used by the build system in + # external/webkit/Android.mk. + js_engine = options.js_engine + if not js_engine: + js_engine = os.environ['JS_ENGINE'] + if js_engine: + run_layout_test_cmd_postfix += " -e jsengine " + js_engine + run_layout_test_cmd_postfix += " -w com.android.dumprendertree/.LayoutTestsAutoRunner" # Call LayoutTestsAutoTest::startLayoutTests. @@ -297,6 +308,9 @@ if '__main__' == __name__: default=None, dest="ref_directory", help="directory where reference results are stored.") + option_parser.add_option("", "--js-engine", + default=None, + help="The JavaScript engine currently in use, which determines which set of Android-specific expected results we should use. Should be 'jsc' or 'v8'."); 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 539d551..e058f32 100755 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java @@ -79,14 +79,17 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { mSaveImagePath = (String) icicle.get("saveimage"); + mJsEngine = (String) icicle.get("jsengine"); + super.onCreate(icicle); } - public String mTestPath = null; - public String mSaveImagePath = null; - public int mTimeoutInMillis = 0; - public int mDelay = 0; - public boolean mRebaseline = false; - public boolean mLogtime = false; - public boolean mGetDrawTime = false; + public String mTestPath; + public String mSaveImagePath; + public int mTimeoutInMillis; + public int mDelay; + public boolean mRebaseline; + public boolean mLogtime; + public boolean mGetDrawTime; + public String mJsEngine; } diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java index 634d683..d9ec3fa 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java @@ -147,6 +147,9 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh private MyTestRecorder mResultRecorder; private Vector<String> mTestList; private boolean mRebaselineResults; + // The JavaScript engine currently in use. This determines which set of Android-specific + // expected test results we use. + private String mJsEngine; private String mTestPathPrefix; private boolean mFinished; @@ -214,14 +217,24 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh return shortName.replaceFirst(LAYOUT_TESTS_ROOT, LAYOUT_TESTS_RESULT_DIR) + "-result.txt"; } + // Gets the file which contains WebKit's expected results for this test. private String getExpectedResultFile(String test) { + // The generic result is at <path>/<name>-expected.txt + // First try the Android-specific result at + // platform/android-<js-engine>/<path>/<name>-expected.txt int pos = test.lastIndexOf('.'); - if(pos == -1) + if (pos == -1) return null; - String shortName = test.substring(0, pos); - return shortName + "-expected.txt"; + String genericExpectedResult = test.substring(0, pos) + "-expected.txt"; + String androidExpectedResultsDir = "platform/android-" + mJsEngine + "/"; + String androidExpectedResult = + genericExpectedResult.replaceFirst(LAYOUT_TESTS_ROOT, LAYOUT_TESTS_ROOT + androidExpectedResultsDir); + File f = new File(androidExpectedResult); + return f.exists() ? androidExpectedResult : genericExpectedResult; } + // Gets the file which contains the actual results of running the test on + // Android, generated by a previous run which set a new baseline. private String getAndroidExpectedResultFile(String expectedResultFile) { return expectedResultFile.replaceFirst(LAYOUT_TESTS_ROOT, ANDROID_EXPECTED_RESULT_DIR); } @@ -282,8 +295,8 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh }); String resultFile = getResultFile(test); - if(resultFile == null) { - //simply ignore this test + if (resultFile == null) { + // Simply ignore this test. return; } if (mRebaselineResults) { @@ -339,8 +352,10 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh this.mTestList = new Vector<String>(); // Read settings - this.mTestPathPrefix = (new File(LAYOUT_TESTS_ROOT + runner.mTestPath)).getAbsolutePath(); - this.mRebaselineResults = runner.mRebaseline; + mTestPathPrefix = (new File(LAYOUT_TESTS_ROOT + runner.mTestPath)).getAbsolutePath(); + mRebaselineResults = runner.mRebaseline; + // JSC is the default JavaScript engine. + mJsEngine = runner.mJsEngine == null ? "jsc" : runner.mJsEngine; int timeout = runner.mTimeoutInMillis; if (timeout <= 0) { |