зеркало из https://github.com/mozilla/pjs.git
Bug 351968 - Don't copy xpcshell tests and other data to $(DIST) -- a step toward being able to --enable-tests on Mozilla tinderboxen. r=bsmedberg
This commit is contained in:
Родитель
40b57e78e1
Коммит
df236c24ab
|
@ -36,15 +36,6 @@
|
|||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# Makefile for installing and running xpcshell-based tests. You can use
|
||||
# this file as template when creating tests for a new module. Don't
|
||||
# forget to change the lines marked below. See
|
||||
# http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
|
||||
# for detailed instructions.
|
||||
#
|
||||
|
||||
# Note: DEPTH should be set to the relative path to mozilla/
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
@ -52,21 +43,12 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# Note: set the test module's name to test_<yourmodule>
|
||||
MODULE = test_places
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
ifndef MOZ_PLACES_BOOKMARKS
|
||||
_UNIT_FILES := $(patsubst %marks.js,,$(_UNIT_FILES))
|
||||
_UNIT_FILES += $(wildcard $(srcdir)/unit/head*.js)
|
||||
_UNIT_FILES += $(wildcard $(srcdir)/unit/tail*.js)
|
||||
ifdef MOZ_PLACES_BOOKMARKS
|
||||
XPCSHELL_TESTS += bookmarks
|
||||
endif
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/$(MODULE)
|
||||
|
||||
# Note: Invoke any additional (non-xpcshell) test programs here.
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/$(MODULE)
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 Places.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
* Dietrich Ayala <dietrich@mozilla.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 ***** */
|
||||
|
||||
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
|
||||
// If there's no location registered for the profile direcotry, register one now.
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
var profileDir = null;
|
||||
try {
|
||||
profileDir = dirSvc.get(NS_APP_USER_PROFILE_50_DIR, Ci.nsIFile);
|
||||
} catch (e) {}
|
||||
if (!profileDir) {
|
||||
// Register our own provider for the profile directory.
|
||||
// It will simply return the current directory.
|
||||
var provider = {
|
||||
getFile: function(prop, persistent) {
|
||||
persistent.value = true;
|
||||
if (prop == NS_APP_USER_PROFILE_50_DIR) {
|
||||
return dirSvc.get("CurProcD", Ci.nsIFile);
|
||||
}
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
|
||||
iid.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
dirSvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
|
||||
}
|
||||
|
||||
var iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
function uri(spec) {
|
||||
return iosvc.newURI(spec, null, null);
|
||||
}
|
||||
|
||||
// Delete a previously created sqlite file
|
||||
function clearDB() {
|
||||
try {
|
||||
var file = dirSvc.get('ProfD', Ci.nsIFile);
|
||||
file.append("places.sqlite");
|
||||
if (file.exists())
|
||||
file.remove(false);
|
||||
} catch(ex) { dump("Exception: " + ex); }
|
||||
}
|
||||
clearDB();
|
|
@ -0,0 +1,299 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Google Inc.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Darin Fisher <darin@meer.net>
|
||||
* Dietrich Ayala <dietrich@mozilla.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 ***** */
|
||||
|
||||
// Get bookmark service
|
||||
try {
|
||||
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
|
||||
} catch(ex) {
|
||||
do_throw("Could not get nav-bookmarks-service\n");
|
||||
}
|
||||
|
||||
// create and add bookmarks observer
|
||||
var observer = {
|
||||
onBeginUpdateBatch: function() {
|
||||
this._beginUpdateBatch = true;
|
||||
},
|
||||
onEndUpdateBatch: function() {
|
||||
this._endUpdateBatch = true;
|
||||
},
|
||||
onItemAdded: function(uri, folder, index) {
|
||||
this._itemAdded = uri;
|
||||
this._itemAddedFolder = folder;
|
||||
this._itemAddedIndex = index;
|
||||
},
|
||||
onItemRemoved: function(uri, folder, index) {
|
||||
this._itemRemoved = uri;
|
||||
this._itemRemovedFolder = folder;
|
||||
this._itemRemovedIndex = index;
|
||||
},
|
||||
/* XXXDietrich - vestigial? is not currently in nsINavBookmarksService
|
||||
onItemMoved: function(uri, folder, oldIndex, newIndex) {
|
||||
this._itemMoved = uri;
|
||||
this._itemMovedFolder = folder;
|
||||
this._itemMovedOldIndex = oldIndex;
|
||||
this._itemMovedNewIndex = newIndex;
|
||||
},
|
||||
*/
|
||||
onItemChanged: function(uri, property, value) {
|
||||
this._itemChanged = uri;
|
||||
this._itemChangedProperty = property;
|
||||
this._itemChangedValue = value;
|
||||
},
|
||||
onItemVisited: function(uri, visitID, time) {
|
||||
this._itemVisited = uri;
|
||||
this._itemVisitedID = visitID;
|
||||
this._itemVisitedTime = time;
|
||||
},
|
||||
onItemReplaced: function(folder, oldItem, newItem) {
|
||||
this._itemReplacedFolder = folder;
|
||||
this._itemReplaced = oldItem;
|
||||
this._itemReplacedNew = newItem;
|
||||
},
|
||||
onFolderAdded: function(folder, parent, index) {
|
||||
this._folderAdded = folder;
|
||||
this._folderAddedParent = parent;
|
||||
this._folderAddedIndex = index;
|
||||
},
|
||||
onFolderRemoved: function(folder, parent, index) {
|
||||
this._folderRemoved = folder;
|
||||
this._folderRemovedParent = parent;
|
||||
this._folderRemovedIndex = index;
|
||||
},
|
||||
onFolderMoved: function(folder, oldParent, oldIndex, newParent, newIndex) {
|
||||
this._folderMoved = folder;
|
||||
this._folderMovedOldParent = oldParent;
|
||||
this._folderMovedOldIndex = oldIndex;
|
||||
this._folderMovedNewParent = newParent;
|
||||
this._folderMovedNewIndex = newIndex;
|
||||
},
|
||||
onFolderChanged: function(folder, property) {
|
||||
this._folderChanged = folder;
|
||||
this._folderChangedProperty = property;
|
||||
},
|
||||
onSeparatorAdded: function(folder, index) {
|
||||
this._separatorAdded = folder;
|
||||
this._separatorAddedIndex = index;
|
||||
},
|
||||
onSeparatorRemoved: function(folder, index) {
|
||||
this._separatorRemoved = folder;
|
||||
this._separatorRemovedIndex = index;
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsINavBookmarkObserver) ||
|
||||
iid.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
};
|
||||
bmsvc.addObserver(observer, false);
|
||||
|
||||
// get bookmarks root index
|
||||
var root = bmsvc.bookmarksRoot;
|
||||
|
||||
// index at which items should begin
|
||||
var bmStartIndex = 3
|
||||
|
||||
// main
|
||||
function run_test() {
|
||||
// insert item
|
||||
bmsvc.insertItem(root, uri("http://google.com/"), -1);
|
||||
do_check_eq(observer._itemAdded.spec, "http://google.com/");
|
||||
do_check_eq(observer._itemAddedFolder, root);
|
||||
do_check_eq(observer._itemAddedIndex, bmStartIndex);
|
||||
|
||||
// change item
|
||||
bmsvc.setItemTitle(uri("http://google.com/"), "Google");
|
||||
do_check_eq(observer._itemChanged.spec, "http://google.com/");
|
||||
do_check_eq(observer._itemChangedProperty, "title");
|
||||
|
||||
// create folder
|
||||
var workFolder = bmsvc.createFolder(root, "Work", 3);
|
||||
do_check_eq(observer._folderAdded, workFolder);
|
||||
do_check_eq(observer._folderAddedParent, root);
|
||||
do_check_eq(observer._folderAddedIndex, 3);
|
||||
|
||||
// insert item
|
||||
bmsvc.insertItem(workFolder, uri("http://developer.mozilla.org/"), 0);
|
||||
do_check_eq(observer._itemAdded.spec, "http://developer.mozilla.org/");
|
||||
do_check_eq(observer._itemAddedFolder, workFolder);
|
||||
do_check_eq(observer._itemAddedIndex, 0);
|
||||
|
||||
// change item
|
||||
bmsvc.setItemTitle(uri("http://developer.mozilla.org/"), "DevMo");
|
||||
do_check_eq(observer._itemChanged.spec, "http://developer.mozilla.org/");
|
||||
do_check_eq(observer._itemChangedProperty, "title");
|
||||
|
||||
// insert item
|
||||
bmsvc.insertItem(workFolder, uri("http://msdn.microsoft.com/"), -1);
|
||||
do_check_eq(observer._itemAdded.spec, "http://msdn.microsoft.com/");
|
||||
do_check_eq(observer._itemAddedFolder, workFolder);
|
||||
do_check_eq(observer._itemAddedIndex, 1);
|
||||
|
||||
// change item
|
||||
bmsvc.setItemTitle(uri("http://msdn.microsoft.com/"), "MSDN");
|
||||
do_check_eq(observer._itemChanged.spec, "http://msdn.microsoft.com/");
|
||||
do_check_eq(observer._itemChangedProperty, "title");
|
||||
|
||||
// remove item
|
||||
bmsvc.removeItem(workFolder, uri("http://developer.mozilla.org/"));
|
||||
do_check_eq(observer._itemRemoved.spec, "http://developer.mozilla.org/");
|
||||
do_check_eq(observer._itemRemovedFolder, workFolder);
|
||||
do_check_eq(observer._itemRemovedIndex, 0);
|
||||
|
||||
// insert item
|
||||
bmsvc.insertItem(workFolder, uri("http://developer.mozilla.org/"), -1);
|
||||
do_check_eq(observer._itemAdded.spec, "http://developer.mozilla.org/");
|
||||
do_check_eq(observer._itemAddedFolder, workFolder);
|
||||
do_check_eq(observer._itemAddedIndex, 1);
|
||||
|
||||
// replace item
|
||||
bmsvc.replaceItem(workFolder, uri("http://developer.mozilla.org/"),
|
||||
uri("http://developer.mozilla.org/devnews/"));
|
||||
do_check_eq(observer._itemReplaced.spec, "http://developer.mozilla.org/");
|
||||
do_check_eq(observer._itemReplacedNew.spec, "http://developer.mozilla.org/devnews/");
|
||||
do_check_eq(observer._itemReplacedFolder, workFolder);
|
||||
|
||||
// create folder
|
||||
var homeFolder = bmsvc.createFolder(root, "Home", -1);
|
||||
do_check_eq(observer._folderAdded, homeFolder);
|
||||
do_check_eq(observer._folderAddedParent, root);
|
||||
do_check_eq(observer._folderAddedIndex, 5);
|
||||
|
||||
// insert item
|
||||
bmsvc.insertItem(homeFolder, uri("http://espn.com/"), 0);
|
||||
do_check_eq(observer._itemAdded.spec, "http://espn.com/");
|
||||
do_check_eq(observer._itemAddedFolder, homeFolder);
|
||||
do_check_eq(observer._itemAddedIndex, 0);
|
||||
|
||||
// change item
|
||||
bmsvc.setItemTitle(uri("http://espn.com/"), "ESPN");
|
||||
do_check_eq(observer._itemChanged.spec, "http://espn.com/");
|
||||
do_check_eq(observer._itemChangedProperty, "title");
|
||||
|
||||
// insert item
|
||||
bmsvc.insertItem(root, uri("place:domain=google.com&group=1"), -1);
|
||||
do_check_eq(observer._itemAdded.spec, "place:domain=google.com&group=1");
|
||||
do_check_eq(observer._itemAddedFolder, root);
|
||||
do_check_eq(observer._itemAddedIndex, 6);
|
||||
|
||||
// change item
|
||||
bmsvc.setItemTitle(uri("place:domain=google.com&group=1"), "Google Sites");
|
||||
do_check_eq(observer._itemChanged.spec, "place:domain=google.com&group=1");
|
||||
do_check_eq(observer._itemChangedProperty, "title");
|
||||
|
||||
// move folder
|
||||
bmsvc.moveFolder(workFolder, root, -1);
|
||||
do_check_eq(observer._folderMoved, workFolder);
|
||||
do_check_eq(observer._folderMovedOldParent, root);
|
||||
do_check_eq(observer._folderMovedOldIndex, 3);
|
||||
do_check_eq(observer._folderMovedNewParent, root);
|
||||
do_check_eq(observer._folderMovedNewIndex, 6);
|
||||
|
||||
// Test expected failure of moving a folder to be its own parent
|
||||
try {
|
||||
bmsvc.moveFolder(workFolder, workFolder, -1);
|
||||
do_throw("moveFolder() allowed moving a folder to be it's own parent.");
|
||||
} catch (e) {}
|
||||
do_check_eq(bmsvc.indexOfItem(root, uri("http://google.com/")), 3);
|
||||
do_check_eq(bmsvc.indexOfFolder(root, workFolder), 6);
|
||||
}
|
||||
|
||||
// XXX test folderReadOnly
|
||||
// XXXDietrich - get this section up to date
|
||||
|
||||
/// EXPECTED TABLE RESULTS
|
||||
/// moz_bookmarks:
|
||||
/// item_child folder_child parent position
|
||||
/// ---------- ------------ ------ --------
|
||||
/// 1 0 0
|
||||
/// 2 1 4
|
||||
/// 3 1 3
|
||||
/// 1 1 0
|
||||
/// 2 1 1
|
||||
/// 3 1 2
|
||||
/// 4 2 0
|
||||
/// 4 4 0
|
||||
/// 5 4 1
|
||||
/// 6 4 2
|
||||
/// 7 4 3
|
||||
/// 8 4 4
|
||||
/// 9 4 5
|
||||
/// 10 4 6
|
||||
/// 11 4 7
|
||||
/// 12 2 1
|
||||
/// 5 2 4
|
||||
/// 14 5 0
|
||||
/// 15 5 1
|
||||
/// 6 2 2
|
||||
/// 16 6 0
|
||||
/// 17 2 3
|
||||
///
|
||||
/// moz_history:
|
||||
/// id url
|
||||
/// -- ------------------------
|
||||
/// 1 place: // Viewed today
|
||||
/// 2 place: // Viewed past week
|
||||
/// 3 place: // All pages
|
||||
/// 4 http://start.mozilla.org/firefox
|
||||
/// 5 http://www.mozilla.org/products/firefox/central.html
|
||||
/// 6 http://addons.mozilla.org/?application=firefox
|
||||
/// 7 http://getfirefox.com/
|
||||
/// 8 http://www.mozilla.org/
|
||||
/// 9 http://www.mozillazine.org/
|
||||
/// 10 http://store.mozilla.org/
|
||||
/// 11 http://www.spreadfirefox.com/
|
||||
/// 12 http://google.com/
|
||||
/// 13 http://developer.mozilla.org/
|
||||
/// 14 http://msdn.microsoft.com/
|
||||
/// 15 http://developer.mozilla.org/devnews/
|
||||
/// 16 http://espn.com/
|
||||
/// 17 place: // Google Sites
|
||||
/// 18 place:folder=5&group=3
|
||||
/// 19 place:folder=6&group=3
|
||||
///
|
||||
/// moz_bookmarks_folders:
|
||||
/// id name
|
||||
/// -- -----------------------
|
||||
/// 1
|
||||
/// 2 Bookmarks Menu
|
||||
/// 3 Bookmarks Toolbar
|
||||
/// 4 Firefox and Mozilla Links
|
||||
/// 5 Work
|
||||
/// 6 Home
|
|
@ -23,6 +23,7 @@
|
|||
# Contributor(s):
|
||||
# Chase Phillips <chase@mozilla.org>
|
||||
# Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -397,7 +398,7 @@ endif
|
|||
endif
|
||||
|
||||
#
|
||||
# This will strip out symbols that the component shouldnt be
|
||||
# This will strip out symbols that the component should not be
|
||||
# exporting from the .dynsym section.
|
||||
#
|
||||
ifdef IS_COMPONENT
|
||||
|
@ -1529,7 +1530,7 @@ endif # XPIDLSRCS
|
|||
# General rules for exporting idl files.
|
||||
#
|
||||
# WORK-AROUND ONLY, for mozilla/tools/module-deps/bootstrap.pl build.
|
||||
# Bug to fix idl dependecy problems w/o this extra build pass is
|
||||
# Bug to fix idl dependency problems w/o this extra build pass is
|
||||
# http://bugzilla.mozilla.org/show_bug.cgi?id=145777
|
||||
#
|
||||
$(IDL_DIR)::
|
||||
|
@ -1798,6 +1799,50 @@ REGCHROME_INSTALL = $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/add-ch
|
|||
$(if $(CROSS_COMPILE),-o $(OS_ARCH)) $(DESTDIR)$(mozappdir)/chrome/installed-chrome.txt \
|
||||
$(_JAR_REGCHROME_DISABLE_JAR)
|
||||
|
||||
|
||||
################################################################################
|
||||
# Testing frameworks support
|
||||
################################################################################
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
|
||||
ifdef XPCSHELL_TESTS
|
||||
ifndef MODULE
|
||||
$(error Must define MODULE when defining XPCSHELL_TESTS.)
|
||||
endif
|
||||
|
||||
# Test file installation
|
||||
libs::
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for testdir in $(XPCSHELL_TESTS); do \
|
||||
$(INSTALL) \
|
||||
$(srcdir)/$$testdir/*.js \
|
||||
$(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
|
||||
done
|
||||
|
||||
ifdef CYGWIN_WRAPPER
|
||||
NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)`
|
||||
else
|
||||
NATIVE_TOPSRCDIR := $(topsrcdir)
|
||||
endif # CYGWIN_WRAPPER
|
||||
|
||||
# Test execution
|
||||
check::
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for testdir in $(XPCSHELL_TESTS); do \
|
||||
$(RUN_TEST_PROGRAM) \
|
||||
$(topsrcdir)/tools/test-harness/xpcshell-simple/test_all.sh \
|
||||
$(DIST)/bin/xpcshell \
|
||||
$(topsrcdir) \
|
||||
$(NATIVE_TOPSRCDIR) \
|
||||
$(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
|
||||
done
|
||||
|
||||
endif # XPCSHELL_TESTS
|
||||
|
||||
endif # ENABLE_TESTS
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Dependency system
|
||||
#############################################################################
|
||||
|
|
|
@ -45,17 +45,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = test_content
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := \
|
||||
$(wildcard $(srcdir)/unit/*.js) \
|
||||
$(wildcard $(srcdir)/unit/*.xml) \
|
||||
$(wildcard $(srcdir)/unit/*.xul) \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/content_unit_tests
|
||||
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh \
|
||||
$(DIST)/bin/content_unit_tests
|
||||
|
|
|
@ -61,13 +61,19 @@ function DOMParser() {
|
|||
return C["@mozilla.org/xmlextras/domparser;1"].createInstance(nsIDOMParser);
|
||||
}
|
||||
|
||||
var __testsDirectory = null;
|
||||
|
||||
function ParseFile(file) {
|
||||
if (typeof(file) == "string") {
|
||||
var dirServ = C["@mozilla.org/file/directory_service;1"]
|
||||
.getService(nsIProperties);
|
||||
var dummy = {};
|
||||
var fileObj = dirServ.get("CurProcD", nsILocalFile);
|
||||
fileObj.append("content_unit_tests");
|
||||
if (!__testsDirectory) {
|
||||
__testsDirectory = C["@mozilla.org/file/local;1"]
|
||||
.createInstance(I.nsILocalFile);
|
||||
__testsDirectory.initWithPath(do_get_topsrcdir());
|
||||
__testsDirectory.append("content");
|
||||
__testsDirectory.append("test");
|
||||
__testsDirectory.append("unit");
|
||||
}
|
||||
var fileObj = __testsDirectory.clone();
|
||||
fileObj.append(file);
|
||||
file = fileObj;
|
||||
}
|
||||
|
|
|
@ -52,16 +52,8 @@ ifndef MOZ_XUL_APP
|
|||
DIRS += lite
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/tests/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/embedding_unit_tests
|
||||
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/embedding_unit_tests
|
||||
|
||||
DIRS += tests
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -35,6 +35,10 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = test_embedding
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
DIRS = os2Embed
|
||||
endif
|
||||
|
|
|
@ -51,7 +51,7 @@ XPI_PKGNAME = metrics-$(MOZ_APP_VERSION)
|
|||
DIRS = public src build
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
TOOL_DIRS += test
|
||||
DIRS += test
|
||||
endif
|
||||
|
||||
PREF_JS_EXPORTS = $(srcdir)/metrics.js
|
||||
|
|
|
@ -72,9 +72,9 @@ LIBS = \
|
|||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Give the unit tests absolute paths to the data and temp directories.
|
||||
# For cygwin, we need to convert the paths to native Windows paths.
|
||||
|
@ -86,14 +86,9 @@ TESTDATA_DIR := `cd $(srcdir)/data; pwd`
|
|||
TEST_TMPDIR := `pwd`
|
||||
endif
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/metrics_unit_tests
|
||||
|
||||
check::
|
||||
@echo Running tests...
|
||||
@for f in $(SIMPLE_PROGRAMS); do \
|
||||
echo $$f; $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f \
|
||||
$(TESTDATA_DIR) $(TEST_TMPDIR); \
|
||||
done
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh \
|
||||
$(DIST)/bin/metrics_unit_tests
|
||||
|
|
|
@ -72,7 +72,7 @@ endif
|
|||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef ENABLE_TESTS
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
TOOL_DIRS = tests
|
||||
DIRS += tests
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -42,6 +42,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = test_intl_uconv
|
||||
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
REQUIRES = \
|
||||
|
@ -63,6 +65,8 @@ endif
|
|||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += \
|
||||
|
@ -83,18 +87,3 @@ ifneq ($(OS_RELEASE),1.2)
|
|||
OS_LIBS += /usr/lib/libdl.so
|
||||
endif
|
||||
endif
|
||||
|
||||
# Unit tests
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
_DATA_FILES := $(wildcard $(srcdir)/unit/data/*.txt)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/intl_unit_tests
|
||||
|
||||
libs:: $(_DATA_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/intl_unit_tests/data
|
||||
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/intl_unit_tests
|
||||
|
||||
|
||||
|
|
|
@ -31,10 +31,13 @@ function run_test()
|
|||
"nsIConverterInputStream",
|
||||
"init");
|
||||
|
||||
var dirServ = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
dataDir = dirServ.get("CurProcD", Ci.nsILocalFile);
|
||||
dataDir.append("intl_unit_tests");
|
||||
dataDir = Cc["@mozilla.org/file/local;1"]
|
||||
.getService(Ci.nsILocalFile);
|
||||
dataDir.initWithPath(do_get_topsrcdir());
|
||||
dataDir.append("intl");
|
||||
dataDir.append("uconv");
|
||||
dataDir.append("tests");
|
||||
dataDir.append("unit");
|
||||
dataDir.append("data");
|
||||
|
||||
test_utf8_1();
|
||||
|
|
|
@ -45,13 +45,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = test_libjar
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/$(MODULE)
|
||||
|
||||
check::
|
||||
$(ZIP) -q test_bug333423.zip Makefile
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/$(MODULE)
|
||||
|
|
Двоичный файл не отображается.
|
@ -44,8 +44,14 @@ function run_test() {
|
|||
const Ci = Components.interfaces;
|
||||
|
||||
// the build script have created the zip we can test on in the current dir.
|
||||
var file = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
|
||||
var file = Cc["@mozilla.org/file/local;1"]
|
||||
.createInstance(Ci.nsILocalFile);
|
||||
file.initWithPath(do_get_topsrcdir());
|
||||
file.append("modules");
|
||||
file.append("libjar");
|
||||
file.append("test");
|
||||
file.append("unit");
|
||||
file.append("data");
|
||||
file.append("test_bug333423.zip")
|
||||
dump("Using " + file.path + " for testing\n");
|
||||
|
||||
|
|
|
@ -98,16 +98,12 @@ LIBS = $(EXTRA_DSO_LIBS) \
|
|||
|
||||
DEFINES += $(TK_CFLAGS)
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/necko_unit_tests
|
||||
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCookie
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/necko_unit_tests
|
||||
|
||||
_RES_FILES = urlparse.dat \
|
||||
urlparse_unx.dat \
|
||||
|
|
|
@ -49,33 +49,6 @@ XPIDLSRCS = \
|
|||
nsIHttpServer.idl \
|
||||
$(NULL)
|
||||
|
||||
XPCSHELL_TESTS = test
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/test/*.js)
|
||||
|
||||
_SERVER_SCRIPT_FILES = \
|
||||
httpd.js \
|
||||
$(NULL)
|
||||
|
||||
# copy the server to the xpcshell test harness directory
|
||||
libs:: $(_SERVER_SCRIPT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/test-harness/xpcshell-simple
|
||||
|
||||
#
|
||||
# Server tests don't go in with necko's tests because:
|
||||
#
|
||||
# - we then have to think about file name conflicts in two different locations
|
||||
# - head_*.js files in separate locations are both run, even when this is not
|
||||
# desired (e.g., we must either always import httpd.js [slowing down test
|
||||
# processing even for tests which don't need it] or we must manually import
|
||||
# it in every test that uses it [which would be extremely annoying for the
|
||||
# server tests which all want it])
|
||||
# - httpd.js doesn't clutter the global scope too much, but it does become a
|
||||
# concern (consider Cc/Ci/Cr in particular, which as constants cannot be
|
||||
# safely redefined)
|
||||
#
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/httpserver_tests
|
||||
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/httpserver_tests
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
/**
|
||||
* Constructs a new nsHttpServer instance. This function is intended to
|
||||
|
|
|
@ -173,15 +173,11 @@ var listener =
|
|||
},
|
||||
onStopRequest: function(request, cx, status)
|
||||
{
|
||||
var dirServ;
|
||||
switch (currPathIndex)
|
||||
{
|
||||
case 0:
|
||||
// now set a base path
|
||||
dirServ = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
serverBasePath = dirServ.get("CurProcD", Ci.nsILocalFile);
|
||||
serverBasePath.append("httpserver_tests");
|
||||
serverBasePath = testsDirectory.clone();
|
||||
srv.registerDirectory("/", serverBasePath);
|
||||
break;
|
||||
|
||||
|
@ -204,10 +200,7 @@ var listener =
|
|||
|
||||
case 5:
|
||||
// set the base path again
|
||||
dirServ = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
serverBasePath = dirServ.get("CurProcD", Ci.nsILocalFile);
|
||||
serverBasePath.append("httpserver_tests");
|
||||
serverBasePath = testsDirectory.clone();
|
||||
srv.registerDirectory("/", serverBasePath);
|
||||
break;
|
||||
|
||||
|
@ -230,10 +223,7 @@ var listener =
|
|||
|
||||
case 9:
|
||||
// register /foo/ as a base path
|
||||
dirServ = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
serverBasePath = dirServ.get("CurProcD", Ci.nsILocalFile);
|
||||
serverBasePath.append("httpserver_tests");
|
||||
serverBasePath = testsDirectory.clone();
|
||||
srv.registerDirectory("/foo/", serverBasePath);
|
||||
break;
|
||||
|
||||
|
@ -292,9 +282,18 @@ function performNextTest()
|
|||
|
||||
var srv;
|
||||
var serverBasePath;
|
||||
var testsDirectory;
|
||||
|
||||
function run_test()
|
||||
{
|
||||
testsDirectory = Cc["@mozilla.org/file/local;1"]
|
||||
.createInstance(Ci.nsILocalFile);
|
||||
testsDirectory.initWithPath(do_get_topsrcdir());
|
||||
testsDirectory.append("netwerk");
|
||||
testsDirectory.append("test");
|
||||
testsDirectory.append("httpserver");
|
||||
testsDirectory.append("test");
|
||||
|
||||
srv = createServer();
|
||||
srv.start(4444);
|
||||
|
||||
|
|
|
@ -104,10 +104,14 @@ var srv, serverBasePath;
|
|||
function run_test()
|
||||
{
|
||||
srv = createServer();
|
||||
var dirServ = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
serverBasePath = dirServ.get("CurProcD", Ci.nsILocalFile);
|
||||
serverBasePath.append("httpserver_tests");
|
||||
serverBasePath = Cc["@mozilla.org/file/local;1"]
|
||||
.createInstance(Ci.nsILocalFile);
|
||||
serverBasePath.initWithPath(do_get_topsrcdir());
|
||||
serverBasePath.append("netwerk");
|
||||
serverBasePath.append("test");
|
||||
serverBasePath.append("httpserver");
|
||||
serverBasePath.append("test");
|
||||
serverBasePath.QueryInterface(Ci.nsIFile);
|
||||
srv.registerDirectory("/", serverBasePath);
|
||||
srv.setIndexHandler(myIndexHandler);
|
||||
srv.start(4444);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file tests authentication prompt callbacks
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
const FLAG_RETURN_FALSE = 1 << 0;
|
||||
const FLAG_WRONG_PASSWORD = 1 << 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
var server;
|
||||
var BUGID = "331825";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file tests nsIContentSniffer, introduced in bug 324985
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
const unknownType = "application/x-unknown-content-type";
|
||||
const sniffedType = "application/x-sniffed";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file tests bug 250375
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
function check_request_header(chan, name, value) {
|
||||
var chanValue;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file tests channel event sinks (bug 315598 et al)
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
const sinkCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
|
||||
const sinkContract = "@mozilla.org/network/unittest/channeleventsink;1";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This file ensures that canceling a channel early does not
|
||||
// send the request to the server (bug 350790)
|
||||
|
||||
do_import_script("test-harness/xpcshell-simple/httpd.js");
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
|
||||
const NS_BINDING_ABORTED = 0x804b0002;
|
||||
|
||||
|
|
|
@ -55,13 +55,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
# Note: set the test module's name to test_<yourmodule>
|
||||
MODULE = test_xmlreader
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/$(MODULE)
|
||||
|
||||
# Note: Invoke any additional (non-xpcshell) test programs here.
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/$(MODULE)
|
||||
|
|
|
@ -52,14 +52,3 @@ DIRS += example
|
|||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = test_all.sh
|
||||
_UNIT_FILES = head.js \
|
||||
tail.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/test-harness/xpcshell-simple
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#
|
||||
# Contributor(s):
|
||||
# Boris Zbarsky <bzbarsky@mit.edu> (Original author)
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -55,13 +56,13 @@ include $(DEPTH)/config/autoconf.mk
|
|||
# Note: set the test module's name to test_<yourmodule>
|
||||
MODULE = test_harness_xpcshell_simple
|
||||
|
||||
# This is a list of directories containing tests to run, separated by spaces.
|
||||
# Most likely, tho, you won't use more than one directory here.
|
||||
XPCSHELL_TESTS = \
|
||||
unit \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_UNIT_FILES := $(wildcard $(srcdir)/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/$(MODULE)
|
||||
|
||||
# Note: Invoke any additional (non-xpcshell) test programs here.
|
||||
check::
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/$(MODULE)
|
||||
|
|
|
@ -132,11 +132,15 @@ function do_test_finished() {
|
|||
_do_quit();
|
||||
}
|
||||
|
||||
function do_import_script(distRelativePath) {
|
||||
var scriptPath = environment["DIST"];
|
||||
function do_import_script(topsrcdirRelativePath) {
|
||||
var scriptPath = environment["TOPSRCDIR"];
|
||||
if (scriptPath.charAt(scriptPath.length - 1) != "/")
|
||||
scriptPath += "/";
|
||||
scriptPath += distRelativePath;
|
||||
scriptPath += topsrcdirRelativePath;
|
||||
|
||||
load(scriptPath);
|
||||
}
|
||||
|
||||
function do_get_topsrcdir() {
|
||||
return environment["NATIVE_TOPSRCDIR"];
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
# Contributor(s):
|
||||
# Darin Fisher <darin@meer.net>
|
||||
# Dave Liebreich <davel@mozilla.com>
|
||||
# Jeff Walden <jwalden+code@mit.edu>
|
||||
#
|
||||
# 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
|
||||
|
@ -45,24 +46,45 @@ ulimit -c 20480 2> /dev/null
|
|||
# Make assertions fatal
|
||||
export XPCOM_DEBUG_BREAK=abort
|
||||
|
||||
# MOZILLA_FIVE_HOME is exported by run-mozilla.sh, and is usually $(DIST)/bin
|
||||
# we need to know that dir path in order to find xpcshell
|
||||
bin=${MOZILLA_FIVE_HOME:-`dirname $0`}
|
||||
|
||||
exit_status=0
|
||||
|
||||
# The sample Makefile for the xpcshell-simple harness adds the directory
|
||||
# where the *.js files reside as an arg. If no arg is specified, assume
|
||||
# the current directory is where the *.js files live.
|
||||
testdir="$1"
|
||||
|
||||
##########################
|
||||
# COMMAND-LINE ARGUMENTS #
|
||||
##########################
|
||||
|
||||
# This provides the path to xpcshell.
|
||||
xpcshell="$1"
|
||||
|
||||
# The directory containing Mozilla source code is specified as the first
|
||||
# argument to this script, in a format usable by load() in xpcshell. This
|
||||
# enables do_import_script to work for any JS file in the source tree.
|
||||
topsrcdir="$2"
|
||||
|
||||
# Tests which depend on files in the source directory will need a native path
|
||||
# to actually access those files, or otherwise they must rely on hacks such as
|
||||
# getting the current working/process directory and committing other atrocities.
|
||||
# This argument is a native path to the top-level source directory, useful for
|
||||
# tests which require access to files so that they can access them in a vaguely
|
||||
# clean manner.
|
||||
native_topsrcdir="$3"
|
||||
|
||||
# The sample Makefile for the xpcshell-simple harness adds the directory where
|
||||
# the test_*.js files reside as an arg. If no arg is specified, assume the
|
||||
# current directory is where the *.js files live.
|
||||
testdir="$4"
|
||||
if [ "x$testdir" = "x" ]; then
|
||||
testdir=.
|
||||
fi
|
||||
|
||||
headfiles="-f $bin/test-harness/xpcshell-simple/head.js"
|
||||
|
||||
###############################
|
||||
# SETUP FOR RUNNING THE TESTS #
|
||||
###############################
|
||||
|
||||
# files matching the pattern head_*.js are treated like test setup files
|
||||
# - they are run after head.js but before the test file
|
||||
headfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/head.js"
|
||||
for h in $testdir/head_*.js
|
||||
do
|
||||
if [ -f $h ]; then
|
||||
|
@ -70,9 +92,9 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
tailfiles="-f $bin/test-harness/xpcshell-simple/tail.js"
|
||||
# files matching the pattern tail_*.js are treated like teardown files
|
||||
# - they are run after tail.js
|
||||
tailfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/tail.js"
|
||||
for t in $testdir/tail_*.js
|
||||
do
|
||||
if [ -f $t ]; then
|
||||
|
@ -80,10 +102,15 @@ do
|
|||
fi
|
||||
done
|
||||
|
||||
|
||||
#################
|
||||
# RUN EACH TEST #
|
||||
#################
|
||||
|
||||
for t in $testdir/test_*.js
|
||||
do
|
||||
echo -n "$t: "
|
||||
DIST="$bin" $bin/xpcshell $headfiles -f $t $tailfiles 2> $t.log 1>&2
|
||||
NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell $headfiles -f $t $tailfiles 2> $t.log 1>&2
|
||||
if [ `grep -c '\*\*\* PASS' $t.log` = 0 ]
|
||||
then
|
||||
echo "FAIL"
|
||||
|
|
|
@ -113,6 +113,8 @@ endif
|
|||
|
||||
ENABLE_CXX_EXCEPTIONS = 1
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
|
@ -126,12 +128,6 @@ libs::
|
|||
install::
|
||||
$(SYSINSTALL) $(IFLAGS1) $(srcdir)/test.properties $(DESTDIR)$(mozappdir)/res
|
||||
|
||||
_UNIT_FILES = $(wildcard $(srcdir)/unit/*.js)
|
||||
|
||||
libs:: $(_UNIT_FILES)
|
||||
$(INSTALL) $^ $(DIST)/bin/xpcom_tests
|
||||
|
||||
check::
|
||||
@echo "Running TestVersionComparator tests"
|
||||
@$(PERL) -w $(srcdir)/TestVersionComparatorRunner.pl "$(RUN_TEST_PROGRAM) $(FINAL_TARGET)/TestVersionComparator$(BIN_SUFFIX)"
|
||||
$(RUN_TEST_PROGRAM) $(DIST)/bin/test_all.sh $(DIST)/bin/xpcom_tests
|
||||
|
|
Загрузка…
Ссылка в новой задаче