import argparse
import os
import psutil
import textwrap
import time


def positive_int_or_default(default):
    def positive_integer(v):
        if v is None or v == "":
            return default
        return int(v)
    return positive_integer


def positive_int_or_auto(v):
    if v is None or v in ("", "auto"):
        return "auto"
    if int(v) <= 0:
        raise ValueError("value must be positive or auto")
    return int(v)


def int_or_auto(v):
    if v is None or v in ("", "auto"):
        return "auto"
    if int(v) < 0:
        raise ValueError("value must be positive or auto")
    return int(v)


def int_choice_or_default(options, default):
    assert default in options

    def choice(v):
        if v is None or v == "":
            return default
        if int(v) in options:
            return int(v)
        raise ValueError("invalid choice")
    return choice


def worker_config(v):
    if v is None or v == "":
        return 0
    if v.startswith("workers "):
        return(int(v.split(" ")[1]))
    return int(v)


def directory(v):
    if not os.path.isdir(v):
        raise ValueError(f"provided path '{v}' doesn't exist "
                         "or is not a directory")
    return v


def directory_verify_or_create(v):
    if not os.path.isdir(v):
        os.mkdir(v)
    return v


parser = argparse.ArgumentParser(description="VPP unit tests",
                                 formatter_class=argparse.RawTextHelpFormatter)

parser.add_argument("--failfast", action="store_true",
                    help="stop running tests on first failure")

parser.add_argument("--test-src-dir", action="append", type=directory,
                    help="directory containing test files "
                    "(may be specified multiple times) "
                    "(VPP_WS_DIR/test is added automatically to the set)")

default_verbose = 0

parser.add_argument("--verbose", action="store", default=default_verbose,
                    type=int_choice_or_default((0, 1, 2), default_verbose),
                    help="verbosity setting - 0 - least verbose, "
                    "2 - most verbose (default: 0)")

default_test_run_timeout = 600

parser.add_argument("--timeout", action="store",
                    type=positive_int_or_default(default_test_run_timeout),
                    default=default_test_run_timeout,
                    metavar="TEST_RUN_TIMEOUT",
                    help="test run timeout in seconds - per test "
                    f"(default: {default_test_run_timeout})")

parser.add_argument("--failed-dir", action="store", type=directory,
                    help="directory containing failed tests")

filter_help_string = """\
expression consists of 3 string selectors separated by '.' separators:

    <file>.<class>.<function>

- selectors restrict which files/classes/functions are run
- selector can be replaced with '*' or omitted entirely if not needed
- <file> selector is automatically prepended with 'test_' if required
- '.' separators are required only if selector(s) follow(s)

examples:

1. all of the following expressions are equivalent and will select
   all test classes and functions from test_bfd.py:
   'test_bfd' 'bfd' 'test_bfd..' 'bfd.' 'bfd.*.*' 'test_bfd.*.*'
2. 'bfd.BFDAPITestCase' selects all tests from test_bfd.py,
   which are part of BFDAPITestCase class
3. 'bfd.BFDAPITestCase.test_add_bfd' selects a single test named
   test_add_bfd from test_bfd.py/BFDAPITestCase
4. '.*.test_add_bfd' selects all test functions named test_add_bfd
   from all files/classes
"""
parser.add_argument("--filter", action="store",
                    metavar="FILTER_EXPRESSION", help=filter_help_string)

default_retries = 0

parser.add_argument("--retries", action="store", default=default_retries,
                    type=positive_int_or_default(default_retries),
                    help="retry failed tests RETRIES times")

parser.add_argument("--step", action="store_true", default=False,
                    help="enable stepping through tests")

debug_help_string = """\
attach     - attach to already running vpp
core       - detect coredump and load core in gdb on crash
gdb        - print VPP PID and pause allowing attaching gdb
gdbserver  - same as above, but run gdb in gdbserver
"""

parser.add_argument("--debug", action="store",
                    choices=["attach", "core", "gdb", "gdbserver"],
                    help=debug_help_string)

parser.add_argument("--debug-framework", action="store_true",
                    help="enable internal test framework debugging")

parser.add_argument("--compress-core", action="store_true",
                    help="compress core files if not debugging them")

parser.add_argument("--extended", action="store_true",
                    help="run extended tests")

parser.add_argument("--sanity", action="store_true",
                    help="perform sanity vpp run before running tests")

parser.add_argument("--force-foreground", action="store_true",
                    help="force running in foreground - don't fork")

parser.add_argument("--jobs", action="store", type=positive_int_or_auto,
                    default="auto", help="maximum concurrent test jobs")

parser.add_argument("--venv-dir", action="store",
                    type=directory, help="path to virtual environment")

default_rnd_seed = time.time()
parser.add_argument("--rnd-seed", action="store", default=default_rnd_seed,
                    type=positive_int_or_default(default_rnd_seed),
                    help="random generator seed (default: current time)")

parser.add_argument("--vpp-worker-count", action="store", type=worker_config,
                    default=0, help="number of vpp workers")

parser.add_argument("--gcov", action="store_true",
                    default=False, help="running gcov tests")

parser.add_argument("--cache-vpp-output", action="store_true", default=False,
                    help="cache VPP stdout/stderr and log as one block "
                    "after test finishes")

parser.add_argument("--vpp-ws-dir", action="store", required=True,
                    type=directory, help="vpp workspace directory")

parser.add_argument("--vpp-tag", action="store", default="vpp_debug",
                    metavar="VPP_TAG", required=True,
                    help="vpp tag (e.g. vpp, vpp_debug, vpp_gcov)")

parser.add_argument("--vpp", action="store", help="path to vpp binary "
                    "(default: derive from VPP_WS_DIR and VPP_TAG)")

parser.add_argument("--vpp-install-dir", type=directory,
                    action="store", help="path to vpp install directory"
                    "(default: derive from VPP_WS_DIR and VPP_TAG)")

parser.add_argument("--vpp-build-dir", action="store", type=directory,
                    help="vpp build directory"
                    "(default: derive from VPP_WS_DIR and VPP_TAG)")

parser.add_argument("--vpp-plugin-dir", action="append", type=directory,
                    help="directory containing vpp plugins"
                    "(default: derive from VPP_WS_DIR and VPP_TAG)")

parser.add_argument("--vpp-test-plugin-dir", action="append", type=directory,
                    help="directory containing vpp api test plugins"
                    "(default: derive from VPP_WS_DIR and VPP_TAG)")

parser.add_argument("--extern-plugin-dir", action="append", type=directory,
                    default=[], help="directory containing external plugins")

parser.add_argument("--coredump-size", action="store", default="unlimited",
                    help="specify vpp coredump size")

parser.add_argument("--max-vpp-cpus", action="store", type=int_or_auto,
                    default=0, help="max cpus used by vpp")

variant_help_string = """\
specify which march node variant to unit test
  e.g. --variant=skx - test the skx march variants
  e.g. --variant=icl - test the icl march variants
"""

parser.add_argument("--variant", action="store", help=variant_help_string)

parser.add_argument("--api-fuzz", action="store", default=None,
                    help="specify api fuzzing parameters")

parser.add_argument("--wipe-tmp-dir", action="store_true", default=True,
                    help="remove test tmp directory before running test")

parser.add_argument("--tmp-dir", action="store", default="/tmp",
                    type=directory_verify_or_create,
                    help="directory where to store test temporary directories")

parser.add_argument("--log-dir", action="store",
                    type=directory_verify_or_create,
                    help="directory where to store directories "
                    "containing log files (default: --tmp-dir)")

default_keep_pcaps = False
parser.add_argument("--keep-pcaps", action="store_true",
                    default=default_keep_pcaps,
                    help="if set, keep all pcap files from a test run"
                    f" (default: {default_keep_pcaps})")

config = parser.parse_args()

ws = config.vpp_ws_dir
br = f"{ws}/build-root"
tag = config.vpp_tag

if config.vpp_install_dir is None:
    config.vpp_install_dir = f"{br}/install-{tag}-native"

if config.vpp is None:
    config.vpp = f"{config.vpp_install_dir}/vpp/bin/vpp"

if config.vpp_build_dir is None:
    config.vpp_build_dir = f"{br}/build-{tag}-native"

libs = ["lib", "lib64"]

if config.vpp_plugin_dir is None:
    config.vpp_plugin_dir = [
        f"{config.vpp_install_dir}/vpp/{lib}/vpp_plugins" for lib in libs]

if config.vpp_test_plugin_dir is None:
    config.vpp_test_plugin_dir = [
        f"{config.vpp_install_dir}/vpp/{lib}/vpp_api_test_plugins"
        for lib in libs]

test_dirs = [f"{ws}/test"]

if config.test_src_dir is not None:
    test_dirs.extend(config.test_src_dir)

config.test_src_dir = test_dirs


if config.venv_dir is None:
    config.venv_dir = f"{ws}/test/venv"

available_cpus = psutil.Process().cpu_affinity()
num_cpus = len(available_cpus)

if config.max_vpp_cpus == 'auto':
    max_vpp_cpus = num_cpus
elif config.max_vpp_cpus > 0:
    max_vpp_cpus = min(config.max_vpp_cpus, num_cpus)
else:
    max_vpp_cpus = num_cpus

if __name__ == "__main__":
    print("Provided arguments:")
    for i in config.__dict__:
        print(f"  {i} is {config.__dict__[i]}")
