Bug 506202 Hook up mozmill tests to make package-tests and support running packaged test style. r=asuth,gozer. a=Standard8 for checkin to CLOSED TREE as this is build-config/test only and allows work on the new try server to get it nearer completion
--- a/mailnews/Makefile.in
+++ b/mailnews/Makefile.in
@@ -54,17 +54,20 @@ PARALLEL_DIRS += \
imap \
import \
local \
mime \
news \
$(NULL)
ifdef ENABLE_TESTS
-PARALLEL_DIRS += test
+PARALLEL_DIRS += \
+ test \
+ test/performance/bloat \
+ $(NULL)
endif
ifeq ($(OS_ARCH),WINNT)
ifndef GNU_CC
PARALLEL_DIRS += mapi/mapiDLL mapi/mapihook
endif
endif
@@ -77,16 +80,17 @@ endif
PREF_JS_EXPORTS = $(srcdir)/mailnews.js
DEFINES += -DOS_ARCH=$(OS_ARCH) \
-DMOZ_WIDGET_TOOLKIT=$(MOZ_WIDGET_TOOLKIT) \
$(NULL)
include $(topsrcdir)/config/rules.mk
+ifdef ENABLE_TESTS
libs::
$(INSTALL) $(wildcard $(srcdir)/test/resources/*.js) $(MOZDEPTH)/_tests/xpcshell/mailnews/resources
$(INSTALL) $(wildcard $(srcdir)/test/data/*) $(MOZDEPTH)/_tests/xpcshell/mailnews/data
$(INSTALL) $(wildcard $(srcdir)/test/fakeserver/*.js) $(MOZDEPTH)/_tests/xpcshell/mailnews/fakeserver
# We provide an xpcshell-tests target here because the top-level target acts
# differently to the specific directory one. We want our developers to be able
# to run "make -C mailnews xpcshell-tests" so we do this short-cut here. This
@@ -96,8 +100,9 @@ libs::
TEST_DIRS = base $(PARALLEL_DIRS) extensions/bayesian-spam-filter
xpcshell-tests::
for dir in $(TEST_DIRS); do \
if test -d $$dir/test; then \
$(MAKE) -C $$dir/test xpcshell-tests; \
fi; \
done
+endif
--- a/mailnews/makefiles.sh
+++ b/mailnews/makefiles.sh
@@ -132,9 +132,10 @@ mailnews/mime/emitters/src/Makefile
mailnews/mime/public/Makefile
mailnews/mime/src/Makefile
mailnews/mime/test/Makefile
mailnews/news/Makefile
mailnews/news/build/Makefile
mailnews/news/public/Makefile
mailnews/news/src/Makefile
mailnews/news/test/Makefile
+mailnews/test/performance/bloat/Makefile
"
new file mode 100644
--- /dev/null
+++ b/mailnews/test/performance/bloat/Makefile.in
@@ -0,0 +1,79 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mailnews Bloat.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mark Banner <bugzilla@standard8.plus.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = mailbloat
+
+ifdef XPI_NAME
+NO_JS_MANIFEST = 1
+DIST_FILES = install.rdf
+
+# Used in install.rdf
+USE_EXTENSION_MANIFEST = 1
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+# We're installing to _tests/mailbloat/extension
+TARGET_DEPTH = ../../..
+include $(MOZILLA_DIR)/build/automation-build.mk
+
+_DEST_DIR = $(MOZDEPTH)/_tests/mailbloat/
+
+# We want to get an extension-packaged version of mailbloat as well,
+# so this seems to be the simplest way to make that happen.
+ifdef XPI_NAME
+libs::
+ $(NSINSTALL) -D $(FINAL_TARGET)/defaults/preferences
+ $(NSINSTALL) $(srcdir)/mailnewsTestPrefs.js $(FINAL_TARGET)/defaults/preferences
+else
+make-xpi:
+ +$(MAKE) libs XPI_NAME=mailbloat
+copy-harness: make-xpi
+libs:: copy-harness
+endif
+
+# Copy the mailbloat extension bits to $(_DEST_DIR)
+copy-harness:
+ $(NSINSTALL) -D $(_DEST_DIR)
+ (cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - mailbloat) | (cd $(_DEST_DIR) && tar -xf -)
--- a/mailnews/test/performance/bloat/bloatAddrOverlay.xul
+++ b/mailnews/test/performance/bloat/bloatAddrOverlay.xul
@@ -33,11 +33,11 @@
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<overlay id="bloatAddrOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="chrome://mailnewstest/content/bloatAddrOverlay.js"/>
+ <script src="chrome://mailbloat/content/bloatAddrOverlay.js"/>
</overlay>
--- a/mailnews/test/performance/bloat/bloatComposeOverlay.xul
+++ b/mailnews/test/performance/bloat/bloatComposeOverlay.xul
@@ -33,11 +33,11 @@
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<overlay id="bloatComposeOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="chrome://mailnewstest/content/bloatComposeOverlay.js"/>
+ <script src="chrome://mailbloat/content/bloatComposeOverlay.js"/>
</overlay>
--- a/mailnews/test/performance/bloat/bloatMainOverlay.xul
+++ b/mailnews/test/performance/bloat/bloatMainOverlay.xul
@@ -33,11 +33,11 @@
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<overlay id="bloatMainOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="chrome://mailnewstest/content/bloatMainOverlay.js"/>
+ <script src="chrome://mailbloat/content/bloatMainOverlay.js"/>
</overlay>
new file mode 100644
--- /dev/null
+++ b/mailnews/test/performance/bloat/install.rdf
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>mailbloat@mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:targetApplication>
+ <Description>
+ <em:id>toolkit@mozilla.org</em:id>
+#expand <em:minVersion>__MOZILLA_VERSION_U__</em:minVersion>
+#expand <em:maxVersion>__MOZILLA_VERSION_U__</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <!-- Front End MetaData -->
+ <em:name>Mail Bloat Tests</em:name>
+ <em:description>Run Mail Bloat Tests</em:description>
+ <em:creator>Mark Banner</em:creator>
+ </Description>
+</RDF>
new file mode 100644
--- /dev/null
+++ b/mailnews/test/performance/bloat/jar.mn
@@ -0,0 +1,11 @@
+mailbloat.jar:
+% content mailbloat %content/
+% overlay chrome://messenger/content/messenger.xul chrome://mailbloat/content/bloatMainOverlay.xul
+% overlay chrome://messenger/content/addressbook/addressbook.xul chrome://mailbloat/content/bloatAddrOverlay.xul
+% overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://mailbloat/content/bloatComposeOverlay.xul
+ content/bloatMainOverlay.js (bloatMainOverlay.js)
+ content/bloatMainOverlay.xul (bloatMainOverlay.xul)
+ content/bloatAddrOverlay.js (bloatAddrOverlay.js)
+ content/bloatAddrOverlay.xul (bloatAddrOverlay.xul)
+ content/bloatComposeOverlay.js (bloatComposeOverlay.js)
+ content/bloatComposeOverlay.xul (bloatComposeOverlay.xul)
rename from mailnews/test/performance/common/mailnewsTestPrefs.js
rename to mailnews/test/performance/bloat/mailnewsTestPrefs.js
--- a/mailnews/test/performance/bloat/runtest.py
+++ b/mailnews/test/performance/bloat/runtest.py
@@ -109,17 +109,18 @@ if automation.IS_MAC:
else:
BINDIR = os.path.join(DISTDIR, 'bin')
if automation.IS_MAC:
EXECUTABLE = options.bin + '-bin'
else:
EXECUTABLE = options.bin
BIN = os.path.join(BINDIR, EXECUTABLE)
-PROFILE = os.path.join(DISTDIR, '..', '_leaktest', 'leakprofile')
+EXTENSIONDIR = os.path.join(DISTDIR, '..', '_tests', 'mailbloat', 'mailbloat')
+PROFILE = os.path.join(DISTDIR, '..', '_tests', 'mailbloat', 'leakprofile')
print BIN
print EXECUTABLE
# Wipe the profile
if os.path.exists(PROFILE):
shutil.rmtree(PROFILE)
os.mkdir(PROFILE)
@@ -137,57 +138,46 @@ COMMANDS = [
'name': 'register',
'args': ['-register'],
},
{
'name': 'createProfile',
'args': ['-CreateProfile', 'bloat ' + PROFILE],
},
{
- 'name': 'setupTests',
- 'bin': sys.executable,
- 'args': ['setUpBloatTest.py',
- '--profile-dir=' + PROFILE,
- '--binary-dir=' + BINDIR,
- ],
- 'cwd': SCRIPTDIR,
+ 'name': 'setupProfile'
},
{
'name': 'bloatTests',
'args': ['-profile', PROFILE],
'env': {'XPCOM_MEM_BLOAT_LOG': 'bloat.log'},
},
{
'name': 'leakTests',
'args': ['-profile', PROFILE,
'--trace-malloc', 'malloc.log',
'--shutdown-leaks', 'sdleak.log',
],
'env': {'XPCOM_MEM_BLOAT_LOG': 'trace-bloat.log'},
},
- {
- 'name': 'cleanup tests',
- 'bin': sys.executable,
- 'args': ['setUpBloatTest.py',
- '--profile-dir=' + PROFILE,
- '--binary-dir=' + BINDIR,
- '--cleanup'
- ],
- 'cwd': SCRIPTDIR,
- }
]
for cmd in COMMANDS:
# Some scripts rely on the cwd
cwd = CWD
if 'cwd' in cmd:
cwd = cmd['cwd']
os.chdir(cwd)
+ if cmd['name'] == 'setupProfile':
+ automation.installExtension(EXTENSIONDIR, PROFILE, "mailbloat@mozilla.org")
+ print "Hello"
+ continue
+
# Set up the environment
mailnewsEnv = defaultEnv
if 'env' in cmd:
mailnewsEnv.update(cmd['env'])
# Build the command
binary = BIN
# Copy default args, using the : option.
deleted file mode 100644
--- a/mailnews/test/performance/bloat/setUpBloatTest.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla MailNews test code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Messaging.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mark Banner <bugzilla@standard8.plus.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-"""
-Sets up the supplied profile with required items for MailNews Bloat Tests
-"""
-
-import optparse
-import os
-import os.path
-import platform
-import re
-import shutil
-from subprocess import Popen,PIPE
-import sys
-
-# append the common directory so we can import the common module
-sys.path.append(os.path.join(os.getcwd(), '../common'))
-import setUpCommonMailNews
-
-copyFiles = ["bloatComposeOverlay.js",
- "bloatComposeOverlay.xul",
- "bloatAddrOverlay.js",
- "bloatAddrOverlay.xul",
- "bloatMainOverlay.js",
- "bloatMainOverlay.xul"];
-
-class BloatProfileOptions(optparse.OptionParser):
- """Parses Set Up Bloat Profile commandline options."""
- def __init__(self, **kwargs):
- optparse.OptionParser.__init__(self, **kwargs)
- defaults = {}
-
- self.add_option("--cleanup",
- action = "store_true", dest = "cleanup",
- help = "Clean up rather than shut down.")
- defaults["cleanup"] = False
-
- setUpCommonMailNews.AddCommonOptions(self, defaults);
-
-def copyChromeFiles(destination):
- # Copy bloat*Overlay.js/xul to the chrome directory
- for file in copyFiles:
- shutil.copy(file, destination)
-
-def createManifest(chromeDir, manifestFileName):
- # Formulate a manifest to allow load of and overlay the bloatTestOverlay.xul
- # file onto the main windows
- fileLocation = chromeDir + "/" + manifestFileName
- try:
- f = open(fileLocation, 'w');
- except IOError:
- print "Couldn't write to " + fileLocation
- sys.exit(2)
-
- # Must have a "/" on the end of chromeDir
- realChromeDir = chromeDir + "/"
- if platform.system() in ("Windows", "Microsoft"):
- realChromeDir.replace("\\", "\/");
-
- f.write("content mailnewstest file:///" + realChromeDir + "\n")
- text = """\
-overlay chrome://messenger/content/messenger.xul chrome://mailnewstest/content/bloatMainOverlay.xul
-overlay chrome://messenger/content/addressbook/addressbook.xul chrome://mailnewstest/content/bloatAddrOverlay.xul
-overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://mailnewstest/content/bloatComposeOverlay.xul
-"""
- f.write(text)
- f.close()
-
-def removeFiles(destination, manifestFileName):
- for file in copyFiles:
- os.remove(os.path.join(destination, file))
-
- os.remove(os.path.join(destination, manifestFileName))
-
-def main():
- # Argument parsing and checking
- parser = BloatProfileOptions()
- options, args = parser.parse_args()
-
- if options.binaryDir=="" or options.profileDir=="":
- print "Binary and Profile Directories must be supplied"
- sys.exit(2)
-
- if not os.path.exists(options.binaryDir) or not os.path.exists(options.profileDir):
- print "Binary and Profile Directories must be exist"
- sys.exit(2)
-
- # The main work
- print "Running setUpBloatTest.py"
-
- if options.cleanup:
- removeFiles(options.binaryDir + "/chrome", "mailnewstest.manifest")
- else:
- copyChromeFiles(options.binaryDir + "/chrome")
- createManifest(options.binaryDir + "/chrome", "mailnewstest.manifest")
- setUpCommonMailNews.copyCommonProfileFiles(options.profileDir)
-
- print "setUpBloatTest.py completed succesfully"
-
-#########
-# DO IT #
-#########
-
-if __name__ == "__main__":
- main()
deleted file mode 100644
--- a/mailnews/test/performance/common/setUpCommonMailNews.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla MailNews test code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Messaging.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Mark Banner <bugzilla@standard8.plus.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-import shutil
-
-def copyCommonProfileFiles(destination):
- # Copy our bloat prefs file straight over the generated prefs.js
- shutil.copy("../common/mailnewsTestPrefs.js", destination + "/prefs.js")
- # Nothing else to do yet
-
-def AddCommonOptions(self, defaults):
- self.add_option("--binary-dir",
- action = "store", type = "string", dest = "binaryDir",
- help = "path to the application binary")
- defaults["binaryDir"] = ""
-
- self.add_option("--profile-dir",
- action = "store", type = "string", dest = "profileDir",
- help = "path to the test profile")
- defaults["profileDir"] = ""
-
- # -h, --help are automatically handled by OptionParser
-
- self.set_defaults(**defaults)
-
- usage = """\
-Usage instructions for setUpBloatTest.py.
---binary-dir and --profile-dir must be specified.
-"""
- self.set_usage(usage)