Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / testing / release / minotaur / checkReleaseChannel.py
blob5742c98f897854722eccf2157ae53aa7ba3d8ce7
1 # http://www.mozilla.org/MPL/
3 # Software distributed under the License is distributed on an "AS IS" basis,
4 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5 # for the specific language governing rights and limitations under the
6 # License.
8 # The Original Code is Mozilla Corporation Code.
10 # The Initial Developer of the Original Code is
11 # Clint Talbert.
12 # Portions created by the Initial Developer are Copyright (C) 2007
13 # the Initial Developer. All Rights Reserved.
15 # Contributor(s):
16 # Clint Talbert <ctalbert@mozilla.com>
18 # Alternatively, the contents of this file may be used under the terms of
19 # either the GNU General Public License Version 2 or later (the "GPL"), or
20 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
21 # in which case the provisions of the GPL or the LGPL are applicable instead
22 # of those above. If you wish to allow use of your version of this file only
23 # under the terms of either the GPL or the LGPL, and not to allow others to
24 # use your version of this file under the terms of the MPL, indicate your
25 # decision by deleting the provisions above and replace them with the notice
26 # and other provisions required by the GPL or the LGPL. If you do not delete
27 # the provisions above, a recipient may use your version of this file under
28 # the terms of any one of the MPL, the GPL or the LGPL.
30 # ***** END LICENSE BLOCK *****
32 import re
33 from optparse import OptionParser
34 from logAppender import LogAppender, stderrCatcher
35 import sys
37 aus2link = re.compile(".*https:\/\/aus2.mozilla.org.*")
39 def checkHttpLog(httpLogFile, releaseChannel):
40 result = False
41 try:
42 httpFile = open(httpLogFile, "r")
43 except IOError:
44 return result, "Http Log File Not Found"
45 for line in httpFile:
46 if aus2link.match(line):
47 # This line should contain our release channel
48 if line.find(releaseChannel) > 0:
49 result = True, ""
50 break
51 return result, "Unable to find release chanel in HTTP Debug Log"
53 def main(httpFile, releaseFile, log):
54 lf = LogAppender(log)
55 sys.stderr = stderrCatcher(lf)
56 rf = open(releaseFile, "r")
57 # Ensure we don't pick up spurious newlines
58 channel = rf.readline().split("\n")
59 result, reason = checkHttpLog(httpFile, channel[0])
61 if not result:
62 lf.writeLog(reason)
63 raise SystemExit("Release Update Channel not found. Test Fails")
65 if __name__ == "__main__":
66 parser = OptionParser()
67 parser.add_option("-d", "--DebugHttpLog", dest="httpFile",
68 help="Debug Http Log File", metavar="HTTP_LOG_FILE")
69 parser.add_option("-r", "--ReleaseChannelFile", dest="releaseFile",
70 help="Text File with release channel name on first line",
71 metavar="RELEASE_FILE")
72 parser.add_option("-l", "--LogFile", dest="log",
73 help="The file where the log output should go",
74 metavar="LOGFILE")
75 (options, args) = parser.parse_args()
77 # Call Main
78 main(options.httpFile, options.releaseFile, options.log)