Bug 1161410 - Part 1: Update --jitflags option in jstests.py and jit_test.py as a replacement for --tbpl and --tbpl-debug. r=sfink
authorTooru Fujisawa <arai_a@mac.com>
Fri, 08 May 2015 00:28:52 +0900
changeset 274186 587ad4afaeb9cf29287707ef5a0fe5ae45d07d4b
parent 274185 2a68efa2d877244e2b5ac5ffe926e355bafec162
child 274187 f075bcb8c60b40cf12be0b83ad3178313d00b1ec
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1161410
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1161410 - Part 1: Update --jitflags option in jstests.py and jit_test.py as a replacement for --tbpl and --tbpl-debug. r=sfink
js/src/jit-test/jit_test.py
js/src/tests/jstests.py
js/src/tests/lib/jittests.py
js/src/tests/lib/tests.py
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -12,17 +12,17 @@ def add_libdir_to_path():
     js_src_dir = dirname(dirname(realpath(sys.argv[0])))
     assert exists(join(js_src_dir, 'jsapi.h'))
     sys.path.insert(0, join(js_src_dir, 'lib'))
     sys.path.insert(0, join(js_src_dir, 'tests', 'lib'))
 
 add_libdir_to_path()
 
 import jittests
-from tests import TBPL_FLAGS
+from tests import get_jitflags
 
 # Python 3.3 added shutil.which, but we can't use that yet.
 def which(name):
     if name.find(os.path.sep) != -1:
         return os.path.abspath(name)
 
     for path in os.environ["PATH"].split(os.pathsep):
         full = os.path.join(path, name)
@@ -84,20 +84,19 @@ def main(argv):
     op.add_option('-R', '--retest', dest='retest', metavar='FILE',
                   help='Retest using test list file [FILE]')
     op.add_option('-g', '--debug', dest='debug', action='store_true',
                   help='Run test in gdb')
     op.add_option('--valgrind', dest='valgrind', action='store_true',
                   help='Enable the |valgrind| flag, if valgrind is in $PATH.')
     op.add_option('--valgrind-all', dest='valgrind_all', action='store_true',
                   help='Run all tests with valgrind, if valgrind is in $PATH.')
-    op.add_option('--jitflags', dest='jitflags', default='',
-                  help='Example: --jitflags=m,mn to run each test with "-m"'
-                  ' and "-m -n" [default="%default"]. Long flags, such as'
-                  ' "--ion-eager", should be set using --args.')
+    op.add_option('--jitflags', dest='jitflags', default='none', type='string',
+                  help='IonMonkey option combinations. One of all, debug,'
+                  ' ion, and none (default %default).')
     op.add_option('--avoid-stdio', dest='avoid_stdio', action='store_true',
                   help='Use js-shell file indirection instead of piping stdio.')
     op.add_option('--write-failure-output', dest='write_failure_output',
                   action='store_true',
                   help='With --write-failures=FILE, additionally write the'
                   ' output of failed tests to [FILE]')
     op.add_option('--ion', dest='ion', action='store_true',
                   help='Run tests once with --ion-eager and once with'
@@ -218,22 +217,21 @@ def main(argv):
         test_list = test_list[start:end]
 
     # The full test list is ready. Now create copies for each JIT configuration.
     job_list = []
     test_flags = []
     if options.tbpl:
         # Running all bits would take forever. Instead, we test a few
         # interesting combinations.
-        test_flags = TBPL_FLAGS
+        test_flags = get_jitflags('all')
     elif options.ion:
-        test_flags = [['--baseline-eager'],
-                      ['--ion-eager', '--ion-offthread-compile=off']]
+        test_flags = get_jitflags('ion')
     else:
-        test_flags = jittests.parse_jitflags(options)
+        test_flags = get_jitflags(options.jitflags)
 
     job_list = [_ for test in test_list
                 for _ in test.copy_variants(test_flags)]
 
     if options.ignore_timeouts:
         read_all = False
         try:
             with open(options.ignore_timeouts) as f:
--- a/js/src/tests/jstests.py
+++ b/js/src/tests/jstests.py
@@ -8,17 +8,17 @@ See the adjacent README.txt for more det
 from __future__ import print_function
 
 import os, sys, textwrap
 from os.path import abspath, dirname, isfile, realpath
 from copy import copy
 from subprocess import list2cmdline, call
 
 from lib.results import NullTestOutput
-from lib.tests import TestCase, TBPL_FLAGS, TBPL_DEBUG_FLAGS
+from lib.tests import TestCase, get_jitflags
 from lib.results import ResultsSink
 from lib.progressbar import ProgressBar
 
 if sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
     from lib.tasks_unix import run_all_tests
 else:
     from lib.tasks_win import run_all_tests
 
@@ -87,18 +87,20 @@ def parse_args():
                           default=max(1, get_cpu_count()),
                           help='Number of tests to run in parallel'
                           ' (default %default)')
     harness_og.add_option('-t', '--timeout', type=float, default=150.0,
                           help='Set maximum time a test is allows to run'
                           ' (in seconds).')
     harness_og.add_option('-a', '--args', dest='shell_args', default='',
                           help='Extra args to pass to the JS shell.')
-    harness_og.add_option('--jitflags', default='',
-                          help="Obsolete. Does nothing.")
+    harness_og.add_option('--jitflags', dest='jitflags', default='none',
+                          type='string',
+                          help='IonMonkey option combinations. One of all,'
+                          ' debug, ion, and none (default %default).')
     harness_og.add_option('--tbpl', action='store_true',
                           help='Runs each test in all configurations tbpl'
                           ' tests.')
     harness_og.add_option('--tbpl-debug', action='store_true',
                           help='Runs each test in some faster configurations'
                           ' tbpl tests.')
     harness_og.add_option('-g', '--debug', action='store_true',
                           help='Run a test in debugger.')
@@ -267,31 +269,34 @@ def load_tests(options, requested_paths,
                               xul_tester)
     skip_list = []
 
     if options.make_manifests:
         manifest.make_manifests(options.make_manifests, test_list)
         sys.exit()
 
     # Create a new test list. Apply each TBPL configuration to every test.
-    if options.tbpl or options.tbpl_debug:
+    flags_list = None
+    if options.tbpl:
+        flags_list = get_jitflags('all')
+    elif options.tbpl_debug:
+        flags_list = get_jitflags('debug')
+    else:
+        flags_list = get_jitflags(options.jitflags)
+
+    if flags_list:
         new_test_list = []
-        flags_list = TBPL_FLAGS if options.tbpl else TBPL_DEBUG_FLAGS
         for test in test_list:
             for jitflags in flags_list:
                 tmp_test = copy(test)
                 tmp_test.jitflags = copy(test.jitflags)
                 tmp_test.jitflags.extend(jitflags)
                 new_test_list.append(tmp_test)
         test_list = new_test_list
 
-    if options.jitflags:
-        print("Warning: the --jitflags option is obsolete and does nothing"
-              " now.")
-
     if options.test_file:
         paths = set()
         for test_file in options.test_file:
             paths |= set(
                 [line.strip() for line in open(test_file).readlines()])
         test_list = [_ for _ in test_list if _.path in paths]
 
     if options.no_extensions:
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -828,26 +828,16 @@ def run_tests_remote(tests, prefix, opti
                timeout=600)
     prefix[0] = os.path.join(options.remote_test_root, 'js')
 
     # Run all tests.
     gen = get_remote_results(tests, dm, prefix, options)
     ok = process_test_results(gen, len(tests) * options.repeat, options)
     return ok
 
-def parse_jitflags(options):
-    jitflags = [['-' + flag for flag in flags]
-                for flags in options.jitflags.split(',')]
-    for flags in jitflags:
-        for flag in flags:
-            if flag not in ('-m', '-a', '-p', '-d', '-n'):
-                print('Invalid jit flag: "{}"'.format(flag))
-                sys.exit(1)
-    return jitflags
-
 def platform_might_be_android():
     try:
         # The python package for SL4A provides an |android| module.
         # If that module is present, we're likely in SL4A-python on
         # device.  False positives and negatives are possible,
         # however.
         import android
         return True
--- a/js/src/tests/lib/tests.py
+++ b/js/src/tests/lib/tests.py
@@ -6,31 +6,45 @@
 import datetime, os, sys, time
 from subprocess import Popen, PIPE
 from threading import Thread
 
 from results import TestOutput
 
 # When run on tbpl, we run each test multiple times with the following
 # arguments.
-TBPL_FLAGS = [
-    [], # no flags, normal baseline and ion
-    ['--ion-eager', '--ion-offthread-compile=off'], # implies --baseline-eager
-    ['--ion-eager', '--ion-offthread-compile=off',
-     '--ion-check-range-analysis', '--ion-extra-checks', '--no-sse3', '--no-threads'],
-    ['--baseline-eager'],
-    ['--baseline-eager', '--no-fpu'],
-    ['--no-baseline', '--no-ion'],
-]
-# Run reduced variants on debug builds, since they take longer time.
-TBPL_DEBUG_FLAGS = [
-    [], # no flags, normal baseline and ion
-    ['--ion-eager', '--ion-offthread-compile=off'], # implies --baseline-eager
-    ['--baseline-eager'],
-]
+JITFLAGS = {
+    'all': [
+        [], # no flags, normal baseline and ion
+        ['--ion-eager', '--ion-offthread-compile=off'], # implies --baseline-eager
+        ['--ion-eager', '--ion-offthread-compile=off',
+         '--ion-check-range-analysis', '--ion-extra-checks', '--no-sse3', '--no-threads'],
+        ['--baseline-eager'],
+        ['--baseline-eager', '--no-fpu'],
+        ['--no-baseline', '--no-ion'],
+    ],
+    # used by jit_test.py
+    'ion': [
+        ['--baseline-eager'],
+        ['--ion-eager', '--ion-offthread-compile=off']
+    ],
+    # Run reduced variants on debug builds, since they take longer time.
+    'debug': [
+        [], # no flags, normal baseline and ion
+        ['--ion-eager', '--ion-offthread-compile=off'], # implies --baseline-eager
+        ['--baseline-eager'],
+    ],
+    'none': []
+}
+
+def get_jitflags(variant):
+    if variant not in JITFLAGS:
+        print('Invalid jitflag: "{}"'.format(variant))
+        sys.exit(1)
+    return JITFLAGS[variant]
 
 def do_run_cmd(cmd):
     l = [None, None]
     th_run_cmd(cmd, l)
     return l[1]
 
 def set_limits():
     # resource module not supported on all platforms