#!/usr/bin/env python2 import os, string, shutil, sys, logging, glob, re from texttestlib import plugins from ConfigParser import ConfigParser, NoOptionError from copy import copy from ordereddict import OrderedDict plugins.addCategory("bug", "known bugs", "had known bugs") plugins.addCategory("badPredict", "internal errors", "had internal errors") plugins.addCategory("crash", "CRASHED") # For backwards compatibility... class FailedPrediction(plugins.TestState): def getExitCode(self): return int(self.category != "bug") def getTypeBreakdown(self): status = "failure" if self.getExitCode() else "success" return status, self.briefText class Bug: rerunLine = "(NOTE: Test was run %d times in total and each time encountered this issue." prevResultLine = "Results of previous runs can be found in framework_tmp/backup.previous.* under the sandbox directory.)" def __init__(self, priority, rerunCount, rerunOnly): self.priority = priority self.rerunCount = rerunCount self.rerunOnly = rerunOnly
""" Action for running a test locally or on a remote machine """ import os, logging, subprocess, sys, signal, pipes from texttestlib import plugins from texttestlib.jobprocess import killSubProcessAndChildren from time import sleep from threading import Lock, Timer plugins.addCategory("killed", "killed", "were terminated before completion") class Running(plugins.TestState): defaultBriefText = "RUN" def __init__(self, execMachines, freeText="", briefText="", lifecycleChange="start"): plugins.TestState.__init__(self, "running", freeText, briefText, started=1, executionHosts=execMachines, lifecycleChange=lifecycleChange) def makeModifiedState(self, newRunStatus, newDetails, lifecycleChange): currRunStatus = self.briefText.split()[0] if newRunStatus != currRunStatus: currFreeTextStatus = self.freeText.splitlines()[0].rsplit(" ",
import sys import logging import types from texttestlib import plugins from queue import Queue, Empty from collections import OrderedDict from threading import Lock plugins.addCategory("cancelled", "cancelled", "were cancelled before starting") class Cancelled(plugins.TestState): def __init__(self, briefText, freeText): plugins.TestState.__init__(self, "cancelled", briefText=briefText, freeText=freeText, started=1, completed=1, lifecycleChange="complete") # We're set up for running in a thread but we don't do so by default, for simplicity class BaseActionRunner(plugins.Responder, plugins.Observable): cancelFreeText = "Test run was cancelled before it had started" def __init__(self, optionMap, diag): plugins.Responder.__init__(self) plugins.Observable.__init__(self)
import os import filecmp import shutil import logging from texttestlib.default import performance, knownbugs from texttestlib import plugins from collections import OrderedDict from tempfile import mktemp from .comparefile import FileComparison, SplitFileComparison from fnmatch import fnmatch plugins.addCategory("success", "succeeded") plugins.addCategory("failure", "FAILED") class BaseTestComparison(plugins.TestState): def __init__(self, category, previousInfo, completed, lifecycleChange=""): plugins.TestState.__init__(self, category, "", started=1, completed=completed, lifecycleChange=lifecycleChange, executionHosts=previousInfo.executionHosts) self.allResults = [] self.changedResults = [] self.newResults = [] self.missingResults = [] self.correctResults = [] self.diag = logging.getLogger("TestComparison")
def _getDescriptor(self, configEntry, configName): fromConfig = self.configMethod(configEntry, configName) if len(fromConfig) > 0: name, briefDesc, longDesc = plugins.commasplit(fromConfig) plugins.addCategory(name, briefDesc, longDesc) return name