Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_core: Add helper detecting CI environment
@ 2024-12-06  8:28 Lukasz Laguna
  2024-12-06  9:30 ` ✗ Xe.CI.BAT: failure for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukasz Laguna @ 2024-12-06  8:28 UTC (permalink / raw)
  To: igt-dev; +Cc: kamil.konieczny, marcin.bernatowicz, lukasz.laguna

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-06 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06  8:28 [PATCH i-g-t] lib/igt_core: Add helper detecting CI environment Lukasz Laguna
2024-12-06  9:30 ` ✗ Xe.CI.BAT: failure for " Patchwork
2024-12-06  9:31 ` ✗ i915.CI.BAT: " Patchwork
2024-12-06 14:56 ` ✗ Xe.CI.Full: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox