old_contents: '''
  Created on Jan 10, 2013
  
  __author__ = "Elizabeth 'pidge' Flanagan"
  __copyright__ = "Copyright 2012-2013, Intel Corp."
  __credits__ = ["Elizabeth Flanagan"]
  __license__ = "GPL"
  __version__ = "2.0"
  __maintainer__ = "Elizabeth Flanagan"
  __email__ = "elizabeth.flanagan@intel.com"
  '''
  
  
  from buildbot.steps.shell import ShellCommand
  from buildbot.status.results import SUCCESS, FAILURE
  import os
  
  class RunSanityTests(ShellCommand):
  
      haltOnFailure = False 
      flunkOnFailure = True 
      name = "Running Sanity Tests" 
      def __init__(self, factory, argdict=None, **kwargs):
          self.factory = factory
          self.images=""
          self.scene=None
          # the default of 1200 seconds is enough for running sanity tests in most cases
          self.timeout = 1200
          for k, v in argdict.iteritems():
              setattr(self, k, v)
          self.description = "Running Sanity Tests"
          command = ""
          command = command + ". ./oe-init-build-env; "
          command = command + "(echo > /dev/tcp/localhost/5901) 2> /dev/null;"
          command = command + 'if [ $? -ne 0 ]; then echo "Starting a VNC server on :1"; vncserver :1; else echo "Will use a VNC server already running on :1"; fi;'
          command = command + "echo 'IMAGETEST = \"qemu\"' >> ./conf/auto.conf;"
          if self.scene:
              command = command + "echo 'TEST_SCEN = \"" + self.scene + "\"'" + " >> ./conf/auto.conf;"
          command = command + "DISPLAY=localhost:1 bitbake " + self.images + " -c qemuimagetest_standalone"
          # Timeout needs to be passed to LoggingBuildStep as a kwarg
          kwargs['timeout']=self.timeout
          self.command = command
          ShellCommand.__init__(self, **kwargs)
  
      def describe(self, done=False):
          description = ShellCommand.describe(self,done)
          return description
  
  
new_contents: '''
  Created on Jan 10, 2013
  
  __author__ = "Elizabeth 'pidge' Flanagan"
  __copyright__ = "Copyright 2012-2013, Intel Corp."
  __credits__ = ["Elizabeth Flanagan"]
  __license__ = "GPL"
  __version__ = "2.0"
  __maintainer__ = "Elizabeth Flanagan"
  __email__ = "elizabeth.flanagan@intel.com"
  '''
  
  
  from buildbot.steps.shell import ShellCommand
  from buildbot.status.results import SUCCESS, FAILURE
  import os
  
  class RunSanityTests(ShellCommand):
  
      haltOnFailure = False 
      flunkOnFailure = True 
      name = "Running Sanity Tests" 
      def __init__(self, factory, argdict=None, **kwargs):
          self.factory = factory
          self.images=""
          self.scene=None
          self.suites=None
          self.suitesappend=None
          # the default of 1200 seconds is enough for running sanity tests in most cases
          self.timeout = 1200
          for k, v in argdict.iteritems():
              setattr(self, k, v)
          self.description = "Running Sanity Tests"
          kwargs['timeout']=self.timeout
          ShellCommand.__init__(self, **kwargs)
  
      def start(self):
          branch = self.getProperty("branch_poky")
          command = ""
          command = command + ". ./oe-init-build-env; "
          command = command + "(echo > /dev/tcp/localhost/5901) 2> /dev/null;"
          command = command + 'if [ $? -ne 0 ]; then echo "Starting a VNC server on :1"; vncserver :1; else echo "Will use a VNC server already running on :1"; fi;'
          if "danny" not in branch and "dylan" not in branch:
              command = command + "echo 'INHERIT += \"testimage\"' >> ./conf/auto.conf;"
              if self.suites:
                  command = command + "echo 'TEST_SUITES = \"" + self.suites + "\"'" + " >> ./conf/auto.conf;"
              if self.suitesappend:
                  command = command + "echo 'TEST_SUITES_append = \" " + self.suitesappend + "\"'" + " >> ./conf/auto.conf;"
              command = command + "DISPLAY=:1 bitbake " + self.images + " -c testimage"
          else:
              command = command + "echo 'IMAGETEST = \"qemu\"' >> ./conf/auto.conf;"
              if self.scene:
                  command = command + "echo 'TEST_SCEN = \"" + self.scene + "\"'" + " >> ./conf/auto.conf;"
              command = command + "DISPLAY=localhost:1 bitbake " + self.images + " -c qemuimagetest_standalone"
          self.command = command
          ShellCommand.start(self)
  
      def describe(self, done=False):
          description = ShellCommand.describe(self,done)
          return description
  
  
subject: add support for the new testimage class