예제 #1
0
  def process(self, testcaseName) :
    global prepare_was_before

    for this_testcase in self.testprocedure :
      if testcaseName == None or testcaseName == "" :

        # We don't want to execute a specific testcase, just execute all in that module

        if (isinstance(this_testcase, testcases.testcase.Testcase)) :
          # When its an instance, we need the name
          hedgehog.HedgeHog.instance().log("INFO", "___________________")
          hedgehog.HedgeHog.instance().log("INFO", "")
          hedgehog.HedgeHog.instance().log("INFO", this_testcase.get_name())
          if prepare_was_before == 1 :
            # Check if an .INI-File was changed by prepareini-class, so that we have to
            # reboot the target to accept the new configurations
            self.makeReboot()

        else :
          # Otherwise its not a testcase but a call to prepare an .INI-File
          hedgehog.HedgeHog.instance().log("INFO", "Preparing .INI-File")
          prepare_was_before = 1

        # Save that testcase in a variable and check if its an instance of testcase
        # if so, call the enter-method of that testcase, which have to be implemented
        testcase = this_testcase
        if (isinstance(testcase, testcases.testcase.Testcase)) :
          try :
            testcase.enter()
          except Exception,e :
            raise NotImplementedError("Please implement \"enter()\" method in test-case \"" + this_testcase.get_name() + "\"")

        # Finally call the process method to start the testcase
        result = testcase.process()

      else :

        # Here we want to execute a specific testcase

        if (isinstance(this_testcase, testcases.testcase.Testcase)) :
          # Get name of testcase to check if its the needed one
          currentTestcaseName = str(this_testcase.get_name())
          if testcaseName in currentTestcaseName :
            # Found the needed testcase
            if prepare_was_before == 1 :
              # Check if an .INI-File was changed by prepareini-class, so that
              # we have to reboot the target to accept the new configurations
              self.makeReboot()

            testcase = this_testcase
            hedgehog.HedgeHog.instance().log("INFO", "___________________")
            hedgehog.HedgeHog.instance().log("INFO", currentTestcaseName)
            try :
              testcase.enter()
            except Exception,e :
              raise NotImplementedError("Please implement \"enter()\" method in test-case \"" + this_testcase.get_name() + "\"")

            # Finally call the process method to start the testcase
            result = testcase.process()

          else :
            result = 99

        else :
예제 #2
0
            except Exception,e :
              raise NotImplementedError("Please implement \"enter()\" method in test-case \"" + this_testcase.get_name() + "\"")

            # Finally call the process method to start the testcase
            result = testcase.process()

          else :
            result = 99

        else :
          # Otherwise its not a testcase but a call to prepare an .INI-File
          hedgehog.HedgeHog.instance().log("INFO", "Preparing .INI-File")
          prepare_was_before = 1
          # Call prepareini process-method
          testcase = this_testcase
          result = testcase.process()

      if result == 0 :
        hedgehog.HedgeHog.instance().log("INFO", "Testcase: OK")
      elif result == 1 :
        hedgehog.HedgeHog.instance().log("INFO", "INI-FILE PREPARED")
      elif result == 2 :
        hedgehog.HedgeHog.instance().log("INFO", "INI-FILE RESTORED")
        # When we restore an .INI-File we have to reboot the target to accept
        # new configuration
        self.makeReboot()
      elif result == 99 :
        # Here we come when we want to find a specific testcase, but its not the current one
        # so we have to search further
        pass
      elif result == -1 :