[PATCH v5 2/3] dts: constrain DPDK source argument
Juraj Linkeš
juraj.linkes at pantheon.tech
Thu May 30 17:41:19 CEST 2024
> diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst
> index 6993443389..f64ab7f732 100644
> --- a/doc/guides/tools/dts.rst
> +++ b/doc/guides/tools/dts.rst
> @@ -215,41 +215,38 @@ DTS is run with ``main.py`` located in the ``dts`` directory after entering Poet
> .. code-block:: console
>
> (dts-py3.10) $ ./main.py --help
> - usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [-s] [--tarball FILE_PATH]
> + usage: main.py [-h] [--config-file FILE_PATH] [--output-dir DIR_PATH] [-t SECONDS] [-v] [-s] (--tarball FILE_PATH | --revision ID)
> [--compile-timeout SECONDS] [--test-suite TEST_SUITE [TEST_CASES ...]] [--re-run N_TIMES]
>
> - Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command
> - line arguments have higher priority.
> + Run DPDK test suites. All options may be specified with the environment variables provided in brackets. Command line arguments have higher
> + priority.
>
> options:
> -h, --help show this help message and exit
> --config-file FILE_PATH
> - [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and targets.
> - (default: conf.yaml)
> + [DTS_CFG_FILE] The configuration file that describes the test cases, SUTs and targets. (default:
> + /home/lucviz01/dpdk/dts/conf.yaml)
The path has changed.
> diff --git a/dts/framework/settings.py b/dts/framework/settings.py
> index b19f274f9d..50d8929450 100644
> --- a/dts/framework/settings.py
> +++ b/dts/framework/settings.py
> @@ -84,7 +90,24 @@
> from typing import Callable, ParamSpec
>
> from .config import TestSuiteConfig
> -from .utils import DPDKGitTarball
> +from .exception import ConfigurationError
> +from .utils import DPDKGitTarball, get_commit_id
> +
> +
> +def _parse_tarball_path(file_path: str) -> Path:
> + """Validate whether `file_path` is valid and return a Path object."""
> + path = Path(file_path)
> + if not path.exists() or not path.is_file():
> + raise argparse.ArgumentTypeError("The file path provided is not a valid file")
> + return path
> +
> +
> +def _parse_revision_id(rev_id: str) -> str:
> + """Validate revision ID and retrieve corresponding commit ID."""
> + try:
> + return get_commit_id(rev_id)
> + except ConfigurationError:
> + raise argparse.ArgumentTypeError("The Git revision ID supplied is invalid or ambiguous")
I made the comment about ordering in the other patch with these
functions in mind, so let's not forget these.
More information about the dev
mailing list