Backout eecd3aa199e6 (bug 776305), 62facd5b3da9, c6a0ac7d47d2 & 2d56621abfee (bug 776035), e4e68cf2bd40 (bug 776016), 0853a4d49b4e & 31de6ffdedcb (bug 770426), 43a69b4981f5 (bug 756786) for Windows mochitest crashes
authorEd Morley <emorley@mozilla.com>
Wed, 25 Jul 2012 09:35:32 +0100
changeset 106381 1abfd50c8be6db38578c6d584948c0339f8f774a
parent 106380 79727970b9872e1416d40e4a672aae6621b648c3
child 106382 607a4fe97df45352d95221bc47986e2c3278e06a
push id214
push userakeybl@mozilla.com
push dateWed, 14 Nov 2012 20:38:59 +0000
treeherdermozilla-release@c8b08ec8e1aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs776305, 776035, 776016, 770426, 756786
milestone17.0a1
backs outeecd3aa199e690d5f42e64f16a631e500cb25f7c
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
Backout eecd3aa199e6 (bug 776305), 62facd5b3da9, c6a0ac7d47d2 & 2d56621abfee (bug 776035), e4e68cf2bd40 (bug 776016), 0853a4d49b4e & 31de6ffdedcb (bug 770426), 43a69b4981f5 (bug 756786) for Windows mochitest crashes
build/virtualenv/packages.txt
build/virtualenv/populate_virtualenv.py
config/Makefile.in
config/Preprocessor.py
config/mozunit.py
config/rules.mk
config/tests/unit-Expression.py
config/tests/unit-JarMaker.py
config/tests/unit-LineEndings.py
config/tests/unit-Preprocessor.py
config/tests/unit-buildlist.py
config/tests/unit-expandlibs.py
config/tests/unit-mozunit.py
config/tests/unit-nsinstall.py
config/tests/unit-printprereleasesuffix.py
config/tests/unit-writemozinfo.py
js/src/config/Makefile.in
js/src/config/Preprocessor.py
js/src/config/autoconf.mk.in
js/src/config/rules.mk
webapprt/Makefile.in
xpcom/idl-parser/runtests.py
xpcom/typelib/xpt/tools/runtests.py
xulrunner/app/Makefile.in
--- a/build/virtualenv/packages.txt
+++ b/build/virtualenv/packages.txt
@@ -2,10 +2,8 @@ setup.py:other-licenses/simplejson-2.1.1
 setup.py:testing/mozbase/manifestdestiny:develop
 setup.py:testing/mozbase/mozinfo:develop
 setup.py:testing/mozbase/mozinstall:develop
 setup.py:testing/mozbase/mozlog:develop
 setup.py:testing/mozbase/mozprocess:develop
 setup.py:testing/mozbase/mozprofile:develop
 setup.py:testing/mozbase/mozrunner:develop
 setup.py:python/blessings:develop
-mozilla.pth:build
-mozilla.pth:config
--- a/build/virtualenv/populate_virtualenv.py
+++ b/build/virtualenv/populate_virtualenv.py
@@ -1,20 +1,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # This file contains code for populating the virtualenv environment for
 # Mozilla's build system. It is typically called as part of configure.
 
-from __future__ import with_statement
 import os.path
 import subprocess
 import sys
-import distutils.sysconfig
 
 def populate_virtualenv(top_source_directory, manifest_filename):
     """Populate the virtualenv from the contents of a manifest.
 
     The manifest file consists of colon-delimited fields. The first field
     specifies the action. The remaining fields are arguments to that action.
     The following actions are supported:
 
@@ -35,21 +33,16 @@ def populate_virtualenv(top_source_direc
     fh.close()
 
     for package in packages:
         if package[0] == 'setup.py':
             assert len(package) >= 2
 
             call_setup(os.path.join(top_source_directory, package[1]),
                 package[2:])
-        if package[0].endswith('.pth'):
-            assert len(package) == 2
-
-            with open(os.path.join(distutils.sysconfig.get_python_lib(), package[0]), 'a') as f:
-                f.write("%s\n" % os.path.join(top_source_directory, package[1]))
 
 def call_setup(directory, arguments):
     """Calls setup.py in a directory."""
     setup = os.path.join(directory, 'setup.py')
 
     program = [sys.executable, setup]
     program.extend(arguments)
 
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -156,17 +156,16 @@ PYUNITS := \
   unit-Expression.py \
   unit-Preprocessor.py \
   unit-nsinstall.py \
   unit-printprereleasesuffix.py \
   unit-JarMaker.py \
   unit-buildlist.py \
   unit-expandlibs.py \
   unit-writemozinfo.py \
-  unit-mozunit.py \
   $(NULL)
 
 check-preqs = \
   check-python-modules \
   check-jar-mn \
   check-makefiles \
   $(NULL)
 
--- a/config/Preprocessor.py
+++ b/config/Preprocessor.py
@@ -121,23 +121,21 @@ class Preprocessor:
     if self.checkLineNumbers:
       self.writtenLines += 1
       ln = self.context['LINE']
       if self.writtenLines != ln:
         self.out.write('//@line %(line)d "%(file)s"%(le)s'%{'line': ln,
                                                             'file': self.context['FILE'],
                                                             'le': self.LE})
         self.writtenLines = ln
-    filteredLine = self.applyFilters(aLine)
-    if filteredLine != aLine:
-      self.actionLevel = 2
+    aLine = self.applyFilters(aLine)
     # ensure our line ending. Only need to handle \n, as we're reading
     # with universal line ending support, at least for files.
-    filteredLine = re.sub('\n', self.LE, filteredLine)
-    self.out.write(filteredLine)
+    aLine = re.sub('\n', self.LE, aLine)
+    self.out.write(aLine)
   
   def handleCommandLine(self, args, defaultToStdin = False):
     """
     Parse a commandline into this parser.
     Uses OptionParser internally, no args mean sys.argv[1:].
     """
     p = self.getCommandLineParser()
     (options, args) = p.parse_args(args=args)
--- a/config/mozunit.py
+++ b/config/mozunit.py
@@ -1,28 +1,25 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from unittest import TextTestRunner as _TestRunner, TestResult as _TestResult
-import unittest
 import inspect
-from StringIO import StringIO
-import os
 
 '''Helper to make python unit tests report the way that the Mozilla
 unit test infrastructure expects tests to report.
 
 Usage:
 
 import unittest
-import mozunit
+from mozunit import MozTestRunner
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main(testRunner=MozTestRunner())
 '''
 
 class _MozTestResult(_TestResult):
     def __init__(self, stream, descriptions):
         _TestResult.__init__(self)
         self.stream = stream
         self.descriptions = descriptions
 
@@ -66,74 +63,8 @@ class _MozTestResult(_TestResult):
 class MozTestRunner(_TestRunner):
     def _makeResult(self):
         return _MozTestResult(self.stream, self.descriptions)
     def run(self, test):
         result = self._makeResult()
         test(result)
         result.printErrorList()
         return result
-
-class MockedFile(StringIO):
-    def __init__(self, context, filename, content = ''):
-        self.context = context
-        self.name = filename
-        StringIO.__init__(self, content)
-
-    def close(self):
-        self.context.files[self.name] = self.getvalue()
-        StringIO.close(self)
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, type, value, traceback):
-        self.close()
-
-class MockedOpen(object):
-    '''
-    Context manager diverting the open builtin such that opening files
-    can open "virtual" file instances given when creating a MockedOpen.
-
-    with MockedOpen({'foo': 'foo', 'bar': 'bar'}):
-        f = open('foo', 'r')
-
-    will thus open the virtual file instance for the file 'foo' to f.
-
-    MockedOpen also masks writes, so that creating or replacing files
-    doesn't touch the file system, while subsequently opening the file
-    will return the recorded content.
-
-    with MockedOpen():
-        f = open('foo', 'w')
-        f.write('foo')
-    self.assertRaises(Exception,f.open('foo', 'r'))
-    '''
-    def __init__(self, files = {}):
-        self.files = {}
-        for name, content in files.iteritems():
-            self.files[os.path.abspath(name)] = content
-
-    def __call__(self, name, mode = 'r'):
-        absname = os.path.abspath(name)
-        if 'w' in mode:
-            file = MockedFile(self, absname)
-        elif absname in self.files:
-            file = MockedFile(self, absname, self.files[absname])
-        elif 'a' in mode:
-            file = MockedFile(self, absname, self.open(name, 'r').read())
-        else:
-            file = self.open(name, mode)
-        if 'a' in mode:
-            file.seek(0, os.SEEK_END)
-        return file
-
-    def __enter__(self):
-        import __builtin__
-        self.open = __builtin__.open
-        __builtin__.open = self
-
-    def __exit__(self, type, value, traceback):
-        import __builtin__
-        __builtin__.open = self.open
-
-def main(*args):
-    unittest.main(testRunner=MozTestRunner(),*args)
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1220,19 +1220,27 @@ endif
 
 ifneq ($(PREF_JS_EXPORTS),)
 # on win32, pref files need CRLF line endings... see bug 206029
 ifeq (WINNT,$(OS_ARCH))
 PREF_PPFLAGS = --line-endings=crlf
 endif
 
 ifndef NO_DIST_INSTALL
-PREF_JS_EXPORTS_PATH := $(FINAL_TARGET)/$(PREF_DIR)
-PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS)
-PP_TARGETS += PREF_JS_EXPORTS
+$(FINAL_TARGET)/$(PREF_DIR):
+	$(NSINSTALL) -D $@
+
+libs:: $(FINAL_TARGET)/$(PREF_DIR)
+libs:: $(PREF_JS_EXPORTS)
+	$(EXIT_ON_ERROR)  \
+	for i in $^; do \
+	  dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
 endif
 
 ################################################################################
 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
 
 ifneq ($(AUTOCFG_JS_EXPORTS),)
 $(FINAL_TARGET)/defaults/autoconfig::
@@ -1302,17 +1310,16 @@ ifneq ($(XPIDL_MODULE).idl,$(strip $(XPI
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
 ifndef NO_INTERFACES_MANIFEST
-libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
 endif
 endif
 
 GARBAGE_DIRS		+= $(XPIDL_GEN_DIR)
 
 endif #} XPIDLSRCS
@@ -1353,43 +1360,57 @@ ifdef EXTRA_COMPONENTS
 libs:: $(EXTRA_COMPONENTS)
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
 endif
 
 endif
 
 ifdef EXTRA_PP_COMPONENTS
+libs:: $(EXTRA_PP_COMPONENTS)
 ifndef NO_DIST_INSTALL
-EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
-PP_TARGETS += EXTRA_PP_COMPONENTS
+	$(EXIT_ON_ERROR) \
+	$(NSINSTALL) -D $(FINAL_TARGET)/components; \
+	for i in $^; do \
+	  fname=`basename $$i`; \
+	  dest=$(FINAL_TARGET)/components/$${fname}; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
 endif
 
 EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
 ifneq (,$(EXTRA_MANIFESTS))
-libs:: $(call mkdir_deps,$(FINAL_TARGET))
+libs::
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS)))
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
 ifdef EXTRA_JS_MODULES
 libs:: $(EXTRA_JS_MODULES)
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
 endif
 
 endif
 
 ifdef EXTRA_PP_JS_MODULES
+libs:: $(EXTRA_PP_JS_MODULES)
 ifndef NO_DIST_INSTALL
-EXTRA_PP_JS_MODULES_PATH := $(FINAL_TARGET)/modules
-PP_TARGETS += EXTRA_PP_JS_MODULES
+	$(EXIT_ON_ERROR) \
+	$(NSINSTALL) -D $(FINAL_TARGET)/modules; \
+	for i in $^; do \
+	  dest=$(FINAL_TARGET)/modules/`basename $$i`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
+
 endif
 
 ################################################################################
 # Copy testing-only JS modules to appropriate destination.
 #
 # For each file defined in TESTING_JS_MODULES, copy it to
 # objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
 # wlll be appended to the output directory.
@@ -1450,25 +1471,41 @@ libs realchrome:: $(CHROME_DEPS) $(FINAL
 	$(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
 	  $(QUIET) -j $(FINAL_TARGET)/chrome \
 	  $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
 	  $(JAR_MANIFEST)
 endif
 endif
 
 ifneq ($(DIST_FILES),)
-DIST_FILES_PATH := $(FINAL_TARGET)
-DIST_FILES_FLAGS := $(XULAPP_DEFINES) $(XULPPFLAGS)
-PP_TARGETS += DIST_FILES
+$(DIST)/bin:
+	$(NSINSTALL) -D $@
+
+libs:: $(DIST)/bin
+libs:: $(DIST_FILES)
+	@$(EXIT_ON_ERROR) \
+	for f in $^; do \
+	  dest=$(FINAL_TARGET)/`basename $$f`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
+	    $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $$f > $$dest; \
+	done
 endif
 
 ifneq ($(DIST_CHROME_FILES),)
-DIST_CHROME_FILES_PATH := $(FINAL_TARGET)/chrome
-DIST_CHROME_FILES_FLAGS := $(XULAPP_DEFINES) $(XULPPFLAGS)
-PP_TARGETS += DIST_CHROME_FILES
+libs:: $(DIST_CHROME_FILES)
+	@$(EXIT_ON_ERROR) \
+	for f in $^; do \
+	  dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
+	    $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $$f > $$dest; \
+	done
 endif
 
 ifneq ($(XPI_PKGNAME),)
 libs realchrome::
 ifdef STRIP_XPI
 ifndef MOZ_DEBUG
 	@echo "Stripping $(XPI_PKGNAME) package directory..."
 	@echo $(FINAL_TARGET)
@@ -1634,47 +1671,16 @@ ifdef ETAGS
 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
 all:: TAGS
 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
 	$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
 endif
 endif
 
 ################################################################################
-# Preprocessing rules
-#
-# The PP_TARGETS variable contains a list of all preprocessing target
-# categories. Each category defines a target path, and optional extra flags
-# like the following:
-#
-# FOO_PATH := target_path
-# FOO_FLAGS := -Dsome_flag
-# PP_TARGETS += FOO
-
-# PP_DEP defines preprocessing rules dependencies.
-# $(call PP_DEP, source_file, target_path, extra_flags)
-define PP_DEP
-$(2)/$(notdir $(1)): $(1) $(call mkdir_deps,$(2)) $(GLOBAL_DEPS)
-$(2)/$(notdir $(1)): EXTRA_PP_FLAGS := $(3)
-PP_FILES += $(2)/$(notdir $(1))
-endef
-
-$(foreach target,$(PP_TARGETS),\
-  $(foreach file,$($(target)),\
-    $(eval $(call PP_DEP,$(file),$($(target)_PATH),$($(target)_FLAGS)))\
-   )\
- )
-
-$(PP_FILES):
-	$(RM) $@
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(EXTRA_PP_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $@
-
-libs:: $(PP_FILES)
-
-################################################################################
 # Special gmake rules.
 ################################################################################
 
 
 #
 # Disallow parallel builds with MSVC < 8
 #
 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
--- a/config/tests/unit-Expression.py
+++ b/config/tests/unit-Expression.py
@@ -1,13 +1,13 @@
 import unittest
 
 import sys
 import os.path
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from Expression import Expression, Context
 
 class TestContext(unittest.TestCase):
   """
   Unit tests for the Context class
   """
 
@@ -55,9 +55,9 @@ class TestExpression(unittest.TestCase):
     """ Test for the == operator"""
     self.assert_(Expression('FAIL == PASS').evaluate(self.c))
 
   def test_notequals(self):
     """ Test for the != operator"""
     self.assert_(Expression('FAIL != 1').evaluate(self.c))
 
 if __name__ == '__main__':
-  mozunit.main()
+  unittest.main()
--- a/config/tests/unit-JarMaker.py
+++ b/config/tests/unit-JarMaker.py
@@ -1,16 +1,18 @@
 import unittest
 
 import os, sys, os.path, time, inspect
 from filecmp import dircmp
 from tempfile import mkdtemp
 from shutil import rmtree, copy2
 from zipfile import ZipFile
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from mozunit import MozTestRunner
 from JarMaker import JarMaker
 
 if sys.platform == "win32":
     import ctypes
     from ctypes import POINTER, WinError
     DWORD = ctypes.c_ulong
     LPDWORD = POINTER(DWORD)
     HANDLE = ctypes.c_void_p
@@ -273,9 +275,9 @@ class TestJarMaker(unittest.TestCase):
             open(os.path.join(ldir, relpath), 'w').write(relpath+" content\n")
         # call JarMaker
         difference = self._jar_and_compare(jars,
                                            (_mangle,),
                                            sourcedirs = [])
         self.assertTrue(not difference, difference)
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main(testRunner=MozTestRunner())
--- a/config/tests/unit-LineEndings.py
+++ b/config/tests/unit-LineEndings.py
@@ -1,15 +1,15 @@
 import unittest
 
 from StringIO import StringIO
 import os
 import sys
 import os.path
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from Preprocessor import Preprocessor
 
 class TestLineEndings(unittest.TestCase):
   """
   Unit tests for the Context class
   """
 
@@ -38,9 +38,9 @@ class TestLineEndings(unittest.TestCase)
     self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
 
   def testWindows(self):
     self.createFile(['\x0D\x0A']*3)
     self.pp.do_include(self.tempnam)
     self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
 
 if __name__ == '__main__':
-  mozunit.main()
+  unittest.main()
--- a/config/tests/unit-Preprocessor.py
+++ b/config/tests/unit-Preprocessor.py
@@ -1,23 +1,50 @@
 from __future__ import with_statement
 import unittest
 
 from StringIO import StringIO
 import os
 import sys
 import os.path
-from mozunit import main, MockedOpen
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from Preprocessor import Preprocessor
 
-def NamedIO(name, content):
-  with open(name, 'w') as f:
-    f.write(content)
-  return name
+class NamedIO(StringIO):
+  def __init__(self, name, content):
+    self.name = name
+    StringIO.__init__(self, content)
+
+class MockedOpen(object):
+  """
+  Context manager diverting the open builtin such that opening files
+  can open NamedIO instances given when creating a MockedOpen.
+
+  with MockedOpen(NamedIO('foo', 'foo'), NamedIO('bar', 'bar')):
+    f = open('foo', 'r')
+
+  will thus assign the NamedIO instance for the file 'foo' to f.
+  """
+  def __init__(self, *files):
+    self.files = {}
+    for f in files:
+      self.files[os.path.abspath(f.name)] = f
+  def __call__(self, name, args):
+    absname = os.path.abspath(name)
+    if absname in self.files:
+      return self.files[absname]
+    return self.open(name, args)
+  def __enter__(self):
+    import __builtin__
+    self.open = __builtin__.open
+    __builtin__.open = self
+  def __exit__(self, type, value, traceback):
+    import __builtin__
+    __builtin__.open = self.open
 
 class TestPreprocessor(unittest.TestCase):
   """
   Unit tests for the Context class
   """
 
   def setUp(self):
     self.pp = Preprocessor()
@@ -507,23 +534,23 @@ octal value is not equal
     try:
       self.pp.do_include(f)
     except Preprocessor.Error, exception:
       self.assertEqual(exception.key, 'UNDEFINED_VAR')
     else:
       self.fail("Expected a Preprocessor.Error")
 
   def test_include(self):
-    with MockedOpen({"foo/test": """#define foo foobarbaz
+    with MockedOpen(NamedIO("foo/test", """#define foo foobarbaz
 #include @inc@
 @bar@
-""",
-                     "bar": """#define bar barfoobaz
+"""),
+                      NamedIO("bar", """#define bar barfoobaz
 @foo@
-"""}):
+""")):
       f = NamedIO("include.in", """#filter substitution
 #define inc ../bar
 #include foo/test""")
       self.pp.do_include(f)
       self.assertEqual(self.pp.out.getvalue(), """foobarbaz
 barfoobaz
 """)
 
@@ -543,26 +570,26 @@ barfoobaz
     try:
       self.pp.do_include(f)
     except Preprocessor.Error, exception:
       self.assertEqual(exception.key, 'UNDEFINED_VAR')
     else:
       self.fail("Expected a Preprocessor.Error")
 
   def test_include_literal_at(self):
-    with MockedOpen({"@foo@": "#define foo foobarbaz"}):
+    with MockedOpen(NamedIO("@foo@", "#define foo foobarbaz")):
       f = NamedIO("include_literal_at.in", """#include @foo@
 #filter substitution
 @foo@
 """)
       self.pp.do_include(f)
       self.assertEqual(self.pp.out.getvalue(), """foobarbaz
 """)
 
   def test_command_line_literal_at(self):
-    with MockedOpen({"@foo@.in": """@foo@
-"""}):
+    with MockedOpen(NamedIO("@foo@.in", """@foo@
+""")):
       self.pp.handleCommandLine(['-Fsubstitution', '-Dfoo=foobarbaz', '@foo@.in'])
       self.assertEqual(self.pp.out.getvalue(), """foobarbaz
 """)
 
 if __name__ == '__main__':
-  main()
+  unittest.main()
--- a/config/tests/unit-buildlist.py
+++ b/config/tests/unit-buildlist.py
@@ -1,14 +1,14 @@
 import unittest
 
 import os, sys, os.path, time
 from tempfile import mkdtemp
 from shutil import rmtree
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from buildlist import addEntriesToListFile
 
 class TestBuildList(unittest.TestCase):
   """
   Unit tests for buildlist.py
   """
   def setUp(self):
@@ -72,9 +72,9 @@ class TestBuildList(unittest.TestCase):
     only one entry being added."""
     testfile = os.path.join(self.tmpdir, "test.list")
     addEntriesToListFile(testfile, ["a","b","a","a","b"])
     self.assertFileContains(testfile, ["a","b"])
     addEntriesToListFile(testfile, ["c","a","c","b","c"])
     self.assertFileContains(testfile, ["a","b","c"])
 
 if __name__ == '__main__':
-  mozunit.main()
+  unittest.main()
--- a/config/tests/unit-expandlibs.py
+++ b/config/tests/unit-expandlibs.py
@@ -1,17 +1,18 @@
 from __future__ import with_statement
 import subprocess
 import unittest
 import sys
 import os
 import imp
 from tempfile import mkdtemp
 from shutil import rmtree
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+from mozunit import MozTestRunner
 
 from UserString import UserString
 # Create a controlled configuration for use by expandlibs
 config_win = {
     'AR_EXTRACT': '',
     'DLL_PREFIX': '',
     'LIB_PREFIX': '',
     'OBJ_SUFFIX': '.obj',
@@ -379,9 +380,9 @@ class TestSymbolOrder(unittest.TestCase)
         config.LD_PRINT_ICF_SECTIONS = '-Wl,--print-icf-sections'
         args = ExpandArgsMore(['foo', '-bar', 'bar.o', 'foo.o'])
         self.assertEqual(args._getOrderedSections(['hello', '_Z6barbazv']), ['.text.hi', '.text.hello', '.text.hot._Z6barbazv'])
         self.assertEqual(args._getOrderedSections(['_ZThn4_6foobarv', 'hi', '_Z6barbazv']), ['.text._Z6foobarv', '.text._ZThn4_6foobarv', '.text.hi', '.text.hello', '.text.hot._Z6barbazv'])
         subprocess.Popen = subprocess_popen
 
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main(testRunner=MozTestRunner())
deleted file mode 100644
--- a/config/tests/unit-mozunit.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from __future__ import with_statement
-import sys
-import os
-from mozunit import main, MockedOpen
-import unittest
-from tempfile import mkstemp
-
-class TestMozUnit(unittest.TestCase):
-    def test_mocked_open(self):
-        # Create a temporary file on the file system.
-        (fd, path) = mkstemp()
-        with os.fdopen(fd, 'w') as file:
-            file.write('foobar');
-
-        with MockedOpen({'file1': 'content1',
-                         'file2': 'content2'}):
-            # Check the contents of the files given at MockedOpen creation.
-            self.assertEqual(open('file1', 'r').read(), 'content1')
-            self.assertEqual(open('file2', 'r').read(), 'content2')
-
-            # Check that overwriting these files alters their content.
-            with open('file1', 'w') as file:
-                file.write('foo')
-            self.assertEqual(open('file1', 'r').read(), 'foo')
-
-            # ... but not until the file is closed.
-            file = open('file2', 'w')
-            file.write('bar')
-            self.assertEqual(open('file2', 'r').read(), 'content2')
-            file.close()
-            self.assertEqual(open('file2', 'r').read(), 'bar')
-
-            # Check that appending to a file does append
-            with open('file1', 'a') as file:
-                file.write('bar')
-            self.assertEqual(open('file1', 'r').read(), 'foobar')
-
-            # Opening a non-existing file ought to fail.
-            self.assertRaises(IOError, open, 'file3', 'r')
-
-            # Check that writing a new file does create the file.
-            with open('file3', 'w') as file:
-                file.write('baz')
-            self.assertEqual(open('file3', 'r').read(), 'baz')
-
-            # Check the content of the file created outside MockedOpen.
-            self.assertEqual(open(path, 'r').read(), 'foobar')
-
-            # Check that overwriting a file existing on the file system
-            # does modify its content.
-            with open(path, 'w') as file:
-                file.write('bazqux')
-            self.assertEqual(open(path, 'r').read(), 'bazqux')
-
-        with MockedOpen():
-            # Check that appending to a file existing on the file system
-            # does modify its content.
-            with open(path, 'a') as file:
-                file.write('bazqux')
-            self.assertEqual(open(path, 'r').read(), 'foobarbazqux')
-
-        # Check that the file was not actually modified on the file system.
-        self.assertEqual(open(path, 'r').read(), 'foobar')
-        os.remove(path)
-
-        # Check that the file created inside MockedOpen wasn't actually
-        # created.
-        self.assertRaises(IOError, open, 'file3', 'r')
-
-if __name__ == "__main__":
-    main()
--- a/config/tests/unit-nsinstall.py
+++ b/config/tests/unit-nsinstall.py
@@ -1,14 +1,14 @@
 import unittest
 
 import os, sys, os.path, time
 from tempfile import mkdtemp
 from shutil import rmtree
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 from mozprocess import processhandler
 
 from nsinstall import nsinstall
 import nsinstall as nsinstall_module
 NSINSTALL_PATH = nsinstall_module.__file__
 
 # Run the non-ASCII tests on (a) Windows, or (b) any platform with
 # sys.stdin.encoding set to UTF-8
@@ -165,9 +165,9 @@ class TestNsinstall(unittest.TestCase):
 
             self.assertEqual(rv, 0)
             destfile = os.path.join(testdir, filename)
             self.assert_(os.path.isfile(destfile))
 
     #TODO: implement -R, -l, -L and test them!
 
 if __name__ == '__main__':
-  mozunit.main()
+  unittest.main()
--- a/config/tests/unit-printprereleasesuffix.py
+++ b/config/tests/unit-printprereleasesuffix.py
@@ -1,13 +1,13 @@
 import unittest
 
 import sys
 import os.path
-import mozunit
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from printprereleasesuffix import get_prerelease_suffix
 
 class TestGetPreReleaseSuffix(unittest.TestCase):
   """
   Unit tests for the get_prerelease_suffix function
   """
 
@@ -72,9 +72,9 @@ class TestGetPreReleaseSuffix(unittest.T
     self.assertEqual(self.c, '')
 
   def test_plus(self):
     """test 1.2+ version string """
     self.c = get_prerelease_suffix('1.2+')
     self.assertEqual(self.c, '')
 
 if __name__ == '__main__':
-  mozunit.main()
+  unittest.main()
--- a/config/tests/unit-writemozinfo.py
+++ b/config/tests/unit-writemozinfo.py
@@ -1,14 +1,15 @@
 #!/usr/bin/env python
 from __future__ import with_statement
 import unittest
 import os, sys, time, tempfile
 from StringIO import StringIO
-import mozunit
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from writemozinfo import build_dict, write_json, JsonValue, jsonify
 
 class TestBuildDict(unittest.TestCase):
     def testMissing(self):
         """
         Test that missing required values raises.
         """
@@ -233,9 +234,10 @@ class TestWriteJson(unittest.TestCase):
                            'MOZ_WIDGET_TOOLKIT':'windows'})
         d = parse_json(s.getvalue())
         self.assertEqual('win', d['os'])
         self.assertEqual('x86', d['processor'])
         self.assertEqual('windows', d['toolkit'])
         self.assertEqual(32, d['bits'])
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main()
+  
--- a/js/src/config/Makefile.in
+++ b/js/src/config/Makefile.in
@@ -38,17 +38,17 @@ endif
 endif
 
 include $(topsrcdir)/config/config.mk
 
 # Do not install util programs
 NO_INSTALL=1
 
 # Force wrap zlib system header if building js as a shared library.
-ifneq (,$(JS_SHARED_LIBRARY)$(MOZ_NATIVE_ZLIB))
+ifdef JS_SHARED_LIBRARY
 DEFINES += -DMOZ_NATIVE_ZLIB=1
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 HOST_CFLAGS += -DUNICODE -D_UNICODE
 
 export:: $(TARGETS)
--- a/js/src/config/Preprocessor.py
+++ b/js/src/config/Preprocessor.py
@@ -121,23 +121,21 @@ class Preprocessor:
     if self.checkLineNumbers:
       self.writtenLines += 1
       ln = self.context['LINE']
       if self.writtenLines != ln:
         self.out.write('//@line %(line)d "%(file)s"%(le)s'%{'line': ln,
                                                             'file': self.context['FILE'],
                                                             'le': self.LE})
         self.writtenLines = ln
-    filteredLine = self.applyFilters(aLine)
-    if filteredLine != aLine:
-      self.actionLevel = 2
+    aLine = self.applyFilters(aLine)
     # ensure our line ending. Only need to handle \n, as we're reading
     # with universal line ending support, at least for files.
-    filteredLine = re.sub('\n', self.LE, filteredLine)
-    self.out.write(filteredLine)
+    aLine = re.sub('\n', self.LE, aLine)
+    self.out.write(aLine)
   
   def handleCommandLine(self, args, defaultToStdin = False):
     """
     Parse a commandline into this parser.
     Uses OptionParser internally, no args mean sys.argv[1:].
     """
     p = self.getCommandLineParser()
     (options, args) = p.parse_args(args=args)
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -189,17 +189,16 @@ DOXYGEN		= @DOXYGEN@
 PBBUILD_BIN	= @PBBUILD_BIN@
 SDP		= @SDP@
 NSINSTALL_BIN	= @NSINSTALL_BIN@
 
 NSPR_CONFIG	= @NSPR_CONFIG@
 NSPR_CFLAGS	= @NSPR_CFLAGS@
 NSPR_LIBS	= @NSPR_LIBS@
 
-MOZ_NATIVE_ZLIB = @MOZ_NATIVE_ZLIB@
 MOZ_ZLIB_LIBS   = @MOZ_ZLIB_LIBS@
 MOZ_ZLIB_CFLAGS = @MOZ_ZLIB_CFLAGS@
 
 MOZ_NATIVE_FFI	= @MOZ_NATIVE_FFI@
 MOZ_FFI_LIBS	= @MOZ_FFI_LIBS@
 MOZ_FFI_CFLAGS	= @MOZ_FFI_CFLAGS@
 
 USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1220,19 +1220,27 @@ endif
 
 ifneq ($(PREF_JS_EXPORTS),)
 # on win32, pref files need CRLF line endings... see bug 206029
 ifeq (WINNT,$(OS_ARCH))
 PREF_PPFLAGS = --line-endings=crlf
 endif
 
 ifndef NO_DIST_INSTALL
-PREF_JS_EXPORTS_PATH := $(FINAL_TARGET)/$(PREF_DIR)
-PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS)
-PP_TARGETS += PREF_JS_EXPORTS
+$(FINAL_TARGET)/$(PREF_DIR):
+	$(NSINSTALL) -D $@
+
+libs:: $(FINAL_TARGET)/$(PREF_DIR)
+libs:: $(PREF_JS_EXPORTS)
+	$(EXIT_ON_ERROR)  \
+	for i in $^; do \
+	  dest=$(FINAL_TARGET)/$(PREF_DIR)/`basename $$i`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
 endif
 
 ################################################################################
 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
 
 ifneq ($(AUTOCFG_JS_EXPORTS),)
 $(FINAL_TARGET)/defaults/autoconfig::
@@ -1302,17 +1310,16 @@ ifneq ($(XPIDL_MODULE).idl,$(strip $(XPI
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
 libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
 ifndef NO_INTERFACES_MANIFEST
-libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
 endif
 endif
 
 GARBAGE_DIRS		+= $(XPIDL_GEN_DIR)
 
 endif #} XPIDLSRCS
@@ -1353,43 +1360,57 @@ ifdef EXTRA_COMPONENTS
 libs:: $(EXTRA_COMPONENTS)
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
 endif
 
 endif
 
 ifdef EXTRA_PP_COMPONENTS
+libs:: $(EXTRA_PP_COMPONENTS)
 ifndef NO_DIST_INSTALL
-EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
-PP_TARGETS += EXTRA_PP_COMPONENTS
+	$(EXIT_ON_ERROR) \
+	$(NSINSTALL) -D $(FINAL_TARGET)/components; \
+	for i in $^; do \
+	  fname=`basename $$i`; \
+	  dest=$(FINAL_TARGET)/components/$${fname}; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
 endif
 
 EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
 ifneq (,$(EXTRA_MANIFESTS))
-libs:: $(call mkdir_deps,$(FINAL_TARGET))
+libs::
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS)))
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
 ifdef EXTRA_JS_MODULES
 libs:: $(EXTRA_JS_MODULES)
 ifndef NO_DIST_INSTALL
 	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
 endif
 
 endif
 
 ifdef EXTRA_PP_JS_MODULES
+libs:: $(EXTRA_PP_JS_MODULES)
 ifndef NO_DIST_INSTALL
-EXTRA_PP_JS_MODULES_PATH := $(FINAL_TARGET)/modules
-PP_TARGETS += EXTRA_PP_JS_MODULES
+	$(EXIT_ON_ERROR) \
+	$(NSINSTALL) -D $(FINAL_TARGET)/modules; \
+	for i in $^; do \
+	  dest=$(FINAL_TARGET)/modules/`basename $$i`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
+	done
 endif
+
 endif
 
 ################################################################################
 # Copy testing-only JS modules to appropriate destination.
 #
 # For each file defined in TESTING_JS_MODULES, copy it to
 # objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
 # wlll be appended to the output directory.
@@ -1450,25 +1471,41 @@ libs realchrome:: $(CHROME_DEPS) $(FINAL
 	$(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
 	  $(QUIET) -j $(FINAL_TARGET)/chrome \
 	  $(MAKE_JARS_FLAGS) $(XULPPFLAGS) $(DEFINES) $(ACDEFINES) \
 	  $(JAR_MANIFEST)
 endif
 endif
 
 ifneq ($(DIST_FILES),)
-DIST_FILES_PATH := $(FINAL_TARGET)
-DIST_FILES_FLAGS := $(XULAPP_DEFINES) $(XULPPFLAGS)
-PP_TARGETS += DIST_FILES
+$(DIST)/bin:
+	$(NSINSTALL) -D $@
+
+libs:: $(DIST)/bin
+libs:: $(DIST_FILES)
+	@$(EXIT_ON_ERROR) \
+	for f in $^; do \
+	  dest=$(FINAL_TARGET)/`basename $$f`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
+	    $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $$f > $$dest; \
+	done
 endif
 
 ifneq ($(DIST_CHROME_FILES),)
-DIST_CHROME_FILES_PATH := $(FINAL_TARGET)/chrome
-DIST_CHROME_FILES_FLAGS := $(XULAPP_DEFINES) $(XULPPFLAGS)
-PP_TARGETS += DIST_CHROME_FILES
+libs:: $(DIST_CHROME_FILES)
+	@$(EXIT_ON_ERROR) \
+	for f in $^; do \
+	  dest=$(FINAL_TARGET)/chrome/`basename $$f`; \
+	  $(RM) -f $$dest; \
+	  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
+	    $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $$f > $$dest; \
+	done
 endif
 
 ifneq ($(XPI_PKGNAME),)
 libs realchrome::
 ifdef STRIP_XPI
 ifndef MOZ_DEBUG
 	@echo "Stripping $(XPI_PKGNAME) package directory..."
 	@echo $(FINAL_TARGET)
@@ -1634,47 +1671,16 @@ ifdef ETAGS
 ifneq ($(CSRCS)$(CPPSRCS)$(HEADERS),)
 all:: TAGS
 TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
 	$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
 endif
 endif
 
 ################################################################################
-# Preprocessing rules
-#
-# The PP_TARGETS variable contains a list of all preprocessing target
-# categories. Each category defines a target path, and optional extra flags
-# like the following:
-#
-# FOO_PATH := target_path
-# FOO_FLAGS := -Dsome_flag
-# PP_TARGETS += FOO
-
-# PP_DEP defines preprocessing rules dependencies.
-# $(call PP_DEP, source_file, target_path, extra_flags)
-define PP_DEP
-$(2)/$(notdir $(1)): $(1) $(call mkdir_deps,$(2)) $(GLOBAL_DEPS)
-$(2)/$(notdir $(1)): EXTRA_PP_FLAGS := $(3)
-PP_FILES += $(2)/$(notdir $(1))
-endef
-
-$(foreach target,$(PP_TARGETS),\
-  $(foreach file,$($(target)),\
-    $(eval $(call PP_DEP,$(file),$($(target)_PATH),$($(target)_FLAGS)))\
-   )\
- )
-
-$(PP_FILES):
-	$(RM) $@
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(EXTRA_PP_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $@
-
-libs:: $(PP_FILES)
-
-################################################################################
 # Special gmake rules.
 ################################################################################
 
 
 #
 # Disallow parallel builds with MSVC < 8
 #
 ifneq (,$(filter 1200 1300 1310,$(_MSC_VER)))
--- a/webapprt/Makefile.in
+++ b/webapprt/Makefile.in
@@ -55,17 +55,17 @@ include $(topsrcdir)/config/rules.mk
 ifdef MOZ_DEBUG
 DEFINES += -DMOZ_DEBUG=1
 endif
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DMOZILLA_OFFICIAL
 endif
 
-libs:: $(call mkdir_deps,$(FINAL_TARGET))
+libs::
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "resource webapprt ./"
 
 GRE_MILESTONE := $(shell tail -n 1 $(topsrcdir)/config/milestone.txt 2>/dev/null || tail -1 $(topsrcdir)/config/milestone.txt)
 GRE_BUILDID := $(shell cat $(DEPTH)/config/buildid)
 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) \
            -DGRE_BUILDID=$(GRE_BUILDID) \
            -DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME) \
            $(NULL)
--- a/xpcom/idl-parser/runtests.py
+++ b/xpcom/idl-parser/runtests.py
@@ -1,16 +1,15 @@
 #!/usr/bin/env python
 #
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 #
 # Unit tests for xpidl.py
 
-import mozunit
 import unittest
 import xpidl
 
 class TestParser(unittest.TestCase):
     def setUp(self):
         self.p = xpidl.IDLParser()
     
     def testEmpty(self):
@@ -90,9 +89,9 @@ attribute long bar;
         self.assertTrue(isinstance(i.productions[0], xpidl.Interface))
         iface = i.productions[0]
         a = iface.members[0]
         self.assertTrue(isinstance(a, xpidl.Attribute))
         self.assertEqual("bar", a.name)
         self.assertEqual("long", a.type)
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main()
--- a/xpcom/typelib/xpt/tools/runtests.py
+++ b/xpcom/typelib/xpt/tools/runtests.py
@@ -32,17 +32,16 @@
 
 import difflib
 import os
 import shutil
 from StringIO import StringIO
 import subprocess
 import sys
 import tempfile
-import mozunit
 import unittest
 import xpt
 
 def get_output(bin, file):
     p = subprocess.Popen([bin, file], stdout=subprocess.PIPE)
     stdout, _ = p.communicate()
     return stdout
 
@@ -759,9 +758,9 @@ class TestXPTLink(unittest.TestCase):
         self.assert_(t3.interfaces[1].resolved)
         # Ensure that IRetval's method's param type has been updated.
         self.assertEqual(1, len(t3.interfaces[0].methods))
         self.assert_(t3.interfaces[0].methods[0].params[0].type.element_type.iface.resolved)
         self.assertEqual(t3.interfaces[1],
                          t3.interfaces[0].methods[0].params[0].type.element_type.iface)
 
 if __name__ == '__main__':
-    mozunit.main()
+    unittest.main()
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -12,17 +12,21 @@ include $(DEPTH)/config/autoconf.mk
 
 DIRS = profile
 
 PREF_JS_EXPORTS = $(srcdir)/xulrunner.js
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
 
 DEFINES += -DAB_CD=$(AB_CD)
 
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
 PROGRAM = xulrunner$(BIN_SUFFIX)
+else
+PROGRAM = xulrunner-bin$(BIN_SUFFIX)
+endif
 
 DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
 
 ifdef TARGET_XPCOM_ABI
 DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
 endif
 
 DEFINES += -DXPCOM_GLUE
@@ -107,16 +111,35 @@ ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 ifeq ($(OS_TEST),x86_64)
 # set stack to 2MB on x64 build.  See bug 582910
 LDFLAGS += -STACK:2097152
 endif
 endif
 endif
 
+ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+ifeq (unix, $(MOZ_FS_LAYOUT))
+
+xulrunner:: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
+	cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
+                -e "s|%MOZ_USER_DIR%|.mozilla/xulrunner|" \
+                -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
+	chmod +x $@
+
+libs:: xulrunner
+	$(INSTALL) $< $(DIST)/bin
+
+install:: xulrunner
+	$(SYSINSTALL) $< $(DESTDIR)$(bindir)
+
+GARBAGE += xulrunner
+endif
+endif
+
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 libs::
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
 endif
 
 # XXX applications would need to supply this file
@@ -152,21 +175,21 @@ FRAMEWORK_DIR = \
 
 libs:: $(PROGRAM) $(FRAMEWORK_DIR)/Resources
 	$(NSINSTALL) $(srcdir)/macbuild/InfoPlist.strings $(FRAMEWORK_DIR)/Resources
 	sed -e "s/APP_VERSION/$(APP_VERSION)/" $(srcdir)/macbuild/Info.plist.in > $(FRAMEWORK_DIR)/Info.plist
 	rsync -av $(DIST)/bin/ $(FRAMEWORK_DIR) --exclude mangle --exclude shlibsign
 	rm -f $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current \
 	      $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib \
 	      $(DIST)/$(FRAMEWORK_NAME).framework/XUL \
-	      $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner
+	      $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner-bin
 	ln -s $(FRAMEWORK_VERSION) $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current
 	ln -s Versions/Current/libxpcom.dylib $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib
 	ln -s Versions/Current/XUL $(DIST)/$(FRAMEWORK_NAME).framework/XUL
-	ln -s Versions/Current/xulrunner $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner
+	ln -s Versions/Current/xulrunner-bin $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner-bin
 
 clean clobber::
 	rm -rf $(DIST)/$(FRAMEWORK_NAME).framework
 endif
 
 README_FILE = $(srcdir)/../README.xulrunner
 
 libs::