Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"Katarzyna Piecielska" <katarzyna.piecielska@intel.com>
Subject: Re: [PATCH i-g-t v2 2/2] CONTRIBUTING: Add guide about igt libraries
Date: Mon, 31 Mar 2025 10:08:54 -0700	[thread overview]
Message-ID: <87o6xh3z6h.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20250331133424.35873-3-kamil.konieczny@linux.intel.com>

On Mon, 31 Mar 2025 06:34:24 -0700, Kamil Konieczny wrote:
>
> Add some general guide about adding new library function and
> a few guides for their usage outside of tests.
>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Acked-by: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
> ---
>  CONTRIBUTING.md | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> index 8370451d6..d4efa61f5 100644
> --- a/CONTRIBUTING.md
> +++ b/CONTRIBUTING.md
> @@ -38,6 +38,34 @@ The Code
>
>  [igt-describe]: https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe
>
> +IGT libraries
> +-------------
> +- Tests and benchmarks are the main usage of IGT libraries, so they
> +  could use test specific macros/functions, for example igt_assert,
> +  igt_require, igt_skip, igt_info or igt_debug.
> +
> +- New library function could be written when it will have at least two
> +  different users, for example if it could be used by two or more tests.
> +  In some cases single user can be accepted, when it is very likely it
> +  will be used in future.
> +
> +- In a new library function():
> +  if it uses some of the macros igt_assert/igt_require/igt_skip then
> +  consider to write also __function() with the same functionality but
> +  without them.
> +
> +- Libraries and igt_runner
> +  Runner should not use lib functions. It is crucial for CI runs so using
> +  libraries puts a risk of bringing changes meant for tests which in turn
> +  could break runner.
> +  Note: You will find places where igt_runner uses lib functions - this will
> +  be on ToDo list to be fixed.
> +
> +- Libraries and tools/
> +  Tools should try to not use lib functions. Any abnormal condition should
> +  be simply reported by printf or fprintf to stdout/stderr and then tool
> +  should exit gracefully. Do not use igt_abort nor igt_assert, igt_print,
> +  igt_debug nor other testing/printing macros from igt lib/

Not sure about runner, but for tools, I'd rather have shared functions from
lib/ rather than duplicating code. So we should be more specific here about
which functions tools should not use. Maybe tools should not use 'igt_abort
nor igt_assert, igt_print, igt_debug' etc. or even using these might be ok,
as long as the tool works as expected?

Or maybe just say here that 'give some thought if you are planning to use
IGT lib code in tools, some IGT lib functions might be be appropriate in
tools'.

For example previously a lot of extra code was written in i915 perf
library, just to avoid using IGT lib/. I changed this approach in xe perf
lib and decided to use IGT lib/.



>
>  Sending Patches
>  ---------------
> --
> 2.49.0
>

  reply	other threads:[~2025-03-31 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 13:34 [PATCH i-g-t v2 0/2] CONTRIBUTING: Add subscription info, patchwork link and lib guide Kamil Konieczny
2025-03-31 13:34 ` [PATCH i-g-t v2 1/2] CONTRIBUTING: Add subscription and patchwork info Kamil Konieczny
2025-03-31 16:54   ` Dixit, Ashutosh
2025-04-01 13:36     ` Kamil Konieczny
2025-03-31 13:34 ` [PATCH i-g-t v2 2/2] CONTRIBUTING: Add guide about igt libraries Kamil Konieczny
2025-03-31 17:08   ` Dixit, Ashutosh [this message]
2025-04-01 14:22     ` Kamil Konieczny

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=87o6xh3z6h.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=katarzyna.piecielska@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /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