bug 820691: Don't use GDB's --python option to run JS pretty-printer tests; newer GDBs don't have that option. DONTBUILD r=sfink
authorJim Blandy <jimb@mozilla.com>
Wed, 12 Dec 2012 18:09:50 -0800
changeset 115881 bdee421b26c6b218ecc4ee29ab9a08ea3a099d9d
parent 115880 40e47d029f77bdbe7aae4c9595be937f1f999c4a
child 115883 0368b4c03c63bfe00246bc149aef886e4d0a4ff2
push id24028
push useremorley@mozilla.com
push dateThu, 13 Dec 2012 15:56:02 +0000
treeherderautoland@9db79b97abbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs820691
milestone20.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 820691: Don't use GDB's --python option to run JS pretty-printer tests; newer GDBs don't have that option. DONTBUILD r=sfink
js/src/gdb/lib-for-tests/catcher.py
js/src/gdb/lib-for-tests/prolog.py
js/src/gdb/run-tests.py
--- a/js/src/gdb/lib-for-tests/catcher.py
+++ b/js/src/gdb/lib-for-tests/catcher.py
@@ -1,19 +1,22 @@
 # Apparently, there's simply no way to ask GDB to exit with a non-zero
-# status when the script run with the --python option fails. Thus, if we
-# have --python run prolog.py directly, syntax errors there will lead GDB
-# to exit with no indication anything went wrong.
+# status when the script run with the --eval-command option fails. Thus, if
+# we have --eval-command run prolog.py directly, syntax errors there will
+# lead GDB to exit with no indication anything went wrong.
 #
 # To avert that, we use this very small launcher script to run prolog.py
 # and catch errors.
 #
 # Remember, errors in this file will cause spurious passes, so keep this as
 # simple as possible!
 
+import os
 import sys
 import traceback
 try:
-    execfile(sys.argv.pop(0))
+    # testlibdir is set on the GDB command line, via:
+    # --eval-command python testlibdir=...
+    execfile(os.path.join(testlibdir, 'prolog.py'))
 except Exception as err:
     sys.stderr.write('Error running GDB prologue:\n')
     traceback.print_exc()
     sys.exit(1)
--- a/js/src/gdb/lib-for-tests/prolog.py
+++ b/js/src/gdb/lib-for-tests/prolog.py
@@ -1,13 +1,17 @@
 import gdb
+import os
 import re
 import sys
 import traceback
 
+# testlibdir is set on the GDB command line, via --eval-command python testlibdir=...
+sys.path[0:0] = [testlibdir]
+
 # Run the C++ fragment named |fragment|, stopping on entry to |function|
 # ('breakpoint', by default) and then select the calling frame.
 def run_fragment(fragment, function='breakpoint'):
     # Arrange to stop at a reasonable place in the test program.
     bp = gdb.Breakpoint(function);
     try:
         gdb.execute("run %s" % (fragment,))
         # Check that we did indeed stop by hitting the breakpoint we set.
@@ -53,17 +57,19 @@ gdb.execute('set confirm off', False)
 
 # Some print settings that make testing easier.
 gdb.execute('set print static-members off')
 gdb.execute('set print address off')
 gdb.execute('set print pretty off')
 gdb.execute('set width 0')
 
 try:
-    execfile(sys.argv[0])
+    # testscript is set on the GDB command line, via:
+    # --eval-command python testscript=...
+    execfile(testscript)
 except AssertionError as err:
     sys.stderr.write('\nAssertion traceback:\n')
     (t, v, tb) = sys.exc_info()
     traceback.print_tb(tb)
     sys.stderr.write('\nTest assertion failed:\n')
     sys.stderr.write(str(err))
     sys.exit(1)
 
--- a/js/src/gdb/run-tests.py
+++ b/js/src/gdb/run-tests.py
@@ -154,20 +154,19 @@ class Test(TaskPool.Task):
     def cmd(self):
         testlibdir = os.path.normpath(os.path.join(OPTIONS.testdir, '..', 'lib-for-tests'))
         return [OPTIONS.gdb_executable,
                 '-nw',          # Don't create a window (unnecessary?)
                 '-nx',          # Don't read .gdbinit.
                 '--ex', 'add-auto-load-safe-path %s' % (OPTIONS.builddir,),
                 '--ex', 'set env LD_LIBRARY_PATH %s' % (OPTIONS.libdir,),
                 '--ex', 'file %s' % (os.path.join(OPTIONS.builddir, 'gdb-tests'),),
-                '--eval-command', 'python sys.path[0:0] = [%r]' % testlibdir,
-                '--python', os.path.join(testlibdir, 'catcher.py'),
-                            os.path.join(testlibdir, 'prolog.py'),
-                self.test_path]
+                '--eval-command', 'python testlibdir=%r' % (testlibdir,),
+                '--eval-command', 'python testscript=%r' % (self.test_path,),
+                '--eval-command', 'python execfile(%r)' % os.path.join(testlibdir, 'catcher.py')]
 
     def start(self, pipe, deadline):
         super(Test, self).start(pipe, deadline)
         if OPTIONS.show_cmd:
             self.summary.interleave_output(lambda: self.show_cmd(sys.stdout))
 
     def onStdout(self, text):
         self.stdout += text