settings - Command Line Arguments and Environment Variables

Environment variables and command line arguments parsing.

This is a simple module utilizing the built-in argparse module to parse command line arguments, augment them with values from environment variables and make them available across the framework.

The command line value takes precedence, followed by the environment variable value, followed by the default value defined in this module.

The command line arguments along with the supported environment variables are:

--config-file
DTS_CFG_FILE

The path to the YAML test run configuration file.

--output-dir, --output
DTS_OUTPUT_DIR

The directory where DTS logs and results are saved.

--compile-timeout
DTS_COMPILE_TIMEOUT

The timeout for compiling DPDK.

-t, --timeout
DTS_TIMEOUT

The timeout for all DTS operation except for compiling DPDK.

-v, --verbose
DTS_VERBOSE

Set to any value to enable logging everything to the console.

--dpdk-tree
DTS_DPDK_TREE

The path to the DPDK source tree directory to test. Cannot be used in conjunction with –tarball.

--tarball, --snapshot
DTS_DPDK_TARBALL

The path to the DPDK source tarball to test. DPDK must be contained in a folder with the same name as the tarball file. Cannot be used in conjunction with –dpdk-tree.

--remote-source
DTS_REMOTE_SOURCE

Set this option if either the DPDK source tree or tarball to be used are located on the SUT node. Can only be used with –dpdk-tree or –tarball.

--precompiled-build-dir
DTS_PRECOMPILED_BUILD_DIR

Define the subdirectory under the DPDK tree root directory or tarball where the pre-compiled binaries are located.

--test-suite
DTS_TEST_SUITES

A test suite with test cases which may be specified multiple times. In the environment variable, the suites are joined with a comma.

--re-run, --re_run
DTS_RERUN

Re-run each test case this many times in case of a failure.

--random-seed
DTS_RANDOM_SEED

The seed to use with the pseudo-random generator. If not specified, the configuration value is used instead. If that’s also not specified, a random seed is generated.

The module provides one key module-level variable:

SETTINGS

The module level variable storing framework-wide DTS settings.

Type:

framework.settings.Settings

Typical usage example:

from framework.settings import SETTINGS
foo = SETTINGS.foo
class Settings

Bases: object

Default framework-wide user settings.

The defaults may be modified at the start of the run.

config_file_path: Path
output_dir: str
timeout: float
verbose: bool
dpdk_location: framework.config.LocalDPDKTreeLocation | framework.config.LocalDPDKTarballLocation | framework.config.RemoteDPDKTreeLocation | framework.config.RemoteDPDKTarballLocation | None
precompiled_build_dir: str | None
compile_timeout: float
test_suites: list[framework.config.TestSuiteConfig]
re_run: int
random_seed: int | None
__init__(config_file_path: ~pathlib.Path = PosixPath('/srv/dpdk_data/doc/current/dpdk/dts/conf.yaml'), output_dir: str = 'output', timeout: float = 15, verbose: bool = False, dpdk_location: framework.config.LocalDPDKTreeLocation | framework.config.LocalDPDKTarballLocation | framework.config.RemoteDPDKTreeLocation | framework.config.RemoteDPDKTarballLocation | None = None, precompiled_build_dir: str | None = None, compile_timeout: float = 1200, test_suites: list[framework.config.TestSuiteConfig] = <factory>, re_run: int = 0, random_seed: int | None = None) None
get_settings() Settings

Create new settings with inputs from the user.

The inputs are taken from the command line and from environment variables.

Returns:

The new settings object.

Return type:

Settings