Title: [124788] trunk/Tools
Revision
124788
Author
wangxian...@chromium.org
Date
2012-08-06 11:29:31 -0700 (Mon, 06 Aug 2012)

Log Message

[Chromium-Android] Store test executable, data and fonts in /data/local/tmp
https://bugs.webkit.org/show_bug.cgi?id=91910

/data/local/tmp is a directory with permission 0777 by default.
Place DumpRenderTree resources here so that both the native test app and
the NRWT script can access them even if adb shell isn't running as root.

Reviewed by Adam Barth.

* DumpRenderTree/chromium/TestShellAndroid.cpp:
(createFIFO): Set fifo mode to 0666 to allow unrooted adb shell to access.
* Scripts/webkitpy/layout_tests/port/chromium_android.py:
(ChromiumAndroidPort.driver_cmd_line):
(ChromiumAndroidDriver.__init__):
(ChromiumAndroidDriver._setup_test):
(ChromiumAndroidDriver._push_executable):
* Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
(ChromiumAndroidPortTest.make_port):
(ChromiumAndroidPortTest.test_expectations_files):
(ChromiumAndroidDriverTest.test_drt_cmd_line):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (124787 => 124788)


--- trunk/Tools/ChangeLog	2012-08-06 18:19:17 UTC (rev 124787)
+++ trunk/Tools/ChangeLog	2012-08-06 18:29:31 UTC (rev 124788)
@@ -1,3 +1,26 @@
+2012-08-06  Xianzhu Wang  <wangxian...@chromium.org>
+
+        [Chromium-Android] Store test executable, data and fonts in /data/local/tmp
+        https://bugs.webkit.org/show_bug.cgi?id=91910
+
+        /data/local/tmp is a directory with permission 0777 by default.
+        Place DumpRenderTree resources here so that both the native test app and
+        the NRWT script can access them even if adb shell isn't running as root.
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/TestShellAndroid.cpp:
+        (createFIFO): Set fifo mode to 0666 to allow unrooted adb shell to access.
+        * Scripts/webkitpy/layout_tests/port/chromium_android.py:
+        (ChromiumAndroidPort.driver_cmd_line):
+        (ChromiumAndroidDriver.__init__):
+        (ChromiumAndroidDriver._setup_test):
+        (ChromiumAndroidDriver._push_executable):
+        * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
+        (ChromiumAndroidPortTest.make_port):
+        (ChromiumAndroidPortTest.test_expectations_files):
+        (ChromiumAndroidDriverTest.test_drt_cmd_line):
+
 2012-08-06  Abhishek Arya  <infe...@chromium.org>
 
         [Chromium] Re-expose layoutTestController as various fuzzers depend on it

Modified: trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp (124787 => 124788)


--- trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp	2012-08-06 18:19:17 UTC (rev 124787)
+++ trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp	2012-08-06 18:29:31 UTC (rev 124788)
@@ -44,10 +44,13 @@
 
 namespace {
 
-const char fontMainConfigFile[] = "/data/drt/android_main_fonts.xml";
-const char fontFallbackConfigFile[] = "/data/drt/android_fallback_fonts.xml";
-const char fontsDir[] = "/data/drt/fonts/";
+// Must be same as DEVICE_DRT_DIR in Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py.
+#define DEVICE_DRT_DIR "/data/local/tmp/drt/"
 
+const char fontMainConfigFile[] = DEVICE_DRT_DIR "android_main_fonts.xml";
+const char fontFallbackConfigFile[] = DEVICE_DRT_DIR "android_fallback_fonts.xml";
+const char fontsDir[] = DEVICE_DRT_DIR "fonts/";
+
 const char optionInFIFO[] = "--in-fifo=";
 const char optionOutFIFO[] = "--out-fifo=";
 const char optionErrFIFO[] = "--err-fifo=";
@@ -72,7 +75,9 @@
 void createFIFO(const char* fifoPath)
 {
     unlink(fifoPath);
-    if (mkfifo(fifoPath, 0600)) {
+    // 0666 is rw-rw-rw-, to allow adb shell to read/write the fifo.
+    // Explicitly call chmod to ensure the mode is set despite umask.
+    if (mkfifo(fifoPath, 0666) || chmod(fifoPath, 0666)) {
         androidLogError("Failed to create fifo %s: %s\n", fifoPath, strerror(errno));
         exit(EXIT_FAILURE);
     }

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py (124787 => 124788)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py	2012-08-06 18:19:17 UTC (rev 124787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py	2012-08-06 18:29:31 UTC (rev 124788)
@@ -44,21 +44,20 @@
 
 # The root directory for test resources, which has the same structure as the
 # source root directory of Chromium.
-# This path is defined in base/base_paths_android.cc and
-# webkit/support/platform_support_android.cc.
+# This path is defined in Chromium's base/test/test_support_android.cc.
 DEVICE_SOURCE_ROOT_DIR = '/data/local/tmp/'
 COMMAND_LINE_FILE = DEVICE_SOURCE_ROOT_DIR + 'chrome-native-tests-command-line'
 
 # The directory to put tools and resources of DumpRenderTree.
-DEVICE_DRT_DIR = '/data/drt/'
+# If change this, must also change Tools/DumpRenderTree/chromium/TestShellAndroid.cpp
+# and Chromium's webkit/support/platform_support_android.cc.
+DEVICE_DRT_DIR = DEVICE_SOURCE_ROOT_DIR + 'drt/'
 DEVICE_FORWARDER_PATH = DEVICE_DRT_DIR + 'forwarder'
 DEVICE_DRT_STAMP_PATH = DEVICE_DRT_DIR + 'DumpRenderTree.stamp'
 
 DRT_APP_PACKAGE = 'org.chromium.native_test'
 DRT_ACTIVITY_FULL_NAME = DRT_APP_PACKAGE + '/.ChromeNativeTestActivity'
-DRT_APP_DIR = '/data/user/0/' + DRT_APP_PACKAGE + '/'
-DRT_APP_FILES_DIR = DEVICE_SOURCE_ROOT_DIR
-DRT_APP_CACHE_DIR = DRT_APP_DIR + 'cache/'
+DRT_APP_CACHE_DIR = DEVICE_DRT_DIR + 'cache/'
 
 # This only works for single core devices so far.
 # FIXME: Find a solution for multi-core devices.
@@ -241,6 +240,10 @@
         # See comments in ChromiumAndroidDriver.start().
         return ChromiumAndroidDriver(self, worker_number, pixel_tests=self.get_option('pixel_tests'), no_timeout=no_timeout)
 
+    def driver_cmd_line(self):
+        # Override to return the actual DumpRenderTree command line.
+        return self.create_driver(0)._drt_cmd_line(self.get_option('pixel_tests'), [])
+
     # Overridden private functions.
 
     def _build_path(self, *comps):
@@ -307,9 +310,9 @@
     def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
         super(ChromiumAndroidDriver, self).__init__(port, worker_number, pixel_tests, no_timeout)
         self._pixel_tests = pixel_tests
-        self._in_fifo_path = DRT_APP_FILES_DIR + 'DumpRenderTree.in'
-        self._out_fifo_path = DRT_APP_FILES_DIR + 'DumpRenderTree.out'
-        self._err_fifo_path = DRT_APP_FILES_DIR + 'DumpRenderTree.err'
+        self._in_fifo_path = DEVICE_DRT_DIR + 'DumpRenderTree.in'
+        self._out_fifo_path = DEVICE_DRT_DIR + 'DumpRenderTree.out'
+        self._err_fifo_path = DEVICE_DRT_DIR + 'DumpRenderTree.err'
         self._read_stdout_process = None
         self._read_stderr_process = None
         self._forwarder_process = None
@@ -331,9 +334,11 @@
         # Required by webkit_support::GetWebKitRootDirFilePath().
         # Other directories will be created automatically by adb push.
         self._run_adb_command(['shell', 'mkdir', '-p', DEVICE_SOURCE_ROOT_DIR + 'chrome'])
+
         # Allow the DumpRenderTree app to fully access the directory.
-        # The native code needs the permission to write temporary files here.
-        self._run_adb_command(['shell', 'chmod', '777', DEVICE_SOURCE_ROOT_DIR])
+        # The native code needs the permission to write temporary files and create pipes here.
+        self._run_adb_command(['shell', 'mkdir', '-p', DEVICE_DRT_DIR])
+        self._run_adb_command(['shell', 'chmod', '777', DEVICE_DRT_DIR])
 
         self._push_executable()
         self._push_fonts()
@@ -359,6 +364,10 @@
                 raise AssertionError('Failed to install %s onto device: %s' % (drt_host_path, install_result))
             self._push_to_device(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak')
             self._push_to_device(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources')
+            # FIXME: Temporarily push pak and resources under the original /data/drt/ directory.
+            # Remove the following two lines after landing the chromium side of change.
+            self._push_to_device(self._port._build_path('DumpRenderTree.pak'), '/data/drt/DumpRenderTree.pak')
+            self._push_to_device(self._port._build_path('DumpRenderTree_resources'), '/data/drt/DumpRenderTree_resources')
             self._push_to_device(self._port._build_path('android_main_fonts.xml'), DEVICE_DRT_DIR + 'android_main_fonts.xml')
             self._push_to_device(self._port._build_path('android_fallback_fonts.xml'), DEVICE_DRT_DIR + 'android_fallback_fonts.xml')
             # Version control of test resources is dependent on executables,

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py (124787 => 124788)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-08-06 18:19:17 UTC (rev 124787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-08-06 18:29:31 UTC (rev 124788)
@@ -112,6 +112,7 @@
     def make_port(self, **kwargs):
         port = super(ChromiumAndroidPortTest, self).make_port(**kwargs)
         self.mock_run_command = MockRunCommand()
+        self.mock_run_command.mock_one_device()
         port._executive = MockExecutive2(run_command_fn=self.mock_run_command.mock_run_command_fn)
         return port
 
@@ -128,10 +129,6 @@
         # using a custom expectations file.
         pass
 
-    def test_driver_cmd_line(self):
-        # Overriding PortTestCase.test_cmd_line(). Use ChromiumAndroidDriverTest.test_cmd_line() instead.
-        return
-
     def test_get_devices_no_device(self):
         port = self.make_port()
         self.mock_run_command.mock_no_device()
@@ -235,9 +232,9 @@
     def test_drt_cmd_line(self):
         cmd_line = self.driver._drt_cmd_line(True, ['--a'])
         self.assertTrue('--a' in cmd_line)
-        self.assertTrue('--in-fifo=' + chromium_android.DRT_APP_FILES_DIR + 'DumpRenderTree.in' in cmd_line)
-        self.assertTrue('--out-fifo=' + chromium_android.DRT_APP_FILES_DIR + 'DumpRenderTree.out' in cmd_line)
-        self.assertTrue('--err-fifo=' + chromium_android.DRT_APP_FILES_DIR + 'DumpRenderTree.err' in cmd_line)
+        self.assertTrue('--in-fifo=' + chromium_android.DEVICE_DRT_DIR + 'DumpRenderTree.in' in cmd_line)
+        self.assertTrue('--out-fifo=' + chromium_android.DEVICE_DRT_DIR + 'DumpRenderTree.out' in cmd_line)
+        self.assertTrue('--err-fifo=' + chromium_android.DEVICE_DRT_DIR + 'DumpRenderTree.err' in cmd_line)
 
     def test_read_prompt(self):
         self.driver._server_process = driver_unittest.MockServerProcess(lines=['root@android:/ # '])
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to