Beispiel #1
0
def main():
    """Main."""
    if os.geteuid() == 0:  # root privileges are not needed
        sys.exit("Please do not run this program as root.")

    args = parse_args()

    pts = autoptsclient.init_core(args.server_address, args.workspace, None,
                                  args.enable_max_logs)

    btp.init(get_iut)

    autoprojects.iutctl.AUTO_PTS_LOCAL = autoptsclient.AUTO_PTS_LOCAL
    autoprojects.iutctl.init(args.btpclient_path)

    stack.init_stack()

    test_cases = autoprojects.gap.test_cases(pts)
    test_cases += autoprojects.sm.test_cases(pts)

    if args.test_cases:
        test_cases = autoptsclient.get_test_cases_subset(
            test_cases, args.test_cases)

    autoptsclient.run_test_cases(pts, test_cases)

    autoprojects.iutctl.cleanup()

    print "\nBye!"
    sys.stdout.flush()

    pts.unregister_xmlrpc_ptscallback()

    # not the cleanest but the easiest way to exit the server thread
    os._exit(0)
def main():
    """Main."""
    if os.geteuid() == 0:  # root privileges are not needed
        sys.exit("Please do not run this program as root.")

    args = parse_args()

    if args.store:
        tc_db_table_name = "zephyr_" + str(args.board)
    else:
        tc_db_table_name = None

    callback_thread = autoptsclient.init_core()

    ptses = []
    for ip, local in zip(args.ip_addr, args.local_addr):
        ptses.append(
            autoptsclient.init_pts(ip, args.workspace, args.bd_addr,
                                   args.enable_max_logs, callback_thread,
                                   tc_db_table_name, local))

    btp.init(get_iut)
    autoprojects.iutctl.init(args.kernel_image, args.tty_file, args.board)

    stack.init_stack()
    stack_inst = stack.get_stack()
    stack_inst.synch_init(callback_thread.set_pending_response,
                          callback_thread.clear_pending_responses)

    test_cases = autoprojects.gap.test_cases(ptses[0])
    test_cases += autoprojects.gatt.test_cases(ptses[0])
    test_cases += autoprojects.sm.test_cases(ptses[0])
    test_cases += autoprojects.l2cap.test_cases(ptses[0])
    if len(ptses) >= 2:
        mesh_test_cases, additional_mesh_test_cases \
            = autoprojects.mesh.test_cases(ptses)
        test_cases += mesh_test_cases
        additional_test_cases = additional_mesh_test_cases
    else:
        additional_test_cases = []

    if args.test_cases or args.excluded:
        test_cases = autoptsclient.get_test_cases_subset(
            test_cases, args.test_cases, args.excluded)

    autoptsclient.run_test_cases(ptses, test_cases, additional_test_cases,
                                 args.retry)

    autoprojects.iutctl.cleanup()

    print "\nBye!"
    sys.stdout.flush()

    for pts in ptses:
        pts.unregister_xmlrpc_ptscallback()

    # not the cleanest but the easiest way to exit the server thread
    os._exit(0)
def main():
    """Main."""
    if os.geteuid() == 0:  # root privileges are not needed
        sys.exit("Please do not run this program as root.")

    args = parse_args()

    callback_thread = autoptsclient.init_core()

    ptses = []
    for ip in args.ip_addr:
        ptses.append(
            autoptsclient.init_pts(ip, args.workspace, args.bd_addr,
                                   args.enable_max_logs, callback_thread, None,
                                   args.local_addr))

    btp.init(get_iut)

    autoprojects.iutctl.AUTO_PTS_LOCAL = autoptsclient.AUTO_PTS_LOCAL
    autoprojects.iutctl.init(args.btpclient_path)

    stack.init_stack()
    stack_inst = stack.get_stack()
    stack_inst.synch_init(callback_thread.set_pending_response,
                          callback_thread.clear_pending_responses)

    test_cases = autoprojects.gap.test_cases(ptses[0])
    test_cases += autoprojects.sm.test_cases(ptses[0])

    additional_test_cases = []

    if args.test_cases:
        test_cases = autoptsclient.get_test_cases_subset(
            test_cases, args.test_cases)

    autoptsclient.run_test_cases(ptses, test_cases, additional_test_cases, 0)

    autoprojects.iutctl.cleanup()

    print "\nBye!"
    sys.stdout.flush()

    for pts in ptses:
        pts.unregister_xmlrpc_ptscallback()

    # not the cleanest but the easiest way to exit the server thread
    os._exit(0)
Beispiel #4
0
def run_tests(args, iut_config):
    """Run test cases
    :param args: AutoPTS arguments
    :param iut_config: IUT configuration
    :return: tuple of (status, results) dictionaries
    """
    results = {}
    status = {}
    descriptions = {}
    total_regressions = []

    callback_thread = autoptsclient.init_core()

    ptses = []
    for ip, local in zip(args['server_ip'], args['local_ip']):
        ptses.append(
            autoptsclient.init_pts(ip, args["workspace"], args["bd_addr"],
                                   args["enable_max_logs"], callback_thread,
                                   "zephyr_" + str(args["board"]), local))

    btp.init(get_iut)
    # Main instance of PTS
    pts = ptses[0]

    # Read PTS Version and keep it for later use
    args['pts_ver'] = "%x" % pts.get_version()

    stack.init_stack()
    stack_inst = stack.get_stack()
    stack_inst.synch_init(callback_thread.set_pending_response,
                          callback_thread.clear_pending_responses)
    cache = autoptsclient.cache_workspace(pts)

    default_conf = "default.conf"
    default_to_omit = []

    for config, value in iut_config.items():
        for test_case in value.get('test_cases', []):
            default_to_omit.append(test_case)
        if 'test_cases' not in value:
            default_conf = config

    for config, value in iut_config.items():
        if 'overlay' in value:
            apply_overlay(args["project_path"], default_conf, config,
                          value['overlay'])
            to_run = value['test_cases']
            to_omit = None
        elif 'test_cases' not in value:  # DEFAULT CASE
            to_run = None
            to_omit = default_to_omit
        else:
            continue

        tty = build_and_flash(args["project_path"],
                              autopts2board[args["board"]], config)
        logging.debug("TTY path: %s" % tty)

        flush_serial(tty)
        time.sleep(10)

        autoprojects.iutctl.init(args["kernel_image"], tty, args["board"])

        # Setup project PIXITS
        autoprojects.gap.set_pixits(ptses[0])
        autoprojects.gatt.set_pixits(ptses[0])
        autoprojects.sm.set_pixits(ptses[0])
        autoprojects.l2cap.set_pixits(ptses[0])
        autoprojects.mesh.set_pixits(ptses)

        test_cases, additional_test_cases = get_test_cases(ptses)
        if to_run or to_omit:
            test_cases = autoptsclient.get_test_cases_subset(
                test_cases, to_run, to_omit)

        status_count, results_dict, regressions = autoptsclient.run_test_cases(
            ptses, test_cases, additional_test_cases, int(args["retry"]))
        total_regressions += regressions

        for k, v in status_count.items():
            if k in status.keys():
                status[k] += v
            else:
                status[k] = v

        results.update(results_dict)
        autoprojects.iutctl.cleanup()

    for test_case_name in results.keys():
        descriptions[test_case_name] = \
            autoptsclient.get_test_case_description(cache, test_case_name)

    autoptsclient.cache_cleanup(cache)

    pts.unregister_xmlrpc_ptscallback()

    return status, results, descriptions, total_regressions