Reviewers: ulan,

Message:
PTAL

Description:
Make JSTests ready for Android measurements.

This adds a common perf configuration for JSTests including
Classes, Collections, Iterators and Strings. This allows
the android test runner to handle subdirectories correctly
and to share the base.js resource in the parent directory.

The new json config has added resources configs for the
Android runner.

The perf runner's relative paths on the device are fixed as
well. Resources are only pushed on the configuration node
where they are specified. They are pushed to a dir on the
device that follows the same directory structure as on the
host. The binary is executed in the benchmark folder on the
device like on the host to allow relative path file
loading.

BUG=chromium:374740
LOG=n
TEST=python -m unittest run_perf_test
[email protected]
NOTRY=true

Please review this at https://codereview.chromium.org/779923002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+89, -9 lines):
  A test/js-perf-test/JSTests.json
  M tools/run_perf.py


Index: test/js-perf-test/JSTests.json
diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb3cc9ba0a488623e64e601b3a6732d70e0ec603
--- /dev/null
+++ b/test/js-perf-test/JSTests.json
@@ -0,0 +1,69 @@
+{
+  "name": "JSTests",
+  "run_count": 5,
+  "run_count_android_arm": 3,
+  "run_count_android_arm64": 3,
+  "units": "score",
+  "total": true,
+  "resources": ["base.js"],
+  "tests": [
+    {
+      "name": "Classes",
+      "path": ["Classes"],
+      "main": "run.js",
+      "resources": ["super.js"],
+      "flags": ["--harmony-classes"],
+      "results_regexp": "^%s\\-Classes\\(Score\\): (.+)$",
+      "tests": [
+        {"name": "Super"}
+      ]
+    },
+    {
+      "name": "Collections",
+      "path": ["Collections"],
+      "main": "run.js",
+      "resources": [
+        "common.js",
+        "map.js",
+        "run.js",
+        "set.js",
+        "weakmap.js",
+        "weakset.js"
+      ],
+      "results_regexp": "^%s\\-Collections\\(Score\\): (.+)$",
+      "tests": [
+        {"name": "Map-Smi"},
+        {"name": "Map-String"},
+        {"name": "Map-Object"},
+        {"name": "Map-Iteration"},
+        {"name": "Set-Smi"},
+        {"name": "Set-String"},
+        {"name": "Set-Object"},
+        {"name": "Set-Iteration"},
+        {"name": "WeakMap"},
+        {"name": "WeakSet"}
+      ]
+    },
+    {
+      "name": "Iterators",
+      "path": ["Iterators"],
+      "main": "run.js",
+      "resources": ["forof.js"],
+      "results_regexp": "^%s\\-Iterators\\(Score\\): (.+)$",
+      "tests": [
+        {"name": "ForOf"}
+      ]
+    },
+    {
+      "name": "Strings",
+      "path": ["Strings"],
+      "main": "run.js",
+      "resources": ["harmony-string.js"],
+      "flags": ["--harmony-strings"],
+      "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+      "tests": [
+        {"name": "StringFunctions"}
+      ]
+    }
+  ]
+}
Index: tools/run_perf.py
diff --git a/tools/run_perf.py b/tools/run_perf.py
index 0a24c08e0775ad75057e3bfc9049c9ad97d7cd16..b8b49aa724e262225b9e28f431cd1978d77378a0 100755
--- a/tools/run_perf.py
+++ b/tools/run_perf.py
@@ -219,7 +219,9 @@ class Graph(Node):
     self.graphs = parent.graphs[:] + [suite["name"]]
     self.flags = parent.flags[:] + suite.get("flags", [])
     self.test_flags = parent.test_flags[:] + suite.get("test_flags", [])
-    self.resources = parent.resources[:] + suite.get("resources", [])
+
+    # Values independent of parent node.
+    self.resources = suite.get("resources", [])

     # Descrete values (with parent defaults).
     self.binary = suite.get("binary", parent.binary)
@@ -519,9 +521,10 @@ class AndroidPlatform(Platform):  # pragma: no cover
         cwd=AndroidPlatform.DEVICE_DIR,
     )

-  def _PushFile(self, host_dir, file_name):
+  def _PushFile(self, host_dir, file_name, target_rel="."):
     file_on_host = os.path.join(host_dir, file_name)
-    file_on_device = AndroidPlatform.DEVICE_DIR + file_name
+    file_on_device = os.path.join(
+        AndroidPlatform.DEVICE_DIR, target_rel, file_name)

     # Only push files not yet pushed in one execution.
     if file_on_host in self.pushed:
@@ -535,26 +538,34 @@ class AndroidPlatform(Platform):  # pragma: no cover
   def PreTests(self, node, path):
     suite_dir = os.path.abspath(os.path.dirname(path))
     if node.path:
-      bench_dir = os.path.join(suite_dir,
-                               os.path.normpath(os.path.join(*node.path)))
+      bench_rel = os.path.normpath(os.path.join(*node.path))
+      bench_abs = os.path.join(suite_dir, bench_rel)
     else:
-      bench_dir = suite_dir
+      bench_rel = "."
+      bench_abs = suite_dir

     self._PushFile(self.shell_dir, node.binary)
     if isinstance(node, Runnable):
-      self._PushFile(bench_dir, node.main)
+      self._PushFile(bench_abs, node.main, bench_rel)
     for resource in node.resources:
-      self._PushFile(bench_dir, resource)
+      self._PushFile(bench_abs, resource, bench_rel)

   def Run(self, runnable, count):
     cache = cache_control.CacheControl(self.device)
     cache.DropRamCaches()
     binary_on_device = AndroidPlatform.DEVICE_DIR + runnable.binary
     cmd = [binary_on_device] + runnable.GetCommandFlags()
+
+    # Relative path to benchmark directory.
+    if runnable.path:
+      bench_rel = os.path.normpath(os.path.join(*runnable.path))
+    else:
+      bench_rel = "."
+
     try:
       output = self.device.RunShellCommand(
           cmd,
-          cwd=AndroidPlatform.DEVICE_DIR,
+          cwd=os.path.join(AndroidPlatform.DEVICE_DIR, bench_rel),
           timeout=runnable.timeout,
           retries=0,
       )


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to