зеркало из https://github.com/mozilla/pjs.git
Bug 385987 - initial check in of minotaur tool r=robcee
This commit is contained in:
Родитель
503fa1dfe9
Коммит
c447b372df
|
@ -0,0 +1,178 @@
|
|||
# ***** 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 Corporation Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Clint Talbert.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Clint Talbert <ctalbert@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 *****
|
||||
|
||||
import sgmllib
|
||||
import re
|
||||
|
||||
Not_White_Space = re.compile('\S')
|
||||
|
||||
def debug(s):
|
||||
if (0):
|
||||
print s
|
||||
|
||||
# This class parses the bookmark file, making a listing of each
|
||||
# anchor's title, address, and containing folder (if any). It does this by
|
||||
# making use of the fact that the bookmarks.html file has this basic structure
|
||||
# by default
|
||||
# <DL>
|
||||
# <H3>Folder Title</H3>
|
||||
# <A href="link">Link Title</A>
|
||||
# <DL>
|
||||
# <A href="link">Link Title</A>
|
||||
# and so on...
|
||||
# We can depend on the SGML parser to walk sequentially through the file and
|
||||
# call us back when it encounters a starting tag, ending tag, or enclosed data
|
||||
class bookmarkParser(sgmllib.SGMLParser):
|
||||
|
||||
def __init__(self, verbose=0):
|
||||
|
||||
self.marker, self.IN_H3, self.IN_A = range(3)
|
||||
|
||||
sgmllib.SGMLParser.__init__(self, verbose)
|
||||
self.isToolbar = False
|
||||
self.currentFolder = ""
|
||||
self.currentAnchor = ""
|
||||
self.bookmarkList = []
|
||||
|
||||
def parseFile(self, fileName):
|
||||
bkmkFile = open(fileName, "r")
|
||||
htmlContent = bkmkFile.read()
|
||||
self.feed(htmlContent)
|
||||
self.close()
|
||||
|
||||
# This is called when we hit an H3 tag
|
||||
def start_h3(self, attributes):
|
||||
self.marker = self.IN_H3
|
||||
self.isToolbar = False
|
||||
|
||||
for attr in attributes:
|
||||
# Check that we are in the personal toolbar folder
|
||||
if (attr[0] == 'personal_toolbar_folder' and attr[1] == 'true'):
|
||||
self.isToolbar = True
|
||||
|
||||
# Called when an anchor tag is hit
|
||||
def start_a(self, attributes):
|
||||
self.marker = self.IN_A
|
||||
for attr in attributes:
|
||||
if (attr[0] == "href"):
|
||||
debug("Found anchor link: " + attr[1])
|
||||
self.currentAnchor = attr[1]
|
||||
|
||||
# Called when an anchor end tag is hit to reset the current anchor
|
||||
def end_a(self):
|
||||
debug("End A reset")
|
||||
self.currentAnchor = ""
|
||||
|
||||
# Called when text data is encountered
|
||||
def handle_data(self, data):
|
||||
if (Not_White_Space.match(data)):
|
||||
debug("in non-whitespace data")
|
||||
# If we are inside an H3 link we are getting the folder name
|
||||
if self.marker == self.IN_H3:
|
||||
if self.isToolbar:
|
||||
debug("data:h3 is toolbar")
|
||||
self.currentFolder = "toolbar"
|
||||
else:
|
||||
debug("data:h3:not toolbar")
|
||||
self.currentFolder = data
|
||||
|
||||
elif self.marker == self.IN_A:
|
||||
# Then we are inside an anchor tag - we now have the folder,
|
||||
# link and data
|
||||
debug("data:isA adding following: " + self.currentFolder + "," +
|
||||
self.currentAnchor + "," + data)
|
||||
self.bookmarkList.append( (self.currentFolder, self.currentAnchor,
|
||||
data) )
|
||||
|
||||
# We have to include a "start" handler or the end handler won't be called
|
||||
# we really aren't interested in doing anything here
|
||||
def start_dl(self, attributes):
|
||||
return 1
|
||||
|
||||
# Called when we hit an end DL tag to reset the folder selections
|
||||
def end_dl(self):
|
||||
debug("End DL reset")
|
||||
self.isToolbar = False
|
||||
self.currentFolder = ""
|
||||
self.currentAnchor = ""
|
||||
|
||||
def getList(self):
|
||||
return self.bookmarkList
|
||||
|
||||
# This just does a linear search, but we have a sorted list because it's easier
|
||||
# to create a sub list that way (compared to binary search)
|
||||
# TODO: If it ever becomes a problem, change to binary search
|
||||
def getFolderList(folderName, sortedList):
|
||||
fldrList = []
|
||||
fldrSet = False
|
||||
for s in sortedList:
|
||||
if s[0] == folderName:
|
||||
fldrList.append(s)
|
||||
fldrSet = True
|
||||
else:
|
||||
if fldrSet:
|
||||
# Then we know that we have completed reading all folders with
|
||||
# "folderName" so we can quit
|
||||
break
|
||||
else:
|
||||
# Then we have not yet begun to create our sublist, keep
|
||||
# walking sortedList
|
||||
continue
|
||||
return fldrList
|
||||
|
||||
def checkBookmarks(loc, bkmkFile, verifier, log):
|
||||
rtn = True
|
||||
parser = bookmarkParser()
|
||||
parser.parseFile(bkmkFile)
|
||||
|
||||
# Verify the bookmarks now
|
||||
bkmkList = parser.getList()
|
||||
bkmkList.sort(lambda x,y: cmp(x[0], y[0]))
|
||||
|
||||
verifiedBkmks = verifier.getElementList("bookmarks")
|
||||
|
||||
# Now we compare the parsed list with the verified list
|
||||
for vElem in verifiedBkmks:
|
||||
fldrList = getFolderList(vElem.getAttribute("folder"), bkmkList)
|
||||
for f in fldrList:
|
||||
if (vElem.getAttribute("link") == f[1] and
|
||||
vElem.getAttribute("title") == f[2]):
|
||||
log.writeLog("\n" + vElem.getAttribute("title") + " bookmark PASSES")
|
||||
else:
|
||||
log.writeLog("\n" + vElem.getAttribute("title") + " bookmark FAILS")
|
||||
rtn = False
|
||||
return rtn
|
|
@ -0,0 +1,76 @@
|
|||
# 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 Corporation Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Clint Talbert.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Clint Talbert <ctalbert@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 *****
|
||||
|
||||
import re
|
||||
from optparse import OptionParser
|
||||
from logAppender import LogAppender
|
||||
|
||||
aus2link = re.compile(".*https:\/\/aus2.mozilla.org.*")
|
||||
|
||||
def checkHttpLog(httpLogFile, releaseChannel):
|
||||
result = False
|
||||
try:
|
||||
httpFile = open(httpLogFile, "r")
|
||||
except IOError:
|
||||
return result, "Http Log File Not Found"
|
||||
for line in httpFile:
|
||||
if aus2link.match(line):
|
||||
# This line should contain our release channel
|
||||
if line.find(releaseChannel) > 0:
|
||||
result = True, ""
|
||||
break
|
||||
return result, "Unable to find release chanel in HTTP Debug Log"
|
||||
|
||||
def main(httpFile, releaseFile, log):
|
||||
lf = LogAppender(log)
|
||||
rf = open(releaseFile, "r")
|
||||
# Ensure we don't pick up spurious newlines
|
||||
channel = rf.readline().split("\n")
|
||||
result, reason = checkHttpLog(httpFile, channel[0])
|
||||
|
||||
if not result:
|
||||
lf.writeLog(reason)
|
||||
raise SystemExit("Release Update Channel not found. Test Fails")
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-d", "--DebugHttpLog", dest="httpFile",
|
||||
help="Debug Http Log File", metavar="HTTP_LOG_FILE")
|
||||
parser.add_option("-r", "--ReleaseChannelFile", dest="releaseFile",
|
||||
help="Text File with release channel name on first line",
|
||||
metavar="RELEASE_FILE")
|
||||
parser.add_option("-l", "--LogFile", dest="log",
|
||||
help="The file where the log output should go",
|
||||
metavar="LOGFILE")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Call Main
|
||||
main(options.httpFile, options.releaseFile, options.log)
|
|
@ -0,0 +1,80 @@
|
|||
# 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 Corporation Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Clint Talbert.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Clint Talbert <ctalbert@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 *****
|
||||
|
||||
from optparse import OptionParser
|
||||
from checkBookmarks import bookmarkParser
|
||||
from logAppender import LogAppender
|
||||
|
||||
# The Main function
|
||||
def main(left, right, log):
|
||||
# Instantiate the log writer
|
||||
lw = LogAppender(log)
|
||||
|
||||
# Parse the left hand file
|
||||
leftParser = bookmarkParser()
|
||||
leftParser.parseFile(left)
|
||||
|
||||
# Parse the right hand file
|
||||
rightParser = bookmarkParser()
|
||||
rightParser.parseFile(right)
|
||||
|
||||
# Now we compare the lists generated from the parsing and they should be
|
||||
# identical
|
||||
leftList = leftParser.getList()
|
||||
rightList = rightParser.getList()
|
||||
|
||||
if len(leftList) <> len(rightList):
|
||||
lw.writeLog("Bookmarks lists are not the same length!")
|
||||
raise SystemExit("Bookmark lists not same length, test fails")
|
||||
|
||||
for lentry, rentry in zip(leftList, rightList):
|
||||
if lentry <> rentry:
|
||||
lw.writeLog("Error found entries that do not match")
|
||||
lw.writeLog("Left side: " + lentry[0] + lentry[1])
|
||||
lw.writeLog("Right side: " + rentry[0] + rentry[1])
|
||||
raise SystemExit("Bookmark entries do not match, test fails")
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-l", "--leftFile", dest="left",
|
||||
help="Bookmarks HTML file 1", metavar="LEFT_FILE")
|
||||
parser.add_option("-r", "--rightFile", dest="right",
|
||||
help="Bookmarks HTML file 2", metavar="RIGHT_FILE")
|
||||
parser.add_option("-f", "--LogFile", dest="log",
|
||||
help="The file where the log output should go",
|
||||
metavar="LOGFILE")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Call Main
|
||||
main(options.left, options.right, options.log)
|
|
@ -0,0 +1,74 @@
|
|||
# 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 Corporation Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Clint Talbert.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Clint Talbert <ctalbert@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 *****
|
||||
|
||||
from optparse import OptionParser
|
||||
import platform
|
||||
|
||||
def getPlatform():
|
||||
print platform.system()
|
||||
|
||||
def getFxName(os):
|
||||
if os == "Darwin":
|
||||
print "firefox-bin"
|
||||
elif os == "Linux":
|
||||
print "firefox"
|
||||
elif os == "Windows":
|
||||
print "firefox.exe"
|
||||
|
||||
def main(os, fxname):
|
||||
# The options given determine the behavior
|
||||
# If no options -- return the OS
|
||||
# If OS AND fxname, return the firefox executable name on this OS
|
||||
# Anything else, fail.
|
||||
|
||||
retval = ""
|
||||
|
||||
if not os:
|
||||
getPlatform()
|
||||
elif os and fxname:
|
||||
getFxName(os)
|
||||
else:
|
||||
raise SystemExit("Invalid Command use getOsInfo --h for help")
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-o", "--os", dest="os",
|
||||
help="OS identifer - either Darwin, Linux, or Windows can be\
|
||||
obtained by calling without any params", metavar="OS")
|
||||
parser.add_option("-f", "--firefoxName", action="store_true", dest="fxname", default=False,
|
||||
help="Firefox executable name on this platform requires OS")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Call Main
|
||||
main(options.os, options.fxname)
|
|
@ -0,0 +1,46 @@
|
|||
# ***** 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 Corporation Code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Clint Talbert.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2007
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Clint Talbert <ctalbert@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 *****
|
||||
|
||||
# Class to append data to a text file
|
||||
class LogAppender:
|
||||
def __init__(self, file):
|
||||
self.logFile = open(file, "a")
|
||||
def writeLog(self, str):
|
||||
self.logFile.write(str + "\n")
|
||||
return str
|
||||
def closeFile(self):
|
||||
self.logFile.write("\n---Normal Close---\n")
|
|
@ -0,0 +1,142 @@
|
|||
#!/bin/bash
|
||||
|
||||
# *!*!*!*!*!*!*!*!*!*!**! NOTICE *!*!*!*!*!*!**!*!*!*!*!*!*!*!**!*!*!*!*!*!*!*!
|
||||
# If you wish to change the location of the profile directory, then you will
|
||||
# need to extensively edit this file. For simplicity, the profile directory
|
||||
# is hard coded to:
|
||||
# Darwin/Linux:
|
||||
# /tmp/profile
|
||||
# Windows
|
||||
# C:\tmp\profile
|
||||
# Note that this value cannot be parameterized in the CreateProfile call, and
|
||||
# this is why it was opted for a hard-coded path. If that call can be
|
||||
# parameterized, then the paths should be returned to a non-hardcoded path
|
||||
# and getOsInfo can be modified to return a proper path that "CreateProfile"
|
||||
# can accept (only accepts full, native paths: i.e. /Users/clint/tmp/profile
|
||||
# not ~/tmp/profile or $Profile.
|
||||
|
||||
# Uncomment following line for debug output
|
||||
# set -x
|
||||
|
||||
options="n:f:m:l:o:b:c:"
|
||||
|
||||
function usage()
|
||||
{
|
||||
cat<<EOF
|
||||
usage:
|
||||
$script -n buildName -f FirefoxDir -m MinotaurDir -l locale -o outputXML -b bookmarks -c release-channel
|
||||
|
||||
variable description
|
||||
============= ================================================
|
||||
-n buildName required, a name for Firefox build under test
|
||||
-m MinotaurDir required, the path to the directory where Minotaur is
|
||||
-f firefoxDir required, path to Firefox installed build
|
||||
-l locale required, locale identifier of this build
|
||||
-o outputXML optional, the output XML to compare against
|
||||
-b bookmarks optional, bookmarks.html to compare against
|
||||
-c release-channel optional, release-channel verification file
|
||||
|
||||
Notes
|
||||
==========
|
||||
* If you do not include the verification files, the test will run and export
|
||||
information for you to use on future runs of this build and locale.
|
||||
* minotaurdir/tests.manifest must also point to the containing directory
|
||||
of the minotaur tests, with a trailing slash
|
||||
* Output will be in ./<buildname>-<locale>/ relevant to the directory where
|
||||
Minotaur was run from.
|
||||
|
||||
EOF
|
||||
exit 2
|
||||
}
|
||||
|
||||
while getopts $options optname ;
|
||||
do
|
||||
case $optname in
|
||||
n) fxname=$OPTARG;;
|
||||
m) minotaurdir=$OPTARG;;
|
||||
f) fxdir=$OPTARG;;
|
||||
l) locale=$OPTARG;;
|
||||
o) outputVerify=$OPTARG;;
|
||||
b) bookmarksVerify=$OPTARG;;
|
||||
c) releaseVerify=$OPTARG;;
|
||||
esac
|
||||
done
|
||||
|
||||
# If anything is not defined, display the usage string above
|
||||
if [[ -z "$fxname" || -z "$fxdir" || -z "$locale" || -z "$minotaurdir" ]]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Get our OS and Executable name
|
||||
OS=$(python getOsInfo.py)
|
||||
FFX_EXE=$(python getOsInfo.py -o $OS -f)
|
||||
|
||||
if [ $OS = "Windows" ]; then
|
||||
baseProfile=c:/tmp
|
||||
else
|
||||
baseProfile=/tmp
|
||||
fi
|
||||
|
||||
rm -rf $baseProfile/test
|
||||
rm -rf $baseProfile/profile
|
||||
mkdir $baseProfile
|
||||
|
||||
cp ${minotaurdir}/tests.manifest $fxdir/chrome/.
|
||||
|
||||
#CreateProfile: NOTICE: See above
|
||||
if [ $OS = "Windows" ]; then
|
||||
$fxdir/$FFX_EXE -CreateProfile 'minotaurTestProfile C:\tmp\profile'
|
||||
else
|
||||
$fxdir/$FFX_EXE -CreateProfile 'minotaurTestProfile /tmp/profile'
|
||||
fi
|
||||
|
||||
mkdir $baseProfile/profile
|
||||
cp ${minotaurdir}/user.js $baseProfile/profile/.
|
||||
$fxdir/$FFX_EXE -P minotaurTestProfile -chrome chrome://minotaur/content/quit.xul
|
||||
sleep 10
|
||||
cp ${minotaurdir}/user.js $baseProfile/profile/.
|
||||
|
||||
# Turn on http debugging
|
||||
export NSPR_LOG_MODULES=nsHttp:5,nsSocketTransport:5,nsHostResolver:5
|
||||
export NSPR_LOG_FILE=$baseProfile/http.log
|
||||
rm $baseProfile/http.log
|
||||
|
||||
#run the tests
|
||||
$fxdir/$FFX_EXE -P minotaurTestProfile -chrome chrome://minotaur/content
|
||||
|
||||
# create verification repository
|
||||
mkdir ${minotaurdir}/$fxname-$locale
|
||||
cp $baseProfile/profile/test-* ${minotaurdir}/$fxname-$locale/.
|
||||
cp $baseProfile/http.log ${minotaurdir}/$fxname-$locale/http.log
|
||||
|
||||
# If verification files not given, then skip verification
|
||||
if [[ -z "$outputVerify" || -z "$bookmarksVerify" || -z "$releaseVerify" ]]; then
|
||||
echo ----------- Verification Files Generated --------------
|
||||
else
|
||||
# Do Verification
|
||||
#Prepare the log file
|
||||
rm $fxname-$locale/results.log
|
||||
|
||||
#Perform the output.xml diff
|
||||
diff ${minotaurdir}/$fxname-$locale/test-output.xml $outputVerify >> ${minotaurdir}/$fxname-$locale/results.log
|
||||
|
||||
# Check the Bookmarks file
|
||||
python diffBookmarks.py -l ${minotaurdir}/$fxname-$locale/test-bookmarks.html -r $bookmarksVerify -f ${minotaurdir}/$fxname-$locale/results.log
|
||||
|
||||
# Check the Http Debug Log to catch the release channel
|
||||
python checkReleaseChannel.py -d ${minotaurdir}/$fxname-$locale/http.log -r $releaseVerify -l ${minotaurdir}/$fxname-$locale/results.log
|
||||
|
||||
# Check to see if we fail or pass
|
||||
if [ -s ${minotaurdir}/$fxname-$locale/results.log ]; then
|
||||
echo !!!!!!!!!!!!! TEST FAILS !!!!!!!!!!!!!!
|
||||
else
|
||||
echo ------------- TEST PASSES -------------
|
||||
fi
|
||||
fi
|
||||
|
||||
#CLEANUP
|
||||
# Uncomment this line if you want to delete the firefox install directory
|
||||
# rm -rdf $fxdir
|
||||
rm -rf $baseProfile/profile
|
||||
rm -rf $baseProfile/test
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<window id="minotaurWindow"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="test searchbar"
|
||||
orient="horizontal"
|
||||
height="400"
|
||||
width="600">
|
||||
|
||||
<!-- Widgets and markup go here -->
|
||||
|
||||
<script type="text/javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
|
||||
<script type="text/javascript" src="quit.js" />
|
||||
<script type="text/javascript" src="sb.js" />
|
||||
|
||||
</window>
|
|
@ -0,0 +1,141 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 The Original Code is Mozilla Automated Testing Code
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Bob Clary <bob@bclary.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 ***** */
|
||||
|
||||
/*
|
||||
From mozilla/toolkit/content
|
||||
These files did not have a license
|
||||
*/
|
||||
|
||||
function canQuitApplication()
|
||||
{
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
if (!os)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested", null);
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
function goQuitApplication()
|
||||
{
|
||||
const privs = 'UniversalPreferencesRead UniversalPreferencesWrite ' +
|
||||
'UniversalXPConnect';
|
||||
|
||||
try
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege(privs);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: privilege failure ' + ex);
|
||||
}
|
||||
|
||||
if (!canQuitApplication())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
|
||||
const kAppShell = '@mozilla.org/appshell/appShellService;1';
|
||||
var appService;
|
||||
var forceQuit;
|
||||
|
||||
if (kAppStartup in Components.classes)
|
||||
{
|
||||
appService = Components.classes[kAppStartup].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
|
||||
|
||||
}
|
||||
else if (kAppShell in Components.classes)
|
||||
{
|
||||
appService = Components.classes[kAppShell].
|
||||
getService(Components.interfaces.nsIAppShellService);
|
||||
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw 'goQuitApplication: no AppStartup/appShell';
|
||||
}
|
||||
|
||||
var windowManager = Components.
|
||||
classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
|
||||
var windowManagerInterface = windowManager.
|
||||
QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
var enumerator = windowManagerInterface.getEnumerator(null);
|
||||
|
||||
while (enumerator.hasMoreElements())
|
||||
{
|
||||
var domWindow = enumerator.getNext();
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
domWindow.close();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
appService.quit(forceQuit);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: ' + ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<window
|
||||
id="sbtest window"
|
||||
title="test searchbar"
|
||||
orient="horizontal"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<!-- Widgets and markup go here -->
|
||||
|
||||
<script type="text/javascript" src="quit.js" />
|
||||
<script type="text/javascript">goQuitApplication();</script>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,211 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 The Original Code is Mozilla Automated Testing Code
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Dave Liebreich <davel@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 Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
var searchService = Cc["@mozilla.org/browser/search-service;1"]
|
||||
.getService(Ci.nsIBrowserSearchService);
|
||||
var engines = searchService.getVisibleEngines({ });
|
||||
var engineIndex = 0;
|
||||
|
||||
var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2);
|
||||
var prefs=pb.getChildList('', {});
|
||||
prefs.sort();
|
||||
|
||||
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
var w = ww.openWindow(null,"chrome://browser/content/browser.xul",null,null,null);
|
||||
|
||||
var gOutFile;
|
||||
|
||||
function createOutputFile() {
|
||||
var dirServices = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.createInstance(Ci.nsIProperties);
|
||||
var file = dirServices.get("ProfD", Components.interfaces.nsIFile);
|
||||
file.append("test-output.xml");
|
||||
if (file.exists()) {
|
||||
file.remove(false);
|
||||
}
|
||||
|
||||
gOutFile = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
const MODE_WRONLY = 0x02;
|
||||
const MODE_CREATE = 0x08;
|
||||
const MODE_TRUNCATE = 0x20;
|
||||
const MODE_APPEND = 0x10;
|
||||
gOutFile.init(file, MODE_WRONLY | MODE_CREATE | MODE_APPEND | MODE_TRUNCATE,
|
||||
0600, 0);
|
||||
|
||||
// Seed the file by writing the XML header
|
||||
output("<?xml version=\"1.0\"?>\n<testrun>");
|
||||
}
|
||||
|
||||
function output(s) {
|
||||
s = escape(s);
|
||||
gOutFile.write(s, s.length);
|
||||
dump(s);
|
||||
}
|
||||
|
||||
function escape(s) {
|
||||
// Only escapes ampersands.
|
||||
var str = s.replace(/&/g, "&");
|
||||
return str;
|
||||
}
|
||||
function closeOutputFile() {
|
||||
output("\n</testrun>\n");
|
||||
gOutFile.flush();
|
||||
gOutFile.close();
|
||||
}
|
||||
|
||||
function listEngines() {
|
||||
output("\n<section id=\"searchengine\">\n");
|
||||
for each (var engine in engines) {
|
||||
engineIndex++;
|
||||
var submission = engine.getSubmission("foo", null);
|
||||
var url = submission.uri.spec;
|
||||
output("<l>" + engineIndex + "|" + engine.name + "|" + url + "</l>\n");
|
||||
}
|
||||
output("</section>");
|
||||
}
|
||||
|
||||
function listPrefs() {
|
||||
output("\n<section id=\"preferences\">\n");
|
||||
var grab = /(app\.distributor)|(app\.partner)|(app\.update\.channel)|(homepage)|(startup)|(browser\.contentHandlers)/;
|
||||
for (var i=0; i < prefs.length; ++i) {
|
||||
var pref = prefs[i], pval = [pref, null];
|
||||
var ptype = pb.getPrefType(pref);
|
||||
try {
|
||||
switch (ptype) {
|
||||
case pb.PREF_BOOL:
|
||||
pval[1] = String(pb.getBoolPref(pref));
|
||||
break;
|
||||
case pb.PREF_INT:
|
||||
if (pref in prefMirror) {
|
||||
pval[1] = String(prefMirror[pref]);
|
||||
}
|
||||
else {
|
||||
pval[1] = String(pb.getIntPref(pref));
|
||||
}
|
||||
break;
|
||||
case pb.PREF_STRING:
|
||||
pval[1] = pb.getComplexValue(pref, Ci.nsISupportsString).data;
|
||||
if (pval[1].match(/.+\.properties$/)) {
|
||||
var data = pb.getComplexValue(pref, Ci.nsIPrefLocalizedString).data;
|
||||
pval[1] = data;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
Components.utils.reportError("Preference " + pref + " triggered " + e);
|
||||
}
|
||||
if (String(pval[0]).match(grab)) {
|
||||
output("<l>" + String(pval[0]) + "|" + String(pval[1]) + "</l>\n");
|
||||
}
|
||||
}
|
||||
output("</section>");
|
||||
}
|
||||
|
||||
function listBookmarks() {
|
||||
// Exports bookmarks to a testbookmarks.html file
|
||||
// If we're not less than or equal to a 1.8 build, then we're using places
|
||||
var dirUtils = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.createInstance(Ci.nsIProperties);
|
||||
var file = dirUtils.get("ProfD", Components.interfaces.nsIFile);
|
||||
file.append("test-bookmarks.html");
|
||||
if (file.exists()) {
|
||||
file.remove(false);
|
||||
}
|
||||
|
||||
// TODO: Checking the gecko engine level to determine whether or not
|
||||
// to do places style calls.
|
||||
// If version <= 1.8 we will use old bookmarks
|
||||
// If version >= 1.9 we will use places calls
|
||||
var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
|
||||
var appInfoAry = appInfo.platformVersion.split(".");
|
||||
if ( (appInfoAry[0] == "1") && (parseInt(appInfoAry[1], 10) <= 8) ) {
|
||||
var i = 0;
|
||||
var bmsvc = Cc["@mozilla.org/browser/bookmarks-service;1"]
|
||||
.getService(Ci.nsIBookmarksService);
|
||||
var RDF = Cc["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Ci.nsIRDFService);
|
||||
var selection = RDF.GetResource("NC:BookmarksRoot");
|
||||
var fname = file.path;
|
||||
var args = [{property: "http://home.netscape.com/NC-rdf#URL", literal:fname}];
|
||||
initServices();
|
||||
initBMService();
|
||||
if (BMSVC) {
|
||||
// Declared in bookmarks.js
|
||||
BMSVC.readBookmarks();
|
||||
}
|
||||
BookmarksCommand.doBookmarksCommand(selection,
|
||||
"http://home.netscape.com/NC-rdf#command?cmd=export", args);
|
||||
} else {
|
||||
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||
var placesExporter = Cc["@mozilla.org/browser/places/import-export-service;1"]
|
||||
.getService(Ci.nsIPlacesImportExportService);
|
||||
placesExporter.exportHTMLToFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
function listExtensions() {
|
||||
// Gets a list of extensions from the extension manager
|
||||
output("\n<section id=\"extensions\">\n");
|
||||
var extmgr = Cc["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Ci.nsIExtensionManager);
|
||||
var exts = extmgr.getItemList(Ci.nsIUpdateItem.TYPE_ANY, { });
|
||||
for (var i=0; i < exts.length; ++i) {
|
||||
var item = exts[i];
|
||||
output("<l>" + i + "|" + item.name + "|" + item.id + "|" + item.version + "|"
|
||||
+ item.iconURL + "|" + item.xpiURL + "|" + item.type + "</l>\n");
|
||||
}
|
||||
output("</section>");
|
||||
}
|
||||
|
||||
function listUpdates() {
|
||||
var prompter = Cc["@mozilla.org/updates/update-prompt;1"]
|
||||
.createInstance(Ci.nsIUpdatePrompt);
|
||||
prompter.checkForUpdates();
|
||||
}
|
||||
|
||||
createOutputFile();
|
||||
listEngines();
|
||||
listPrefs();
|
||||
listExtensions();
|
||||
listBookmarks();
|
||||
listUpdates();
|
||||
closeOutputFile();
|
||||
setTimeout(goQuitApplication, 1500);
|
|
@ -0,0 +1 @@
|
|||
content minotaur file:///Users/clint/code/Minotaur/workspace/
|
|
@ -0,0 +1,2 @@
|
|||
user_pref("browser.dom.window.dump.enabled", true);
|
||||
user_pref("browser.shell.checkDefaultBrowser", false);
|
Загрузка…
Ссылка в новой задаче