コード例 #1
0
ファイル: benchmark_test.py プロジェクト: zouhejing0000/mongo
    def __init__(self, logger, program_executable, program_options=None):
        """
        Initializes the BenchmarkTestCase with the executable to run.
        """
        interface.ProcessTestCase.__init__(self, logger, "Benchmark test", program_executable)
        parser.validate_benchmark_options()

        self.bm_executable = program_executable
        self.suite_bm_options = program_options
コード例 #2
0
    def __init__(self, logger, mongoebench_config_file, program_options=None):
        """Initialize the BenchrunEmbeddedTestCase with the executable to run."""

        interface.ProcessTestCase.__init__(self, logger,
                                           "Benchmark embedded test",
                                           mongoebench_config_file)
        parser.validate_benchmark_options()

        self.benchrun_config_file = mongoebench_config_file

        # Command line options override the YAML configuration.
        self.benchrun_executable = utils.default_if_none(
            _config.MONGOEBENCH_EXECUTABLE,
            _config.DEFAULT_MONGOEBENCH_EXECUTABLE)
        self.benchrun_repetitions = utils.default_if_none(
            _config.BENCHMARK_REPETITIONS,
            _config.DEFAULT_BENCHMARK_REPETITIONS)
        self.suite_benchrun_options = program_options
        self.benchrun_threads = 1
        if program_options and "threads" in program_options:
            self.benchrun_threads = program_options["threads"]
        self.report_root = _config.BENCHRUN_REPORT_ROOT
        self.benchrun_options = {}

        # Set the dbpath.
        dbpath = utils.default_if_none(_config.DBPATH_PREFIX,
                                       _config.DEFAULT_DBPATH_PREFIX)
        self.dbpath = os.path.join(dbpath, "mongoebench")

        self.android_device = _config.BENCHRUN_DEVICE == "Android"
        # If Android device, then the test runs via adb shell.
        if self.android_device:
            self.adb = adb_monitor.Adb()
            self.android_benchrun_root = _config.BENCHRUN_EMBEDDED_ROOT
            self.device_report_root = posixpath.join(
                self.android_benchrun_root, "results")
            self.dbpath = posixpath.join(self.android_benchrun_root, "db")
            self.benchrun_config_file = posixpath.join(
                self.android_benchrun_root, "testcases",
                os.path.basename(self.benchrun_config_file))
            ld_library_path = "LD_LIBRARY_PATH={}".format(
                posixpath.join(self.android_benchrun_root, "sdk"))
            mongoebench = posixpath.join(self.android_benchrun_root, "sdk",
                                         "mongoebench")
            self.benchrun_executable = "adb shell {} {}".format(
                ld_library_path, mongoebench)
コード例 #3
0
    def __init__(self, logger, program_executable, program_options=None):
        """
        Initializes the BenchmarkTestCase with the executable to run.
        """

        interface.ProcessTestCase.__init__(self, logger, "Benchmark test",
                                           program_executable)

        parser.validate_benchmark_options()

        # 1. Set the default benchmark options, including the out file path, which is based on the
        #    executable path. Keep the existing extension (if any) to simplify parsing.
        bm_options = {
            "benchmark_out":
            program_executable + ".json",
            "benchmark_min_time":
            _config.DEFAULT_BENCHMARK_MIN_TIME.total_seconds(),
            "benchmark_repetitions":
            _config.DEFAULT_BENCHMARK_REPETITIONS
        }

        # 2. Override Benchmark options with options set through `program_options` in the suite
        #    configuration.
        suite_bm_options = utils.default_if_none(program_options, {})
        bm_options.update(suite_bm_options)

        # 3. Override Benchmark options with options set through resmoke's command line.
        resmoke_bm_options = {
            "benchmark_filter": _config.BENCHMARK_FILTER,
            "benchmark_list_tests": _config.BENCHMARK_LIST_TESTS,
            "benchmark_min_time": _config.BENCHMARK_MIN_TIME,
            "benchmark_out_format": _config.BENCHMARK_OUT_FORMAT,
            "benchmark_repetitions": _config.BENCHMARK_REPETITIONS
        }

        for key, value in resmoke_bm_options.items():
            if value is not None:
                # 4. sanitize options before passing them to Benchmark's command line.
                if key == "benchmark_min_time":
                    value = value.total_seconds()
                bm_options[key] = value

        self.program_options = bm_options
        self.program_executable = program_executable
コード例 #4
0
    def __init__(self, logger, mongoebench_config_file, program_options=None):
        """Initialize the BenchrunEmbeddedTestCase with the executable to run."""

        interface.ProcessTestCase.__init__(self, logger, "Benchmark embedded test",
                                           mongoebench_config_file)
        parser.validate_benchmark_options()

        self.benchrun_config_file = mongoebench_config_file

        # Command line options override the YAML configuration.
        self.benchrun_executable = utils.default_if_none(_config.MONGOEBENCH_EXECUTABLE,
                                                         _config.DEFAULT_MONGOEBENCH_EXECUTABLE)
        self.benchrun_repetitions = utils.default_if_none(_config.BENCHMARK_REPETITIONS,
                                                          _config.DEFAULT_BENCHMARK_REPETITIONS)
        self.suite_benchrun_options = program_options
        self.benchrun_threads = 1
        if program_options and "threads" in program_options:
            self.benchrun_threads = program_options["threads"]
        self.report_root = _config.BENCHRUN_REPORT_ROOT
        self.benchrun_options = {}

        # Set the dbpath.
        dbpath = utils.default_if_none(_config.DBPATH_PREFIX, _config.DEFAULT_DBPATH_PREFIX)
        self.dbpath = os.path.join(dbpath, "mongoebench")

        self.android_device = _config.BENCHRUN_DEVICE == "Android"
        # If Android device, then the test runs via adb shell.
        if self.android_device:
            self.adb = adb_monitor.Adb()
            self.android_benchrun_root = _config.BENCHRUN_EMBEDDED_ROOT
            self.device_report_root = posixpath.join(self.android_benchrun_root, "results")
            self.dbpath = posixpath.join(self.android_benchrun_root, "db")
            self.benchrun_config_file = posixpath.join(self.android_benchrun_root, "testcases",
                                                       os.path.basename(self.benchrun_config_file))
            ld_library_path = "LD_LIBRARY_PATH={}".format(
                posixpath.join(self.android_benchrun_root, "sdk"))
            mongoebench = posixpath.join(self.android_benchrun_root, "sdk", "mongoebench")
            self.benchrun_executable = "adb shell {} {}".format(ld_library_path, mongoebench)
コード例 #5
0
    def __init__(self, logger, mongoebench_config_file, program_options=None):
        """Initialize the BenchrunEmbeddedTestCase with the executable to run."""

        interface.ProcessTestCase.__init__(self, logger, "Benchmark embedded test",
                                           mongoebench_config_file)
        parser.validate_benchmark_options()

        self.benchrun_config_file = mongoebench_config_file

        # Command line options override the YAML configuration.
        self.benchrun_executable = utils.default_if_none(_config.MONGOEBENCH_EXECUTABLE,
                                                         _config.DEFAULT_MONGOEBENCH_EXECUTABLE)
        self.benchrun_repetitions = utils.default_if_none(_config.BENCHMARK_REPETITIONS,
                                                          _config.DEFAULT_BENCHMARK_REPETITIONS)
        self.suite_benchrun_options = program_options
        self.benchrun_threads = 1
        if program_options and "threads" in program_options:
            self.benchrun_threads = program_options["threads"]
        self.benchrun_options = {}

        # Set the dbpath.
        dbpath = utils.default_if_none(_config.DBPATH_PREFIX, _config.DEFAULT_DBPATH_PREFIX)
        self.dbpath = os.path.join(dbpath, "mongoebench")