Beispiel #1
0
    def main(self, *args):
        if self._list_env:
            # List environment variables and exit.
            self.do_list_env()
            return

        log_levels = {
            3: logging.DEBUG,
            2: logging.INFO,
            1: logging.WARNING,
            0: logging.ERROR
        }

        self.verbosity = self.verbosity if self.verbosity < 4 else 3
        logging.captureWarnings(True)

        log.configure()
        LOG = logging.getLogger()
        LOG.setLevel(log_levels[self.verbosity])

        settings.update_env()

        if args:
            print("Unknown command {0!r}".format(args[0]))
            return 1
        if not self.nested_command:
            print("No command given")
            return 1
Beispiel #2
0
    def main(self, *args):
        log.configure()
        builddir = local.path(str(CFG["build_dir"]))
        if not builddir.exists():
            response = ui.ask(
                "The build directory {dirname} does not exist yet. "
                "Should I create it?".format(dirname=builddir))

            if response:
                mkdir("-p", builddir)
                print("Created directory {0}.".format(builddir))

        setup_directories(builddir)
Beispiel #3
0
    def main(self, *args):
        log.configure()
        builddir = local.path(str(CFG["build_dir"]))
        if not builddir.exists():
            response = ui.ask(
                "The build directory {dirname} does not exist yet. "
                "Should I create it?".format(dirname=builddir))

            if response:
                mkdir("-p", builddir)
                print("Created directory {0}.".format(builddir))

        setup_directories(builddir)
Beispiel #4
0
    def main(self, *args):
        self.verbosity = self.verbosity if self.verbosity < 4 else 3
        settings.CFG["verbosity"] = self.verbosity

        log.configure()
        log.set_defaults()
        if settings.CFG["db"]["create_functions"].value():
            from benchbuild.utils.schema import init_functions, Session
            init_functions(Session())

        if args:
            print("Unknown command {0!r}".format(args[0]))
            return 1
        if not self.nested_command:
            self.help()
Beispiel #5
0
    def main(self, *args):
        log.configure()
        _log = logging.getLogger()
        _log.setLevel({
            3: logging.DEBUG,
            2: logging.INFO,
            1: logging.WARNING,
            0: logging.ERROR
        }[self.verbosity])

        builddir = os.path.abspath(str(CFG["build_dir"]))
        if not os.path.exists(builddir):
            response = ask("The build directory {dirname} does not exist yet. "
                           "Should I create it?".format(dirname=builddir))

            if response:
                mkdir("-p", builddir)
                print("Created directory {0}.".format(builddir))

        setup_directories(builddir)
Beispiel #6
0
    def main(self, *args):
        self.verbosity = self.verbosity if self.verbosity < 6 else 5
        if self.debug:
            self.verbosity = 3
        verbosity = int(os.getenv('BB_VERBOSITY', self.verbosity))

        settings.CFG["verbosity"] = verbosity
        settings.CFG["debug"] = self.debug

        log.configure()
        log.set_defaults()

        if settings.CFG["db"]["create_functions"]:
            from benchbuild.utils.schema import init_functions, Session
            init_functions(Session())

        if args:
            print("Unknown command {0!r}".format(args[0]))
            return 1
        if not self.nested_command:
            self.help()
Beispiel #7
0
    def main(self, *args):

        log.configure()
        LOG = logging.getLogger()
        LOG.setLevel({
            3: logging.DEBUG,
            2: logging.INFO,
            1: logging.WARNING,
            0: logging.ERROR
        }[self.verbosity])

        settings.update_env()

        builddir = os.path.abspath(settings.CFG["build_dir"].value())
        if not os.path.exists(builddir):
            response = ask("The build directory {dirname} does not exist yet. "
                           "Should I create it?".format(dirname=builddir))

            if response:
                mkdir("-p", builddir)
                print("Created directory {0}.".format(builddir))

        setup_directories(builddir)
Beispiel #8
0
        class MockExp(experiment.Experiment):
            NAME = "mock-exp"

            def actions_for_project(self, project):
                from benchbuild.utils.actions import (
                    Prepare, Download, Configure, Build, Run, Clean)
                actns = []
                project.builddir = "/tmp/throwaway"
                actns = [Prepare(project),
                         Download(project),
                         Configure(project),
                         Build(project),
                         Run(project),
                         Clean(project)]
                return actns

        exp = MockExp()
        eactn = Experiment(obj=exp, actions=exp.actions())
        old_exists = os.path.exists
        os.path.exists = lambda p: True
        print(eactn)
        eactn()
        os.path.exists = old_exists


if __name__ == "__main__":
    from benchbuild.utils import log
    log.configure()
    TestRun().test_run()
Beispiel #9
0
        class MockExp(experiment.Experiment):
            NAME = "mock-exp"

            def actions_for_project(self, project):
                from benchbuild.utils.actions import (
                    Prepare, Download, Configure, Build, Run, Clean)
                inside = None
                actns = []
                project.builddir = "/tmp/throwaway"
                actns = [Prepare(project),
                         Download(project),
                         Configure(project),
                         Build(project),
                         Run(project),
                         Clean(project)]
                return actns

        exp = MockExp(group="polybench")
        eactn = Experiment(exp, exp.actions())
        old_exists = os.path.exists
        os.path.exists = lambda p: True
        print(eactn)
        eactn()
        os.path.exists = old_exists


if __name__ == "__main__":
    from benchbuild.utils import log
    log.configure()
    TestRun().test_run()