From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 932A6432BB; Mon, 6 Nov 2023 18:16:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53CAD40E6E; Mon, 6 Nov 2023 18:16:12 +0100 (CET) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by mails.dpdk.org (Postfix) with ESMTP id B048C40E5E for ; Mon, 6 Nov 2023 18:16:09 +0100 (CET) Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-9dbb3d12aefso676739266b.0 for ; Mon, 06 Nov 2023 09:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1699290969; x=1699895769; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s/LAysoQdX2M5M3GcSGuAwQq2xnpB5HA3Nq0pkeiaOA=; b=iyCVjEuAJsBcjQpDAogQ1t0aYDUEvwXkz6Q3iiTOxRXOgYCL+UtjTM2cM/z9g74lL4 HbiX09sC7jSdxpqg6DQISZa9dMz/Kfj8iJ8plI5Gtcl+cff1I4CzoJJX0wpMf7PffmdN Eniz0/yEzIsTDRMoimFKkqG/8IkvwvJdptRPtrh0VZvCDxHhKOW5+walCl7eTGqDrCjX rRolY7Qp3GG5LfuTSSh6TFogVCuSrhZ0c1qIsTFF+p1Tl9rzxaRBHhWDfqMDlVO987Wp zj41cbM7QIC8asP5VbQ5aFqUliopB5AGe++JTgJUsqz/qZIE9RfP/RRdkeCcXy4ezzcc mYbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699290969; x=1699895769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s/LAysoQdX2M5M3GcSGuAwQq2xnpB5HA3Nq0pkeiaOA=; b=MFbXqhzVkH9mGY3+XiLk2FGDq8E0HFRb8hYap4QNmkhC5295KU11Jdht/wWD0J5Se4 uflmCdbCp0NE3JWCqhTF2dTR7RJIOHhl7+LU/luCXOxO8qbAJRGZW+3/VjgpSCSB/K/5 YrKwvenLVJHsdc2MRT3VcL/HdHARSRQrfdxxBnqqfSMMSoVVvdMzFV0kwOgywo6Cd4WY 5iCi0kRtq03OnTEtFVw70RomdWLLk0LlrYKiLYwz3l7R4NhdKgN+Hi6/zH6bv4nQrlIp emIkMzmZ0k4dtB9Cb+jaHvMa6huPPwW8SCtPhOxdMh6ajA+MAERfnPFncqm9zM9zbqGQ h2WQ== X-Gm-Message-State: AOJu0YxFiA0yS3nZz151qxciihRF5BmNiPZgE0ocu+1bZg0U1A9FLpef CP6r8mkA23LzHp54qmH6KfV2MA== X-Google-Smtp-Source: AGHT+IFP3SdSrEvGH/rKHUUzMbiCwmV7x9e2/sx1N9mC7hAZSTBVyXDbCFBoVT6xOgKqK0cHARaMPg== X-Received: by 2002:a17:907:84a:b0:9be:c2cd:aa29 with SMTP id ww10-20020a170907084a00b009bec2cdaa29mr12022936ejb.77.1699290969085; Mon, 06 Nov 2023 09:16:09 -0800 (PST) Received: from jlinkes-PT-Latitude-5530.. (ip-46.34.243.197.o2inet.sk. [46.34.243.197]) by smtp.gmail.com with ESMTPSA id s10-20020a170906354a00b009b947aacb4bsm47016eja.191.2023.11.06.09.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 09:16:08 -0800 (PST) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH v5 03/23] dts: add basic developer docs Date: Mon, 6 Nov 2023 18:15:41 +0100 Message-Id: <20231106171601.160749-4-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106171601.160749-1-juraj.linkes@pantheon.tech> References: <20230831100407.59865-1-juraj.linkes@pantheon.tech> <20231106171601.160749-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Expand the framework contribution guidelines and add how to document the code with Python docstrings. Signed-off-by: Juraj Linkeš --- doc/guides/tools/dts.rst | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/doc/guides/tools/dts.rst b/doc/guides/tools/dts.rst index 32c18ee472..b1e99107c3 100644 --- a/doc/guides/tools/dts.rst +++ b/doc/guides/tools/dts.rst @@ -264,6 +264,65 @@ which be changed with the ``--output-dir`` command line argument. The results contain basic statistics of passed/failed test cases and DPDK version. +Contributing to DTS +------------------- + +There are two areas of contribution: The DTS framework and DTS test suites. + +The framework contains the logic needed to run test cases, such as connecting to nodes, +running DPDK apps and collecting results. + +The test cases call APIs from the framework to test their scenarios. Adding test cases may +require adding code to the framework as well. + + +Framework Coding Guidelines +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When adding code to the DTS framework, pay attention to the rest of the code +and try not to divert much from it. The :ref:`DTS developer tools ` will issue +warnings when some of the basics are not met. + +The code must be properly documented with docstrings. The style must conform to +the `Google style `_. +See an example of the style +`here `_. +For cases which are not covered by the Google style, refer +to `PEP 257 `_. There are some cases which are not covered by +the two style guides, where we deviate or where some additional clarification is helpful: + + * The __init__() methods of classes are documented separately from the docstring of the class + itself. + * The docstrigs of implemented abstract methods should refer to the superclass's definition + if there's no deviation. + * Instance variables/attributes should be documented in the docstring of the class + in the ``Attributes:`` section. + * The dataclass.dataclass decorator changes how the attributes are processed. The dataclass + attributes which result in instance variables/attributes should also be recorded + in the ``Attributes:`` section. + * Class variables/attributes, on the other hand, should be documented with ``#:`` above + the type annotated line. The description may be omitted if the meaning is obvious. + * The Enum and TypedDict also process the attributes in particular ways and should be documented + with ``#:`` as well. This is mainly so that the autogenerated docs contain the assigned value. + * When referencing a parameter of a function or a method in their docstring, don't use + any articles and put the parameter into single backticks. This mimics the style of + `Python's documentation `_. + * When specifying a value, use double backticks:: + + def foo(greet: bool) -> None: + """Demonstration of single and double backticks. + + `greet` controls whether ``Hello World`` is printed. + + Args: + greet: Whether to print the ``Hello World`` message. + """ + if greet: + print(f"Hello World") + + * The docstring maximum line length is the same as the code maximum line length. + + How To Write a Test Suite ------------------------- @@ -293,6 +352,18 @@ There are four types of methods that comprise a test suite: | These methods don't need to be implemented if there's no need for them in a test suite. In that case, nothing will happen when they're is executed. +#. **Configuration, traffic and other logic** + + The ``TestSuite`` class contains a variety of methods for anything that + a test suite setup or teardown or a test case may need to do. + + The test suites also frequently use a DPDK app, such as testpmd, in interactive mode + and use the interactive shell instances directly. + + These are the two main ways to call the framework logic in test suites. If there's any + functionality or logic missing from the framework, it should be implemented so that + the test suites can use one of these two ways. + #. **Test case verification** Test case verification should be done with the ``verify`` method, which records the result. @@ -308,6 +379,8 @@ There are four types of methods that comprise a test suite: and used by the test suite via the ``sut_node`` field. +.. _dts_dev_tools: + DTS Developer Tools ------------------- -- 2.34.1