30gStopOnFirstError = 
False 
   43def LoggingDecorator(func):
 
   44    def wrapper(*args, **kwds):
 
   45        loggingMethod, message, type, depth, escapeHtml = func(*args, **kwds)
 
   46        isInfoMessage = loggingMethod == mevis.MLAB.logHTML
 
   47        if TestSupport.TestHelper.gLogInfoMessages 
or not isInfoMessage:
 
   48            message = str(message)
 
   49            if TestHelper.getInstance().hasCallerStackFrame():
 
   50                callerStackFrame = TestHelper.getInstance().getCallerStackFrame()
 
   52                callerStackFrame = sys._getframe(1 + depth)
 
   54                stackLine = traceback.extract_stack(callerStackFrame, 1)[0]
 
   57                stackTrace = traceback.extract_stack(callerStackFrame)
 
   59                for i, frame 
in enumerate(stackTrace):
 
   60                    if frame[2] == 
"__callTestFunction":
 
   61                        stackTrace = stackTrace[i + 1 :]
 
   63                stackLine = stackTrace[-1]
 
   64                formattedStack = 
"".join(traceback.format_list(stackTrace))
 
   65            emitSpecialMessage(loggingMethod, stackLine[0], stackLine[1], type, message, escapeHtml, formattedStack)
 
   67        if gStopOnFirstError 
and gStopped:
 
   68            raise CancelTestException
 
 
   83def info(message, stack=False, type="", depth=0):
 
   85        mevis.MLAB.logError(
"The stack option is deprecated!")
 
   86    return mevis.MLAB.logHTML, message, type, depth, 
True 
 
   98    return mevis.MLAB.logHTML, message, type, depth, 
False 
 
  110def warning(message, stack=False, type="", depth=0):
 
  112        mevis.MLAB.logError(
"The stack option is deprecated!")
 
  113    return mevis.MLAB.logWarningHTML, message, type, depth, 
True 
 
  125    return mevis.MLAB.logWarningHTML, message, type, depth, 
False 
 
  137def error(message, stack=False, type="", depth=0):
 
  139        mevis.MLAB.logError(
"The stack option is deprecated!")
 
  140    return mevis.MLAB.logErrorHTML, message, type, depth, 
True 
 
  152    return mevis.MLAB.logErrorHTML, message, type, depth, 
False 
 
  165    for filename 
in files:
 
  166        if not os.path.isfile(filename):
 
  167            error(
"Image (%s) does not exist" % (filename), depth=1)
 
  169            hash = Base_getHash(filename)
 
  170            fileList.append(
"%s|%s" % (hash, filename))
 
  171    if len(fileList) == 0:
 
  172        error(
"No images given!", depth=1)
 
  174        stackLine = traceback.extract_stack(sys._getframe(1), 1)[0]
 
  175        emitSpecialCommand(stackLine[0], stackLine[1], 
"ImageShow", fileList, description)
 
 
  189    for filename 
in files:
 
  190        if not os.path.isfile(filename):
 
  191            error(
"File (%s) does not exist" % (filename), depth=1)
 
  193            hash = Base_getHash(filename)
 
  194            fileList.append(
"%s|%s" % (hash, filename))
 
  195    if len(fileList) == 0:
 
  196        error(
"No files given!", depth=1)
 
  198        stackLine = traceback.extract_stack(sys._getframe(1), 1)[0]
 
  199        emitSpecialCommand(stackLine[0], stackLine[1], 
"FileShow", fileList, description)
 
 
  214def showDiff(description, fromLines, toLines, showOnlyContextOfDiff=False, numberOfContextLines=10):
 
  215    if type(fromLines) != list:
 
  216        with open(fromLines) 
as fh:
 
  217            fromLines = fh.readlines()
 
  218    if type(toLines) != list:
 
  219        with open(toLines) 
as fh:
 
  220            toLines = fh.readlines()
 
  221    diff = Base_createHtmlDiff(fromLines, toLines, showOnlyContextOfDiff, numberOfContextLines)
 
  222    baseDiffFileName = os.path.join(Base_getResultDirectory(), 
"diff%s.html")
 
  223    diffFileName = baseDiffFileName % 
"" 
  225    while os.path.exists(diffFileName):
 
  227        diffFileName = baseDiffFileName % i
 
  228    if not os.path.exists(Base_getResultDirectory()):
 
  229        os.makedirs(Base_getResultDirectory())
 
  230    with open(diffFileName, 
"w") 
as f:
 
 
  247    for line 
in traceback.extract_stack(sys._getframe(2 + depth)):
 
  248        content += 
"[[%s][%d][%s][%s]]" % (line[0], line[1], line[2], line[3])
 
  249    return "##S[%s]" % (content)
 
 
  255    getResultDirectory 
as Base_getResultDirectory,
 
  256    createHtmlDiff 
as Base_createHtmlDiff,
 
  257    getHash 
as Base_getHash,
 
getStack(depth=0)
Get the current stack.
 
errorHTML(message, type="", depth=0)
Put an error to the log while interpreting HTML.
 
showFile(description, *files)
Put the FileShow command to the log.
 
warningHTML(message, type="", depth=0)
Put a warning to the log while interpreting HTML.
 
infoHTML(message, type="", depth=0)
Put an info message to the log while interpreting HTML.
 
info(message, stack=False, type="", depth=0)
Put an info message to the log.
 
showImage(description, *files)
Put the ImageShow command to the log.
 
showDiff(description, fromLines, toLines, showOnlyContextOfDiff=False, numberOfContextLines=10)
Creates a HTML diff from the two files and puts the FileShow command to the log.
 
error(message, stack=False, type="", depth=0)
Put an error to the log.
 
warning(message, stack=False, type="", depth=0)
Put a warning to the log.