Entry point for the runner defined in setup.py.

def securitycli():
    """
    Entry point for the runner defined in setup.py.
    """

    parser = argparse.ArgumentParser(description="Runner for security test suite")
    parser.add_argument("-l", "--list-test-groups", action="store_true",
                        help="List all logical test groups")
    parser.add_argument("-a", "--list-all-tests", action="store_true",
                        help="List all tests")
    parser.add_argument("-i", "--include", metavar="GROUP", action="append", default=[],
                        help="Only include specified group(s) in run, include several "
                             "groups by repeating flag")
    parser.add_argument("--version", action="store", dest="version",
                        help="B2G version")
    parser.add_argument("--ipython", dest="ipython", action="store_true",
                        help="drop to ipython session")
    parser.add_argument('-H', '--host',
                        help='Hostname or ip for target device',
                        action='store', default='localhost')
    parser.add_argument('-P', '--port',
                        help='Port for target device',
                        action='store', default=2828)
    parser.add_argument('-m', '--mode',
                        help='Test mode (stingray, phone) default (phone)',
                        action='store', default='phone')
    parser.add_argument("-v", dest="verbose", action="store_true",
                        help="Verbose output")

    # add specialized mozilla logger options
    commandline.add_logging_group(parser)
    args = parser.parse_args()

    # set up mozilla logger
    logger = commandline.setup_logging("securitysuite", vars(args), {"raw": sys.stdout})

    try:
        if args.list_test_groups:
            for group in ExtraTest.group_list(args.mode):
                print group
        elif args.list_all_tests:
            for test in ExtraTest.test_list(args.mode):
                print "%s.%s" % (test.group, test.__name__)
        elif args.ipython:
            from IPython import embed

            embed()
        elif args.mode == 'stingray':
            logger.debug("security cli runnng with args %s" % args)
            ExtraTest.run_groups(args.include,
                                 version=args.version,
                                 host=args.host, port=int(args.port),
                                 mode=args.mode)
        else:
            logger.debug("security cli runnng with args %s" % args)
            wait_for_adb_device()
            if not adb_has_root():
                logger.warning("adb has no root. Results will be incomplete.")
            ExtraTest.run_groups(args.include, version=args.version)

    except:
        logger.critical(traceback.format_exc())
        raise