Esempio n. 1
0
def main(httpFile, releaseFile, log):
    lf = LogAppender(log)
    sys.stderr = stderrCatcher(lf)
    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")
def main(httpFile, releaseFile, log):
  lf = LogAppender(log)
  sys.stderr = stderrCatcher(lf)
  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")
Esempio n. 3
0
def main(left, right, log):
  # Instantiate the log writer
  lw = LogAppender(log)
  # Redirect stderr
  sys.stderr = stderrCatcher(lw)

  # Parse the left hand file
  leftParser = bookmarkParser(isDebug=DIFFBKMK_DBG)
  leftParser.parseFile(left)

  # Parse the right hand file
  rightParser = bookmarkParser(isDebug=DIFFBKMK_DBG)
  rightParser.parseFile(right)

  # Now we compare the lists generated from the parsing and they should be
  # identical, and they are sorted by <folder> and then by <link title>
  leftList = leftParser.getList()
  rightList = rightParser.getList()

  # Handle the case where we are missing a file
  if len(leftList) == 0:
    lw.writeLog("**** BOOKMARKS REFERENCE FILE IS MISSING ****")
    raise SystemExit("**** BOOKMARKS REFERENCE FILE IS MISSING ****")
  elif len(rightList) == 0:
    lw.writeLog("**** BOOKMARKS DATA FOR BUILD UNDER TEST IS MISSING ****")
    raise SystemExit("**** BOOKMARKS DATA FOR BUILD UNDER TEST IS MISSING ****")

  leftlines = []
  for lentry in leftList:
    leftlines.append(lentry[0] + lentry[1] + lentry[2] + lentry[3] + lentry[4] + "\n")

  rightlines = []
  for rentry in rightList:
    rightlines.append(rentry[0] + rentry[1] + rentry[2] + rentry[3] + rentry[4] + "\n")
  
  # Create the diff.  Here's how it works.  These are flattened sorted lists of
  # bookmarks.  For ease of viewing, in their diffs, they look like this:
  # folder=<bookmark folder> title=<link title> url=<link href> feedurl=<feedurl (if present)> icon=<icon>
  # The diff takes the two sets of lines and does a unified diff on them.
  diff = difflib.unified_diff(leftlines, rightlines)
  lw.writelines(diff)