Beispiel #1
0
def prepare_chain(seed, loop, node_dir=None) -> Chain:
    """ Prepare to chain class
    :param str seed: keystore password

    :param EventLoop loop: event loop.
    :param Union[None, str] node_dir: directory path
    :return: Chain class
    >>> prepare_chain('seed', EventLoop, Optional[Union[None, './test']])
    >>> return Chain
    """
    start_time = datetime.datetime.now()
    config_path = get_path(node_dir)

    db_context = prepare_database(config_path)

    node_base, node_key = load_node_base(config_path.node, seed)

    signer = ECSigner(node_key)

    chain = Chain(db_context=db_context,
                  signer=signer,
                  node_base=node_base,
                  start_at=start_time,
                  loop=loop)

    if not chain.block_from_genesis():
        height = chain.height
        header = chain.get_header_from_height(height)
        db_context.state.set_root(header.hash_state_root)

    return chain
Beispiel #2
0
 def __init__(self, param):
     self.results = {}
     self.results['results'] = []
     self.param = param
     self.time_stamp = param['time_stamp']
     self.device = param['device']
     self.log_path = "./logs/" + param['time_stamp']
     self.log_path = util.get_path(self.log_path)
     if not os.path.exists(self.log_path):
         os.mkdir(self.log_path)
Beispiel #3
0
    def test(self, param):
        base_path = util.get_path('./logs/robotium')
        time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
        self.output = os.path.join(base_path, time_stamp)
        if not os.path.exists(self.output):
            os.makedirs(self.output)

        self.tm = ThreadManager(self.devices)
        for d in param:
            task = Task(d, time_stamp)
            self.tm.add_job(task)

        self.tm.wait_for_complete()
        self.results = self.tm.get_all_results()
        return self.results
Beispiel #4
0
    def parse_log(self, timestamp):
        log_path = os.path.join(util.get_path('./logs'), timestamp)

        if os.path.exists(log_path):
            pass