Esempio n. 1
0
def main():
    # TODO unicode support
    # TODO parameterize reorder engine type
    parser = argparse.ArgumentParser(description="Store reordering tool")
    parser.add_argument("-l",
                        "--logfile",
                        required=True,
                        help="the pmemcheck log file to process")
    parser.add_argument("-c",
                        "--checker",
                        required=True,
                        choices=consistencycheckwrap.checkers,
                        help="choose consistency checker type")
    parser.add_argument("-p",
                        "--path",
                        required=True,
                        help="path to the consistency checker and arguments",
                        nargs='+')
    parser.add_argument("-n",
                        "--name",
                        help="consistency check function " +
                        "for the 'lib' checker")
    parser.add_argument("-t",
                        "--output_type",
                        choices=loggingfacility.loggers,
                        default="print",
                        help='choose logger type, default="print"')
    parser.add_argument("-o", "--output", help="set the logger output")
    parser.add_argument("-e",
                        "--output_level",
                        choices=loggingfacility.log_levels,
                        help="set the output log level")
    engines_keys = list(reorderengines.engines.keys())
    parser.add_argument("-r",
                        "--default_engine",
                        help="set default reorder engine, default=full",
                        choices=engines_keys,
                        default=engines_keys[0])
    args = parser.parse_args()

    logger = loggingfacility.get_logger(args.output_type, args.output,
                                        args.output_level)
    checker = consistencycheckwrap.get_checker(args.checker,
                                               ' '.join(args.path), args.name)
    engine = reorderengines.get_engine(args.default_engine)

    # create the script context
    context = opscontext.OpsContext(args.logfile, checker, logger, engine)

    # init and run the state machine
    a = statemachine.StateMachine(statemachine.InitState(context))
    if a.run_all(context.extract_operations()) is False:
        sys.exit(1)
Esempio n. 2
0
def main():
    # TODO unicode support
    # TODO parameterize reorder engine type
    parser = argparse.ArgumentParser(description="Store reordering tool")
    parser.add_argument("-l", "--logfile",
                        required=True,
                        help="the pmemcheck log file to process")
    parser.add_argument("-c", "--checker",
                        required=True,
                        choices=consistencycheckwrap.checkers,
                        help="choose consistency checker type")
    parser.add_argument("-p", "--path",
                        required=True,
                        help="path to the consistency checker and arguments",
                        nargs='+')
    parser.add_argument("-n", "--name",
                        help="consistency check function " +
                        "for the 'lib' checker")
    parser.add_argument("-o", "--output",
                        help="set the logger output file")
    parser.add_argument("-e", "--output_level",
                        choices=loggingfacility.log_levels,
                        help="set the output log level")
    engines_keys = list(reorderengines.engines.keys())
    parser.add_argument("-r", "--default_engine",
                        help="set default reorder engine, default=full",
                        choices=engines_keys,
                        default=engines_keys[0])
    args = parser.parse_args()

    logger = loggingfacility.get_logger(
                                        args.output,
                                        args.output_level)
    checker = consistencycheckwrap.get_checker(
                                               args.checker,
                                               ' '.join(args.path),
                                               args.name)
    engine = reorderengines.get_engine(args.default_engine)

    # create the script context
    context = opscontext.OpsContext(args.logfile, checker, logger, engine)

    # init and run the state machine
    a = statemachine.StateMachine(statemachine.InitState(context))
    if a.run_all(context.extract_operations()) is False:
        sys.exit(1)
Esempio n. 3
0
    def __init__(self, log_file, checker, logger, arg_engine, markers):
        """
        Splits the operations in the log file and sets the instance variables
        to default values.

        :param log_file: The full name of the log file.
        :type log_file: str
        :return: None
        """
        # TODO reading the whole file at once is rather naive
        # change in the future
        self._operations = open(log_file).read().split("|")
        engine = reorderengines.get_engine(arg_engine)
        self.reorder_engine = engine
        self.test_on_barrier = engine.test_on_barrier
        self.default_engine = self.reorder_engine
        self.default_barrier = self.default_engine.test_on_barrier
        self.file_handler = BinaryOutputHandler(checker, logger)
        self.checker = checker
        self.logger = logger
        self.markers = markers
        self.stack_engines = [("START", getattr(memoryoperations, arg_engine))]
Esempio n. 4
0
    def __init__(self, log_file, checker, logger, arg_engine, markers):
        """
        Splits the operations in the log file and sets the instance variables
        to default values.

        :param log_file: The full name of the log file.
        :type log_file: str
        :return: None
        """
        # TODO reading the whole file at once is rather naive
        # change in the future
        self._operations = open(log_file).read().split("|")
        engine = reorderengines.get_engine(arg_engine)
        self.reorder_engine = engine
        self.test_on_barrier = engine.test_on_barrier
        self.default_engine = self.reorder_engine
        self.default_barrier = self.default_engine.test_on_barrier
        self.file_handler = BinaryOutputHandler(checker)
        self.checker = checker
        self.logger = logger
        self.markers = markers
        self.stack_engines = [('START', getattr(memoryoperations, arg_engine))]