Backout eecd3aa199e6 (bug 776305), 62facd5b3da9, c6a0ac7d47d2 & 2d56621abfee (bug 776035), e4e68cf2bd40 (bug 776016), 0853a4d49b4e & 31de6ffdedcb (bug 770426), 43a69b4981f5 (bug 756786) for Windows mochitest crashes

This commit is contained in:
Ed Morley 2012-07-25 09:35:32 +01:00
Родитель f9fb18bba5
Коммит 3d60969c38
24 изменённых файлов: 202 добавлений и 296 удалений

Просмотреть файл

@ -7,5 +7,3 @@ 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

Просмотреть файл

@ -5,11 +5,9 @@
# 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.
@ -40,11 +38,6 @@ def populate_virtualenv(top_source_directory, manifest_filename):
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."""

Просмотреть файл

@ -161,7 +161,6 @@ PYUNITS := \
unit-buildlist.py \
unit-expandlibs.py \
unit-writemozinfo.py \
unit-mozunit.py \
$(NULL)
check-preqs = \

Просмотреть файл

@ -126,13 +126,11 @@ class Preprocessor:
'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):
"""

Просмотреть файл

@ -3,10 +3,7 @@
# 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.
@ -14,10 +11,10 @@ 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):
@ -71,69 +68,3 @@ class MozTestRunner(_TestRunner):
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)

Просмотреть файл

@ -1225,9 +1225,17 @@ 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
@ -1307,7 +1315,6 @@ 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
@ -1358,15 +1365,22 @@ 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
@ -1381,10 +1395,17 @@ 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
################################################################################
@ -1455,15 +1476,31 @@ 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),)
@ -1638,37 +1675,6 @@ TAGS:: $(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.
################################################################################

Просмотреть файл

@ -2,7 +2,7 @@ import unittest
import sys
import os.path
import mozunit
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from Expression import Expression, Context
@ -60,4 +60,4 @@ class TestExpression(unittest.TestCase):
self.assert_(Expression('FAIL != 1').evaluate(self.c))
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -5,7 +5,9 @@ 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":
@ -278,4 +280,4 @@ class TestJarMaker(unittest.TestCase):
self.assertTrue(not difference, difference)
if __name__ == '__main__':
mozunit.main()
unittest.main(testRunner=MozTestRunner())

Просмотреть файл

@ -4,7 +4,7 @@ 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
@ -43,4 +43,4 @@ class TestLineEndings(unittest.TestCase):
self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -5,14 +5,41 @@ 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):
"""
@ -512,13 +539,13 @@ octal value is not equal
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""")
@ -548,7 +575,7 @@ barfoobaz
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@
@ -558,11 +585,11 @@ barfoobaz
""")
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()

Просмотреть файл

@ -3,7 +3,7 @@ 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
@ -77,4 +77,4 @@ class TestBuildList(unittest.TestCase):
self.assertFileContains(testfile, ["a","b","c"])
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -6,7 +6,8 @@ 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
@ -384,4 +385,4 @@ class TestSymbolOrder(unittest.TestCase):
if __name__ == '__main__':
mozunit.main()
unittest.main(testRunner=MozTestRunner())

Просмотреть файл

@ -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()

Просмотреть файл

@ -3,7 +3,7 @@ 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
@ -170,4 +170,4 @@ class TestNsinstall(unittest.TestCase):
#TODO: implement -R, -l, -L and test them!
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -2,7 +2,7 @@ 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
@ -77,4 +77,4 @@ class TestGetPreReleaseSuffix(unittest.TestCase):
self.assertEqual(self.c, '')
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -3,7 +3,8 @@ 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
@ -238,4 +239,5 @@ class TestWriteJson(unittest.TestCase):
self.assertEqual(32, d['bits'])
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -43,7 +43,7 @@ include $(topsrcdir)/config/config.mk
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

Просмотреть файл

@ -126,13 +126,11 @@ class Preprocessor:
'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):
"""

Просмотреть файл

@ -194,7 +194,6 @@ 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@

Просмотреть файл

@ -1225,9 +1225,17 @@ 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
@ -1307,7 +1315,6 @@ 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
@ -1358,15 +1365,22 @@ 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
@ -1381,10 +1395,17 @@ 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
################################################################################
@ -1455,15 +1476,31 @@ 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),)
@ -1638,37 +1675,6 @@ TAGS:: $(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.
################################################################################

Просмотреть файл

@ -60,7 +60,7 @@ 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)

Просмотреть файл

@ -5,7 +5,6 @@
#
# Unit tests for xpidl.py
import mozunit
import unittest
import xpidl
@ -95,4 +94,4 @@ attribute long bar;
self.assertEqual("long", a.type)
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -37,7 +37,6 @@ from StringIO import StringIO
import subprocess
import sys
import tempfile
import mozunit
import unittest
import xpt
@ -764,4 +763,4 @@ class TestXPTLink(unittest.TestCase):
t3.interfaces[0].methods[0].params[0].type.element_type.iface)
if __name__ == '__main__':
mozunit.main()
unittest.main()

Просмотреть файл

@ -17,7 +17,11 @@ 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\"
@ -112,6 +116,25 @@ 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
@ -157,11 +180,11 @@ libs:: $(PROGRAM) $(FRAMEWORK_DIR)/Resources
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