Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Laguna <lukasz.laguna@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com,
	marcin.bernatowicz@linux.intel.com, lukasz.laguna@intel.com
Subject: [PATCH i-g-t] lib/igt_core: Add helper detecting CI environment
Date: Fri,  6 Dec 2024 09:28:22 +0100	[thread overview]
Message-ID: <20241206082822.8648-1-lukasz.laguna@intel.com> (raw)

Helper determines if the code is running in CI environment by checking
the INTEL_CI environment variable. It can be useful for reducing number
of dynamic subtests executed in CI runs. While some subtests should be
defined, because they can be valuable for debugging or platform bring
up, running all of them in CI for every build is not always necessary.

For example, in the case of SR-IOV tests, while the ability to run test
on a specific VF is important, executing it on all possible VFs in CI
for every build might not be required. In many cases, testing on a single
random VF is sufficient and testing on every possible VF would
significantly increase execution time and CI infrastructure load.

Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com>
---
 lib/igt_core.c | 21 +++++++++++++++++++++
 lib/igt_core.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 407f7b551..50759c170 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -3060,6 +3060,27 @@ err:
 	igt_assert_f(0, "failed to install the signal handler\n");
 }
 
+/**
+ * igt_run_in_ci:
+ *
+ * This function can be used to reduce number of dynamic subtests when running
+ * in CI environment. While some subtests should be defined, because they can
+ * be useful during debugging or platform bring-up, executing all of them in CI
+ * for every build is not always necessary. This i-g-t mode is selected by
+ * setting the INTEL_CI environment variable to 1.
+ *
+ * Returns: True when run in CI environment, false otherwise.
+ */
+bool igt_run_in_ci(void)
+{
+	static int ci = -1;
+
+	if (ci == -1)
+		ci = igt_check_boolean_env_var("INTEL_CI", false);
+
+	return ci;
+}
+
 /* simulation enviroment support */
 
 /**
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 90f57402f..1c75312f4 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -1221,6 +1221,9 @@ typedef void (*igt_exit_handler_t)(int sig);
 /* reliable atexit helpers, also work when killed by a signal (if possible) */
 void igt_install_exit_handler(igt_exit_handler_t fn);
 
+/* helper to automatically reduce number of dynamic subtests when running in CI environment */
+bool igt_run_in_ci(void);
+
 /* helpers to automatically reduce test runtime in simulation */
 bool igt_run_in_simulation(void);
 /**
-- 
2.40.0


             reply	other threads:[~2024-12-06  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  8:28 Lukasz Laguna [this message]
2024-12-06  9:30 ` ✗ Xe.CI.BAT: failure for lib/igt_core: Add helper detecting CI environment Patchwork
2024-12-06  9:31 ` ✗ i915.CI.BAT: " Patchwork
2024-12-06 14:56 ` ✗ Xe.CI.Full: " Patchwork

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=20241206082822.8648-1-lukasz.laguna@intel.com \
    --to=lukasz.laguna@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=marcin.bernatowicz@linux.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