예제 #1
0
    def run_once(self):
        """
            Try to access different resources which are restricted by cgroup.
        """
        logging.info('Starting cgroup testing')

        err = ""
        # Run available tests
        for subtest in ['memory', 'cpuset']:
            logging.info("---< 'test_%s' START >---", subtest)
            try:
                if not self.modules.get_pwd(subtest):
                    raise error.TestFail("module not available/mounted")
                t_function = getattr(self, "test_%s" % subtest)
                t_function()
                logging.info("---< 'test_%s' PASSED >---", subtest)
            except AttributeError:
                err += "%s, " % subtest
                logging.error("test_%s: Test doesn't exist", subtest)
                logging.info("---< 'test_%s' FAILED >---", subtest)
            except Exception:
                err += "%s, " % subtest
                tb = utils.etraceback("test_%s" % subtest, sys.exc_info())
                logging.error("test_%s: FAILED%s", subtest, tb)
                logging.info("---< 'test_%s' FAILED >---", subtest)

        if err:
            logging.error('Some subtests failed (%s)', err[:-2])
            raise error.TestFail('Some subtests failed (%s)' % err[:-2])
예제 #2
0
파일: cgroup.py 프로젝트: Poohby/autotest
    def run_once(self):
        """
            Try to access different resources which are restricted by cgroup.
        """
        logging.info('Starting cgroup testing')

        err = ""
        # Run available tests
        for subtest in ['memory', 'cpuset']:
            logging.info("---< 'test_%s' START >---", subtest)
            try:
                if not self.modules.get_pwd(subtest):
                    raise error.TestFail("module not available/mounted")
                t_function = getattr(self, "test_%s" % subtest)
                t_function()
                logging.info("---< 'test_%s' PASSED >---", subtest)
            except AttributeError:
                err += "%s, " % subtest
                logging.error("test_%s: Test doesn't exist", subtest)
                logging.info("---< 'test_%s' FAILED >---", subtest)
            except Exception:
                err += "%s, " % subtest
                tb = utils.etraceback("test_%s" % subtest, sys.exc_info())
                logging.error("test_%s: FAILED%s", subtest, tb)
                logging.info("---< 'test_%s' FAILED >---", subtest)

        if err:
            logging.error('Some subtests failed (%s)', err[:-2])
            raise error.TestFail('Some subtests failed (%s)' % err[:-2])
예제 #3
0
파일: cgroup.py 프로젝트: z1l3/autotest
        for _loop in range(loops):
            # cg_test is the subtest name from regular expression
            for cg_test in [_ for _ in tests.keys() if re.match(rexpr, _)]:
                logging.info("%s: Entering the test", cg_test)
                err = ""
                try:
                    tst = tests[cg_test](vms, modules)
                    tst.init()
                    out = tst.run()
                except error.TestFail, failure_detail:
                    logging.error("%s: Leaving, test FAILED (TestFail): %s",
                                  cg_test, failure_detail)
                    err += "test, "
                    out = failure_detail
                except error.TestError, failure_detail:
                    tb = utils.etraceback(cg_test, sys.exc_info())
                    logging.error("%s: Leaving, test FAILED (TestError): %s",
                                  cg_test, tb)
                    err += "testErr, "
                    out = failure_detail
                except Exception, failure_detail:
                    tb = utils.etraceback(cg_test, sys.exc_info())
                    logging.error("%s: Leaving, test FAILED (Exception): %s",
                                  cg_test, tb)
                    err += "testUnknownErr, "
                    out = failure_detail

                try:
                    tst.cleanup()
                except Exception, failure_detail:
                    logging.warn("%s: cleanup failed: %s\n", cg_test,