DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
To: thomas@monjalon.net, david.marchand@redhat.com,
	ronan.randles@intel.com, Honnappa.Nagarahalli@arm.com,
	ohilyard@iol.unh.edu, lijuan.tu@intel.com
Cc: dev@dpdk.org, "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [RFC PATCH v1 02/10] dts: hello world cli parameters and env vars
Date: Wed, 24 Aug 2022 16:24:46 +0000	[thread overview]
Message-ID: <20220824162454.394285-3-juraj.linkes@pantheon.tech> (raw)
In-Reply-To: <20220824162454.394285-1-juraj.linkes@pantheon.tech>

Add command line arguments (and the corresponding env variables) that
specify DPDK build and test execution workflow.

Also split the configuration into two parts, one that can be changed
during runtime and one that can't. We will need to change the git
refspec to a DPDK tarball path when support is added for building DPDK
from the repo.

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 dts/framework/logger.py   |  9 ++--
 dts/framework/settings.py | 96 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 96 insertions(+), 9 deletions(-)

diff --git a/dts/framework/logger.py b/dts/framework/logger.py
index 920ce0fb15..15cae3e4f9 100644
--- a/dts/framework/logger.py
+++ b/dts/framework/logger.py
@@ -8,6 +8,8 @@
 import os.path
 from typing import TypedDict
 
+from .settings import SETTINGS
+
 """
 DTS logger module with several log level. DTS framework and TestSuite log
 will saved into different log files.
@@ -66,10 +68,9 @@ def __init__(self, logger: logging.Logger, node: str = "suite"):
         self.logger.addHandler(sh)
         self.sh = sh
 
-        if not os.path.exists("output"):
-            os.mkdir("output")
+        logging_file_prefix = os.path.join(SETTINGS.output_dir, node)
 
-        fh = logging.FileHandler(f"output/{node}.log")
+        fh = logging.FileHandler(f"{logging_file_prefix}.log")
         fh.setFormatter(
             logging.Formatter(
                 fmt="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
@@ -83,7 +84,7 @@ def __init__(self, logger: logging.Logger, node: str = "suite"):
 
         # This outputs EVERYTHING, intended for post-mortem debugging
         # Also optimized for processing via AWK (awk -F '|' ...)
-        verbose_handler = logging.FileHandler(f"output/{node}.verbose.log")
+        verbose_handler = logging.FileHandler(f"{logging_file_prefix}.verbose.log")
         verbose_handler.setFormatter(
             logging.Formatter(
                 fmt="%(asctime)s|%(name)s|%(levelname)s|%(pathname)s|%(lineno)d|%(funcName)s|"
diff --git a/dts/framework/settings.py b/dts/framework/settings.py
index c9621d4e3d..1ff3af4438 100644
--- a/dts/framework/settings.py
+++ b/dts/framework/settings.py
@@ -7,6 +7,7 @@
 import argparse
 import os
 from dataclasses import dataclass
+from enum import Enum, unique
 from typing import Any
 
 
@@ -38,10 +39,40 @@ def wrapper(**kwargs) -> _EnvironmentArgument:
 
 
 @dataclass(slots=True, frozen=True)
-class _Settings:
+class _EnvSettings:
     config_file_path: str
+    compile_timeout: int
     timeout: float
     verbose: bool
+    output_dir: str
+    skip_setup: bool
+    test_cases: list
+    re_run: int
+    remote_dpdk_dir: str
+
+
+@dataclass(slots=True)
+class _RuntimeSettings:
+    dpdk_ref: str
+
+
+class _Settings(_EnvSettings, _RuntimeSettings):
+    pass
+
+
+@unique
+class DTSRuntimeErrors(Enum):
+    NO_ERR = 0
+    GENERIC_ERR = 1
+    DPDK_BUILD_ERR = (2,)
+    SUT_SETUP_ERR = (3,)
+    TG_SETUP_ERR = (4,)
+    SUITE_SETUP_ERR = (5,)
+    SUITE_EXECUTE_ERR = 6
+
+
+# TODO singleton
+DTSRuntimeError: DTSRuntimeErrors = DTSRuntimeErrors.NO_ERR
 
 
 def _get_parser() -> argparse.ArgumentParser:
@@ -63,6 +94,14 @@ def _get_parser() -> argparse.ArgumentParser:
         help="[DTS_TIMEOUT] The default timeout for all DTS operations except for compiling DPDK.",
     )
 
+    parser.add_argument(
+        "--compile-timeout",
+        action=_env_arg("DTS_COMPILE_TIMEOUT"),
+        default=1200,
+        required=False,
+        help="[DTS_COMPILE_TIMEOUT] The timeout for compiling DPDK.",
+    )
+
     parser.add_argument(
         "-v",
         "--verbose",
@@ -72,15 +111,62 @@ def _get_parser() -> argparse.ArgumentParser:
         help="[DTS_VERBOSE] Set to 'Y' to enable verbose output, logging all messages to the console.",
     )
 
+    parser.add_argument(
+        "--dpdk-ref",
+        "--git",
+        "--snapshot",
+        action=_env_arg("DTS_DPDK_REF"),
+        default="dep/dpdk.tar.gz",
+        help="[DTS_DPDK_REF] Reference to DPDK source code, "
+        "can be either a path to a tarball or a git refspec. "
+        "In case of a tarball, it will be extracted in the same directory.",
+    )
+
+    parser.add_argument(
+        "--output-dir",
+        "--output",
+        action=_env_arg("DTS_OUTPUT_DIR"),
+        default="output",
+        help="[DTS_OUTPUT_DIR] Output directory where dts logs and results are saved.",
+    )
+
+    parser.add_argument(
+        "-s",
+        "--skip-setup",
+        action=_env_arg("DTS_SKIP_SETUP"),
+        help="[DTS_SKIP_SETUP] Set to 'Y' to skip all setup steps on SUT and TG nodes.",
+    )
+
+    parser.add_argument(
+        "--test-cases",
+        action=_env_arg("DTS_TESTCASES"),
+        help="[DTS_TESTCASES] Comma-separated list of testcases to execute",
+    )
+
+    parser.add_argument(
+        "--re-run",
+        "--re_run",
+        action=_env_arg("DTS_RERUN"),
+        default=0,
+        help="[DTS_RERUN] Re-run tests the specified amount of times if a test failure occurs",
+    )
+
     return parser
 
 
 def _get_settings() -> _Settings:
-    args = _get_parser().parse_args()
+    parsed_args = _get_parser().parse_args()
     return _Settings(
-        config_file_path=args.config_file,
-        timeout=float(args.timeout),
-        verbose=(args.verbose == "Y"),
+        config_file_path=parsed_args.config_file,
+        compile_timeout=parsed_args.compile_timeout,
+        timeout=parsed_args.timeout,
+        verbose=(parsed_args.verbose == "Y"),
+        output_dir=parsed_args.output_dir,
+        skip_setup=(parsed_args.skip_setup == "Y"),
+        test_cases=parsed_args.test_cases.split(","),
+        re_run=int(parsed_args.re_run),
+        remote_dpdk_dir="/tmp/",
+        dpdk_ref=parsed_args.dpdk_ref,
     )
 
 
-- 
2.30.2


  parent reply	other threads:[~2022-08-24 16:25 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 16:24 [RFC PATCH v1 00/10] dts: add hello world testcase Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 01/10] dts: hello world config options Juraj Linkeš
2022-08-24 16:24 ` Juraj Linkeš [this message]
2022-08-24 16:24 ` [RFC PATCH v1 03/10] dts: ssh connection additions for hello world Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 04/10] dts: add basic node management methods Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 05/10] dts: add system under test node Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 06/10] dts: add traffic generator node Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 07/10] dts: add testcase and basic test results Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 08/10] dts: add test runner and statistics collector Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 09/10] dts: add hello world testplan Juraj Linkeš
2022-08-24 16:24 ` [RFC PATCH v1 10/10] dts: add hello world testsuite Juraj Linkeš
2022-11-14 16:54 ` [RFC PATCH v2 00/10] dts: add hello world testcase Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 01/10] dts: add node and os abstractions Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 02/10] dts: add ssh command verification Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 03/10] dts: add dpdk build on sut Juraj Linkeš
2022-11-16 13:15     ` Owen Hilyard
     [not found]       ` <30ad4f7d087d4932845b6ca13934b1d2@pantheon.tech>
     [not found]         ` <CAHx6DYDOFMuEm4xc65OTrtUmGBtk8Z6UtSgS2grnR_RBY5HcjQ@mail.gmail.com>
2022-11-23 12:37           ` Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 04/10] dts: add dpdk execution handling Juraj Linkeš
2022-11-16 13:28     ` Owen Hilyard
     [not found]       ` <df13ee41efb64e7bb37791f21ae5bac1@pantheon.tech>
     [not found]         ` <CAHx6DYCEYxZ0Osm6fKhp3Jx8n7s=r7qVh8R41c6nCan8Or-dpA@mail.gmail.com>
2022-11-23 13:03           ` Juraj Linkeš
2022-11-28 13:05             ` Owen Hilyard
2022-11-14 16:54   ` [RFC PATCH v2 05/10] dts: add node memory setup Juraj Linkeš
2022-11-16 13:47     ` Owen Hilyard
2022-11-23 13:58       ` Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 06/10] dts: add test results module Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 07/10] dts: add simple stats report Juraj Linkeš
2022-11-16 13:57     ` Owen Hilyard
2022-11-14 16:54   ` [RFC PATCH v2 08/10] dts: add testsuite class Juraj Linkeš
2022-11-16 15:15     ` Owen Hilyard
2022-11-14 16:54   ` [RFC PATCH v2 09/10] dts: add hello world testplan Juraj Linkeš
2022-11-14 16:54   ` [RFC PATCH v2 10/10] dts: add hello world testsuite Juraj Linkeš
2023-01-17 15:48   ` [PATCH v3 00/10] dts: add hello world testcase Juraj Linkeš
2023-01-17 15:48     ` [PATCH v3 01/10] dts: add node and os abstractions Juraj Linkeš
2023-01-17 15:48     ` [PATCH v3 02/10] dts: add ssh command verification Juraj Linkeš
2023-01-17 15:48     ` [PATCH v3 03/10] dts: add dpdk build on sut Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 04/10] dts: add dpdk execution handling Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 05/10] dts: add node memory setup Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 06/10] dts: add test suite module Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 07/10] dts: add hello world testplan Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 08/10] dts: add hello world testsuite Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 09/10] dts: add test suite config and runner Juraj Linkeš
2023-01-17 15:49     ` [PATCH v3 10/10] dts: add test results module Juraj Linkeš
2023-01-19 16:16     ` [PATCH v3 00/10] dts: add hello world testcase Owen Hilyard
2023-02-09 16:47       ` Patrick Robb
2023-02-13 15:28     ` [PATCH v4 " Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 01/10] dts: add node and os abstractions Juraj Linkeš
2023-02-17 17:44         ` Bruce Richardson
2023-02-20 13:24           ` Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 02/10] dts: add ssh command verification Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 03/10] dts: add dpdk build on sut Juraj Linkeš
2023-02-22 16:44         ` Bruce Richardson
2023-02-13 15:28       ` [PATCH v4 04/10] dts: add dpdk execution handling Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 05/10] dts: add node memory setup Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 06/10] dts: add test suite module Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 07/10] dts: add hello world testsuite Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 08/10] dts: add test suite config and runner Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 09/10] dts: add test results module Juraj Linkeš
2023-02-13 15:28       ` [PATCH v4 10/10] doc: update DTS setup and test suite cookbook Juraj Linkeš
2023-02-17 17:26       ` [PATCH v4 00/10] dts: add hello world testcase Bruce Richardson
2023-02-20 10:13         ` Juraj Linkeš
2023-02-20 11:56           ` Bruce Richardson
2023-02-22 16:39           ` Bruce Richardson
2023-02-23  8:27             ` Juraj Linkeš
2023-02-23  9:17               ` Bruce Richardson
2023-02-23 15:28       ` [PATCH v5 " Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 01/10] dts: add node and os abstractions Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 02/10] dts: add ssh command verification Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 03/10] dts: add dpdk build on sut Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 04/10] dts: add dpdk execution handling Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 05/10] dts: add node memory setup Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 06/10] dts: add test suite module Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 07/10] dts: add hello world testsuite Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 08/10] dts: add test suite config and runner Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 09/10] dts: add test results module Juraj Linkeš
2023-02-23 15:28         ` [PATCH v5 10/10] doc: update DTS setup and test suite cookbook Juraj Linkeš
2023-03-03  8:31           ` Huang, ChenyuX
2023-02-23 16:13         ` [PATCH v5 00/10] dts: add hello world testcase Bruce Richardson
2023-02-26 19:11         ` Wathsala Wathawana Vithanage
2023-02-27  8:28           ` Juraj Linkeš
2023-02-28 15:27             ` Wathsala Wathawana Vithanage
2023-03-01  8:35               ` Juraj Linkeš
2023-03-03 10:24         ` [PATCH v6 00/10] dts: add hello world test case Juraj Linkeš
2023-03-03 10:24           ` [PATCH v6 01/10] dts: add node and os abstractions Juraj Linkeš
2023-03-03 10:24           ` [PATCH v6 02/10] dts: add ssh command verification Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 03/10] dts: add dpdk build on sut Juraj Linkeš
2023-03-20  8:30             ` David Marchand
2023-03-20 13:12               ` Juraj Linkeš
2023-03-20 13:22                 ` David Marchand
2023-03-03 10:25           ` [PATCH v6 04/10] dts: add dpdk execution handling Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 05/10] dts: add node memory setup Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 06/10] dts: add test suite module Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 07/10] dts: add hello world testsuite Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 08/10] dts: add test suite config and runner Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 09/10] dts: add test results module Juraj Linkeš
2023-03-03 10:25           ` [PATCH v6 10/10] doc: update dts setup and test suite cookbook Juraj Linkeš
2023-03-09 21:47             ` Patrick Robb
2023-03-19 15:26           ` [PATCH v6 00/10] dts: add hello world test case Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220824162454.394285-3-juraj.linkes@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=lijuan.tu@intel.com \
    --cc=ohilyard@iol.unh.edu \
    --cc=ronan.randles@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).