mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 421611 - Need to be able to run tests on arbitrary build - add packaging bits for xpcshell. r=bsmedberg
--HG-- rename : intl/strres/tests/397093.properties => intl/strres/tests/unit/397093.properties rename : intl/strres/tests/strres.properties => intl/strres/tests/unit/strres.properties
This commit is contained in:
parent
1771ccc676
commit
27616db76a
@ -147,6 +147,9 @@ SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-inter
|
||||
|
||||
libs::
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl \
|
||||
$(testxpcobjdir)/all-test-dirs.list \
|
||||
$(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
|
||||
|
||||
testxpcsrcdir = $(topsrcdir)/testing/xpcshell
|
||||
|
||||
@ -155,7 +158,6 @@ check::
|
||||
$(PYTHON) -u \
|
||||
$(testxpcsrcdir)/runxpcshelltests.py \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
# Execute a single test, specified in $(SOLO_FILE), but don't automatically
|
||||
@ -167,7 +169,6 @@ check-interactive::
|
||||
--test=$(SOLO_FILE) \
|
||||
--interactive \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
# Execute a single test, specified in $(SOLO_FILE)
|
||||
@ -176,7 +177,6 @@ check-one::
|
||||
$(testxpcsrcdir)/runxpcshelltests.py \
|
||||
--test=$(SOLO_FILE) \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
endif # XPCSHELL_TESTS
|
||||
|
@ -35,7 +35,7 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../../../
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
@ -46,16 +46,4 @@ MODULE = test_intl_strres
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
EXPORT_RESOURCE = \
|
||||
$(srcdir)/strres.properties \
|
||||
$(srcdir)/397093.properties \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs::
|
||||
$(INSTALL) $(EXPORT_RESOURCE) $(DIST)/bin/res
|
||||
|
||||
install::
|
||||
$(SYSINSTALL) $(IFLAGS1) $(EXPORT_RESOURCE) $(DESTDIR)$(mozappdir)/res
|
||||
|
||||
|
@ -31,8 +31,11 @@ function run_test() {
|
||||
var StringBundle =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var bundleURI = ios.newFileURI(do_get_file("strres.properties"));
|
||||
|
||||
var bundle = StringBundle.createBundle("resource://gre/res/strres.properties");
|
||||
var bundle = StringBundle.createBundle(bundleURI.spec);
|
||||
|
||||
var bundle_file = bundle.GetStringFromName(name_file);
|
||||
do_check_eq(bundle_file, value_file);
|
||||
|
@ -18,8 +18,11 @@ function run_test() {
|
||||
var StringBundle =
|
||||
Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var bundleURI = ios.newFileURI(do_get_file("397093.properties"));
|
||||
|
||||
var bundle = StringBundle.createBundle("resource://gre/res/397093.properties");
|
||||
var bundle = StringBundle.createBundle(bundleURI.spec);
|
||||
|
||||
var bundle_ascii="", bundle_utf8="", bundle_latin1="";
|
||||
try {
|
||||
|
@ -147,6 +147,9 @@ SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-inter
|
||||
|
||||
libs::
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
|
||||
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl \
|
||||
$(testxpcobjdir)/all-test-dirs.list \
|
||||
$(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
|
||||
|
||||
testxpcsrcdir = $(topsrcdir)/testing/xpcshell
|
||||
|
||||
@ -155,7 +158,6 @@ check::
|
||||
$(PYTHON) -u \
|
||||
$(testxpcsrcdir)/runxpcshelltests.py \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
# Execute a single test, specified in $(SOLO_FILE), but don't automatically
|
||||
@ -167,7 +169,6 @@ check-interactive::
|
||||
--test=$(SOLO_FILE) \
|
||||
--interactive \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
# Execute a single test, specified in $(SOLO_FILE)
|
||||
@ -176,7 +177,6 @@ check-one::
|
||||
$(testxpcsrcdir)/runxpcshelltests.py \
|
||||
--test=$(SOLO_FILE) \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
|
||||
|
||||
endif # XPCSHELL_TESTS
|
||||
|
@ -55,7 +55,7 @@ var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
// pluginreg.dat from
|
||||
function createProfileFolder() {
|
||||
// Remove '/unit/*.js'.
|
||||
gProfD = __LOCATION__.parent.parent;
|
||||
gProfD = do_get_cwd();
|
||||
gProfD.append("profile");
|
||||
|
||||
if (gProfD.exists())
|
||||
|
@ -117,11 +117,11 @@ endif
|
||||
PKG_STAGE = $(DIST)/test-package-stage
|
||||
|
||||
stage-package:
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/plugins
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins
|
||||
@(cd $(DEPTH)/_tests/testing/mochitest/ && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mochitest && tar -xf -)
|
||||
@(cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_BINS)) | (cd $(PKG_STAGE)/bin && tar -xf -)
|
||||
@(cd $(DIST)/bin/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)
|
||||
@(cd $(topsrcdir)/build/pgo/certs && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/certs && tar -xf -)
|
||||
ifdef MOZ_PLUGINS
|
||||
@(cd $(DIST)/bin/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/plugins && tar -xf -)
|
||||
@(cd $(DIST)/bin/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/bin/plugins && tar -xf -)
|
||||
endif
|
||||
|
@ -85,7 +85,7 @@ include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
|
||||
|
||||
PKG_STAGE = $(DIST)/test-package-stage
|
||||
|
||||
package-tests: stage-mochitest stage-reftest
|
||||
package-tests: stage-mochitest stage-reftest stage-xpcshell
|
||||
@(cd $(PKG_STAGE) && tar $(TAR_CREATE_FLAGS) - *) | bzip2 -f > $(DIST)/$(PKG_PATH)$(TEST_PACKAGE)
|
||||
|
||||
make-stage-dir:
|
||||
@ -97,5 +97,9 @@ stage-mochitest: make-stage-dir
|
||||
stage-reftest: make-stage-dir
|
||||
$(MAKE) -C $(DEPTH)/layout/tools/reftest stage-package
|
||||
|
||||
stage-xpcshell: make-stage-dir
|
||||
$(MAKE) -C $(DEPTH)/testing/xpcshell stage-package
|
||||
|
||||
.PHONY: mochitest mochitest-plain mochitest-chrome mochitest-a11y \
|
||||
package-tests make-stage-dir stage-mochitest
|
||||
reftest crashtest package-tests make-stage-dir stage-mochitest \
|
||||
stage-reftest stage-xpcshell
|
||||
|
@ -52,3 +52,25 @@ DIRS += example
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Harness files from the srcdir
|
||||
TEST_HARNESS_FILES := \
|
||||
runxpcshelltests.py \
|
||||
head.js \
|
||||
tail.js \
|
||||
$(NULL)
|
||||
|
||||
# Components / typelibs that don't get packaged with
|
||||
# the build, but that we need for the test harness.
|
||||
TEST_HARNESS_COMPONENTS := \
|
||||
httpd.js \
|
||||
$(NULL)
|
||||
|
||||
# Rules for staging the necessary harness bits for a test package
|
||||
PKG_STAGE = $(DIST)/test-package-stage
|
||||
|
||||
stage-package:
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/xpcshell/tests
|
||||
@(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -)
|
||||
@(cd $(DEPTH)/_tests/xpcshell/ && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/xpcshell/tests && tar -xf -)
|
||||
@(cd $(DIST)/bin/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)
|
||||
|
@ -41,13 +41,34 @@ from glob import glob
|
||||
from optparse import OptionParser
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
def runTests(xpcshell, topsrcdir, testdirs, xrePath=None, testFile=None,
|
||||
interactive=False):
|
||||
def readManifest(manifest):
|
||||
"""Given a manifest file containing a list of test directories,
|
||||
return a list of absolute paths to the directories contained within."""
|
||||
manifestdir = os.path.dirname(manifest)
|
||||
testdirs = []
|
||||
try:
|
||||
f = open(manifest, "r")
|
||||
for line in f:
|
||||
dir = line.rstrip()
|
||||
path = os.path.join(manifestdir, dir)
|
||||
if os.path.isdir(path):
|
||||
testdirs.append(path)
|
||||
f.close()
|
||||
except:
|
||||
pass # just eat exceptions
|
||||
return testdirs
|
||||
|
||||
def runTests(xpcshell, testdirs=[], xrePath=None, testFile=None,
|
||||
manifest=None, interactive=False, keepGoing=False):
|
||||
"""Run the tests in |testdirs| using the |xpcshell| executable.
|
||||
If provided, |xrePath| is the path to the XRE to use. If provided,
|
||||
|testFile| indicates a single test to run. |interactive|, if set to True,
|
||||
indicates to provide an xpcshell prompt instead of automatically executing
|
||||
the test."""
|
||||
|xrePath|, if provided, is the path to the XRE to use.
|
||||
|testFile|, if provided, indicates a single test to run.
|
||||
|manifeest|, if provided, is a file containing a list of
|
||||
test directories to run.
|
||||
|interactive|, if set to True, indicates to provide an xpcshell prompt
|
||||
instead of automatically executing the test.
|
||||
|keepGoing|, if set to True, indicates that if a test fails
|
||||
execution should continue."""
|
||||
testharnessdir = os.path.dirname(os.path.abspath(__file__))
|
||||
xpcshell = os.path.abspath(xpcshell)
|
||||
# we assume that httpd.js lives in components/ relative to xpcshell
|
||||
@ -57,8 +78,14 @@ def runTests(xpcshell, topsrcdir, testdirs, xrePath=None, testFile=None,
|
||||
# Make assertions fatal
|
||||
env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
|
||||
|
||||
if not testdirs and not manifest:
|
||||
# nothing to test!
|
||||
raise Exception("No test dirs or test manifest specified!")
|
||||
|
||||
if xrePath is None:
|
||||
xrePath = os.path.dirname(xpcshell)
|
||||
else:
|
||||
xrePath = os.path.abspath(xrePath)
|
||||
if sys.platform == 'win32':
|
||||
env["PATH"] = env["PATH"] + ";" + xrePath
|
||||
elif sys.platform == 'osx':
|
||||
@ -82,6 +109,11 @@ def runTests(xpcshell, topsrcdir, testdirs, xrePath=None, testFile=None,
|
||||
bits = testFile.split('/', 1)
|
||||
singleDir = bits[0]
|
||||
testFile = bits[1]
|
||||
|
||||
if manifest is not None:
|
||||
testdirs = readManifest(os.path.abspath(manifest))
|
||||
|
||||
success = True
|
||||
for testdir in testdirs:
|
||||
if singleDir and singleDir != os.path.basename(testdir):
|
||||
continue
|
||||
@ -116,7 +148,6 @@ def runTests(xpcshell, topsrcdir, testdirs, xrePath=None, testFile=None,
|
||||
full_args = args + headfiles + testheadfiles \
|
||||
+ ['-f', test] \
|
||||
+ tailfiles + testtailfiles + interactiveargs
|
||||
#print "args: %s" % full_args
|
||||
proc = Popen(full_args, stdout=pstdout, stderr=pstderr,
|
||||
env=env, cwd=testdir)
|
||||
stdout, stderr = proc.communicate()
|
||||
@ -131,10 +162,12 @@ def runTests(xpcshell, topsrcdir, testdirs, xrePath=None, testFile=None,
|
||||
>>>>>>>
|
||||
%s
|
||||
<<<<<<<""" % (test, test, stdout)
|
||||
return False
|
||||
|
||||
print "TEST-PASS | %s | all tests passed" % test
|
||||
return True
|
||||
if not keepGoing:
|
||||
return False
|
||||
success = False
|
||||
else:
|
||||
print "TEST-PASS | %s | all tests passed" % test
|
||||
return success
|
||||
|
||||
def main():
|
||||
"""Process command line arguments and call runTests() to do the real work."""
|
||||
@ -143,22 +176,36 @@ def main():
|
||||
action="store", type="string", dest="xrePath", default=None,
|
||||
help="absolute path to directory containing XRE (probably xulrunner)")
|
||||
parser.add_option("--test",
|
||||
action="store", type="string", dest="testFile", default=None,
|
||||
help="single test filename to test")
|
||||
action="store", type="string", dest="testFile",
|
||||
default=None, help="single test filename to test")
|
||||
parser.add_option("--interactive",
|
||||
action="store_true", dest="interactive", default=False,
|
||||
help="don't automatically run tests, drop to an xpcshell prompt")
|
||||
parser.add_option("--keep-going",
|
||||
action="store_true", dest="keepGoing", default=False,
|
||||
help="continue running tests past the first failure")
|
||||
parser.add_option("--manifest",
|
||||
action="store", type="string", dest="manifest",
|
||||
default=None, help="Manifest of test directories to use")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if len(args) < 3:
|
||||
print >>sys.stderr, "Usage: %s <path to xpcshell> <topsrcdir> <test dirs>" % sys.argv[0]
|
||||
if len(args) < 2 and options.manifest is None or \
|
||||
(len(args) < 1 and options.manifest is not None):
|
||||
print >>sys.stderr, """Usage: %s <path to xpcshell> <test dirs>
|
||||
or: %s --manifest=test.manifest <path to xpcshell>""" % (sys.argv[0],
|
||||
sys.argv[0])
|
||||
sys.exit(1)
|
||||
|
||||
if options.interactive and not options.testFile:
|
||||
print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
|
||||
sys.exit(1)
|
||||
|
||||
if not runTests(args[0], args[1], args[2:], xrePath=options.xrePath, testFile=options.testFile, interactive=options.interactive):
|
||||
if not runTests(args[0], testdirs=args[1:],
|
||||
xrePath=options.xrePath,
|
||||
testFile=options.testFile,
|
||||
interactive=options.interactive,
|
||||
keepGoing=options.keepGoing,
|
||||
manifest=options.manifest):
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -186,7 +186,7 @@ xhr.prototype = {
|
||||
function remove_dirs_and_files () {
|
||||
var fileLocator = AUS_Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(AUS_Ci.nsIProperties);
|
||||
var dir = fileLocator.get("XCurProcD", AUS_Ci.nsIFile);
|
||||
var dir = fileLocator.get("GreD", AUS_Ci.nsIFile);
|
||||
|
||||
var file = dir.clone();
|
||||
file.append("active-update.xml");
|
||||
|
@ -77,7 +77,7 @@ function run_test() {
|
||||
testFile.append("text1");
|
||||
testFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||
|
||||
var binDir = fileLocator.get("XCurProcD", AUS_Ci.nsIFile);
|
||||
var binDir = fileLocator.get("GreD", AUS_Ci.nsIFile);
|
||||
|
||||
// The updater binary file
|
||||
gUpdater = binDir.clone();
|
||||
|
@ -67,3 +67,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
export PERSONAL_MAILCAP=$(shell cd $(srcdir) && pwd)/mailcap
|
||||
endif
|
||||
|
||||
# need the executable for running the xpcshell unit tests
|
||||
libs::
|
||||
$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(MODULE)/unit
|
||||
|
@ -44,7 +44,7 @@ function checkFile() {
|
||||
// This is where we expect the output
|
||||
var tempFile = Components.classes["@mozilla.org/file/local;1"].
|
||||
createInstance(Components.interfaces.nsILocalFile);
|
||||
tempFile = HandlerServiceTest._dirSvc.get("CurProcD", Components.interfaces.nsIFile);
|
||||
tempFile = do_get_cwd();
|
||||
tempFile.append(kOutputFile);
|
||||
|
||||
if (!tempFile.exists())
|
||||
@ -102,7 +102,7 @@ function run_test() {
|
||||
localHandler.name = "Test Local Handler App";
|
||||
|
||||
// WriteArgument will just dump its arguments to a file for us.
|
||||
var processDir = HandlerServiceTest._dirSvc.get("CurProcD", Components.interfaces.nsIFile);
|
||||
var processDir = do_get_cwd();
|
||||
var exe = processDir.clone();
|
||||
exe.append("WriteArgument");
|
||||
|
||||
@ -123,9 +123,12 @@ function run_test() {
|
||||
// The Write Argument file needs to know where its libraries are, so
|
||||
// just force the path variable
|
||||
// For mac
|
||||
envSvc.set("DYLD_LIBRARY_PATH", processDir.path);
|
||||
// For Linux/Windows
|
||||
envSvc.set("LD_LIBRARY_PATH", processDir.path);
|
||||
var greDir = HandlerServiceTest._dirSvc.get("GreD", Components.interfaces.nsIFile);
|
||||
|
||||
envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
|
||||
// For Linux
|
||||
envSvc.set("LD_LIBRARY_PATH", greDir.path);
|
||||
//XXX: handle windows
|
||||
|
||||
// Now tell it where we want the file.
|
||||
envSvc.set("WRITE_ARGUMENT_FILE", outFile.path);
|
||||
|
@ -152,6 +152,7 @@ LOCAL_INCLUDES = \
|
||||
|
||||
libs::
|
||||
$(INSTALL) $(srcdir)/test.properties $(DIST)/bin/res
|
||||
$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(MODULE)/unit
|
||||
|
||||
# Copy TestHarness.h into its own module, for ease of setting up includes
|
||||
# correctly.
|
||||
|
@ -35,22 +35,30 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
// nsIProcess unit test
|
||||
|
||||
// get the path to {objdir}/dist/bin
|
||||
var bindir = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("CurProcD", Components.interfaces.nsIFile);
|
||||
|
||||
// the the os
|
||||
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
|
||||
|
||||
var filePrefix = "";
|
||||
var fileSuffix = "";
|
||||
function get_test_program(prog)
|
||||
{
|
||||
var progPath = do_get_cwd();
|
||||
progPath.append(prog);
|
||||
if (isWindows) {
|
||||
progPath.leafName = progPath.leafName + ".exe";
|
||||
}
|
||||
return progPath;
|
||||
}
|
||||
|
||||
if (isWindows) {
|
||||
filePrefix = bindir.path + "\\";
|
||||
fileSuffix = ".exe";
|
||||
} else {
|
||||
filePrefix = bindir.path + "/";
|
||||
function set_environment()
|
||||
{
|
||||
var envSvc = Components.classes["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||
getService(Components.interfaces.nsIProperties);
|
||||
var greDir = dirSvc.get("GreD", Components.interfaces.nsIFile);
|
||||
|
||||
envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
|
||||
// For Linux
|
||||
envSvc.set("LD_LIBRARY_PATH", greDir.path);
|
||||
//XXX: handle windows
|
||||
}
|
||||
|
||||
|
||||
@ -58,17 +66,12 @@ if (isWindows) {
|
||||
// and then killed
|
||||
function test_kill()
|
||||
{
|
||||
var testapp = filePrefix + "TestBlockingProcess" +fileSuffix;
|
||||
print(testapp);
|
||||
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(testapp);
|
||||
var file = get_test_program("TestBlockingProcess");
|
||||
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
process.init(file);
|
||||
|
||||
|
||||
do_check_false(process.isRunning);
|
||||
|
||||
try {
|
||||
@ -96,11 +99,7 @@ function test_kill()
|
||||
// guaranteed to return an exit value of 42
|
||||
function test_quick()
|
||||
{
|
||||
var testapp = filePrefix + "TestQuickReturn" + fileSuffix;
|
||||
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(testapp);
|
||||
var file = get_test_program("TestQuickReturn");
|
||||
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
@ -116,11 +115,7 @@ function test_quick()
|
||||
// that will return -1 if "mozilla" is not the first argument
|
||||
function test_arguments()
|
||||
{
|
||||
var testapp = filePrefix + "TestArguments" + fileSuffix;
|
||||
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(testapp);
|
||||
var file = get_test_program("TestArguments");
|
||||
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
@ -140,12 +135,8 @@ var gProcess;
|
||||
// run non-blocking
|
||||
function test_nonblocking()
|
||||
{
|
||||
var testapp = filePrefix + "TestQuickReturn" + fileSuffix;
|
||||
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(testapp);
|
||||
|
||||
var file = get_test_program("TestQuickReturn");
|
||||
|
||||
gProcess = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
gProcess.init(file);
|
||||
@ -168,6 +159,7 @@ function check_nonblocking()
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
set_environment();
|
||||
test_kill();
|
||||
test_quick();
|
||||
test_arguments();
|
||||
|
Loading…
x
Reference in New Issue
Block a user