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
8 # The Original Code is Mozilla Corporation Code.
10 # The Initial Developer of the Original Code is
12 # Portions created by the Initial Developer are Copyright (C) 2007
13 # the Initial Developer. All Rights Reserved.
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 *****
33 from optparse
import OptionParser
34 from logAppender
import LogAppender
, stderrCatcher
37 aus2link
= re
.compile(".*https:\/\/aus2.mozilla.org.*")
39 def checkHttpLog(httpLogFile
, releaseChannel
):
42 httpFile
= open(httpLogFile
, "r")
44 return result
, "Http Log File Not Found"
46 if aus2link
.match(line
):
47 # This line should contain our release channel
48 if line
.find(releaseChannel
) > 0:
51 return result
, "Unable to find release chanel in HTTP Debug Log"
53 def main(httpFile
, releaseFile
, 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])
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",
75 (options
, args
) = parser
.parse_args()
78 main(options
.httpFile
, options
.releaseFile
, options
.log
)