[PATCH i-g-t v2 2/5] tests/prime_udl: Create subtests

Kamil Konieczny
2026-04-22T15:44:55Z

Refactor code and create opening fixture, subtests and cleanup
fixture.

v2: use igt_main() with igt_fixture() (Kamil)

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
tests/prime_udl.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/tests/prime_udl.c b/tests/prime_udl.c
index c3e92be1e..b1524e6de 100644
--- a/tests/prime_udl.c
+++ b/tests/prime_udl.c
@@ -121,18 +121,23 @@ static void test2(void)
gem_close(intel_fd, intel_handle);
}

-int igt_simple_main()
+int igt_main()
{
- igt_assert(find_and_open_devices() >= 0);
-
- igt_skip_on(udl_fd == -1);
- igt_skip_on(intel_fd == -1);
+ igt_fixture() {
+ igt_assert(find_and_open_devices() >= 0);
+ igt_skip_on(udl_fd == -1);
+ igt_skip_on(intel_fd == -1);
+ }

/* create an object on the i915 */
- test1();
+ igt_subtest("share-import")
+ test1();

- test2();
+ igt_subtest("share-import-addfb")
+ test2();

- close(intel_fd);
- close(udl_fd);
+ igt_fixture() {
+ close(intel_fd);
+ close(udl_fd);
+ }
}
--
2.54.0