Skip to contentSkip to conversation

Speedup IGT build time

PATCH Superseded Mauro Carvalho Chehab 2 participants 7 messages Jul 6, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Speedup IGT build time

From: Mauro Carvalho Chehab <[email protected]>

Currently, even a single change on IGT makes the build time too slow.

This is because it will re-generate the check testlist on every single build that touches any file.

Change the logic to generate per-file testlists, with speeds up build time from 22 seconds to 4 seconds.

It can be improved even further after changing the build logic to maintain separate test_executables for i915, kms and xe.

As there's a pending patch series touching those tests, moving them to tests/intel directory, let's not do a conflicting change. Once such patch series gets merged, I'll write a patch with the pending optimization.

---

v2:
- make it compatible with Meson 0.47;
- added a patch to simplify tests/meson.build
- dropped a change at gem_stress - maybe there's a real reason why this one was excluded from test_list, so let's keep it as-is.

Mauro Carvalho Chehab (5):
tests/meson.build: Simplify builds for core and i915 targets lib/igt_core: use the macro when checking for list_subtests lib/igt_core: add an option to show the testlist tests/meson.build: create testlists for tests scripts/test_list.py: speedup testlist check logic

 lib/igt_core.c       |  26 +++-
 scripts/test_list.py |  30 +----
 tests/meson.build    | 277 +++++++++++++++++--------------------------
 3 files changed, 137 insertions(+), 196 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH v2 1/5 tests/meson.build: Simplify builds for core and i915 targets

From: Mauro Carvalho Chehab <[email protected]>

There are some tests that either require:
- extra dependencies
- extra source files

Right now, they have special executable() targets that are handled outside the normal way. remove those special targets, converting them into simple ones, and using two extra dictionaries to map those extra requirements.

This makes the meson.build file a lot simpler, and makes easier to add other rules when creating test lists.

---
 tests/meson.build | 223 +++++++++++++---------------------------------
 1 file changed, 61 insertions(+), 162 deletions(-)
tests/meson.build +61 -162
index ee066b84900b..3116c458d60b 100644
@@ -3,12 +3,14 @@ test_progs = [
 	'core_getclient',
 	'core_getstats',
 	'core_getversion',
+	'core_hotunplug',
 	'core_setmaster',
 	'core_setmaster_vs_auth',
 	'debugfs_test',
 	'dmabuf',
 	'dmabuf_sync_file',
 	'device_reset',
+	'dumb_buffer',
 	'drm_buddy',
 	'drm_mm',
 	'drm_read',
@@ -21,6 +23,7 @@ test_progs = [
 	'kms_atomic_interruptible',
 	'kms_atomic_transition',
 	'kms_bw',
+	'kms_color',
 	'kms_concurrent',
 	'kms_content_protection',
 	'kms_cursor_crc',
@@ -77,7 +80,9 @@ test_progs = [
 	'syncobj_basic',
 	'syncobj_wait',
 	'syncobj_timeline',
+	'sw_sync',
 	'template',
+	'testdisplay',
 	'tools_test',
 	'vgem_basic',
 	'vgem_slow',
@@ -86,16 +91,19 @@ test_progs = [
 i915_progs = [
 	'api_intel_allocator',
 	'api_intel_bb',
+	'drm_fdinfo',
 	'gen3_mixed_blits',
 	'gen3_render_linear_blits',
 	'gen3_render_mixed_blits',
 	'gen3_render_tiledx_blits',
 	'gen3_render_tiledy_blits',
 	'gem_bad_reloc',
+	'gem_barrier_race',
 	'gem_basic',
 	'gem_blits',
 	'gem_busy',
 	'gem_caching',
+	'gem_create',
 	'gem_ccs',
 	'gem_close',
 	'gem_close_race',
@@ -105,16 +113,20 @@ i915_progs = [
 	'gem_ctx_create',
 	'gem_ctx_engines',
 	'gem_ctx_exec',
+	'gem_ctx_freq',
 	'gem_ctx_isolation',
 	'gem_ctx_param',
 	'gem_ctx_persistence',
 	'gem_ctx_shared',
+	'gem_ctx_sseu',
 	'gem_ctx_switch',
+	'gem_eio',
 	'gem_evict_alignment',
 	'gem_evict_everything',
 	'gem_exec_alignment',
 	'gem_exec_async',
 	'gem_exec_await',
+	'gem_exec_balancer',
 	'gem_exec_basic',
 	'gem_exec_big',
 	'gem_exec_capture',
@@ -157,6 +169,7 @@ i915_progs = [
 	'gem_media_vme',
 	'gem_mmap',
 	'gem_mmap_gtt',
+	'gem_mmap_offset',
 	'gem_mmap_wc',
 	'gem_partial_pwrite_pread',
 	'gem_pipe_control_store_loop',
@@ -200,6 +213,8 @@ i915_progs = [
 	'gem_wait',
 	'gem_watchdog',
 	'gem_workarounds',
+	'perf',
+	'perf_pmu',
 	'i915_fb_tiling',
 	'i915_getparams_basic',
 	'i915_pm_freq_api',
@@ -209,9 +224,11 @@ i915_progs = [
 	'i915_pciid',
 	'i915_pipe_stress',
 	'i915_pm_backlight',
+	'i915_pm_freq_mult',
 	'i915_pm_lpsp',
 	'i915_pm_rpm',
 	'i915_pm_dc',
+	'i915_pm_rc6_residency',
 	'i915_pm_rps',
 	'i915_pm_sseu',
 	'i915_power',
@@ -224,6 +241,7 @@ i915_progs = [
 	'kms_ccs',
 	'kms_cdclk',
 	'kms_draw_crc',
+	'kms_dsc',
 	'kms_fb_coherency',
 	'kms_fbcon_fbt',
 	'kms_fence_pin_leak',
@@ -234,6 +252,7 @@ i915_progs = [
 	'kms_mmap_write_crc',
 	'kms_pipe_b_c_ivb',
 	'kms_psr',
+	'kms_psr2_sf',
 	'kms_psr2_su',
 	'kms_psr_stress_test',
 	'kms_pwrite_crc',
@@ -301,12 +320,41 @@ if libdrm_nouveau.found()
 	test_deps += libdrm_nouveau
 endif
 
+# Extra sources used on core and Intel drivers
+extra_sources = {
+	'core_hotunplug': [ 'core_hotunplug.c' ],
+	'dumb_buffer': ['dumb_buffer.c' ],
+	'testdisplay': [ 'testdisplay_hotplug.c' ],
+	'kms_color':  [ 'kms_color_helper.c' ],
+	'kms_dsc': [ join_paths ('i915', 'kms_dsc_helper.c') ],
+	'kms_psr2_sf':  [ join_paths ('i915', 'kms_dsc_helper.c') ],
+}
+
+# Extra dependencies used on core and Intel drivers
+extra_dependencies = {
+	'core_hotunplug': [ lib_igt_i915_perf ],
+	'drm_fdinfo': [ lib_igt_drm_fdinfo ],
+	'dumb_buffer':  [ libatomic ],
+	'gem_barrier_race': [ lib_igt_i915_perf ],
+	'gem_create': [ libatomic ],
+	'gem_ctx_freq': [ lib_igt_perf ],
+	'gem_ctx_sseu': [ lib_igt_perf ],
+	'gem_eio': [ realtime ],
+	'gem_exec_balancer': [ lib_igt_perf ],
+	'gem_mmap_offset': [ libatomic ],
+	'i915_pm_freq_mult': [ lib_igt_perf ],
+	'i915_pm_rc6_residency': [ lib_igt_perf ],
+	'perf': [ lib_igt_i915_perf ],
+	'perf_pmu':  [ lib_igt_perf ],
+	'sw_sync': [ libatomic ],
+}
+
 test_executables = []
 test_list = []
 
 foreach prog : test_progs
-	test_executables += executable(prog, prog + '.c',
-		   dependencies : test_deps,
+	test_executables += executable(prog, [prog + '.c'] + extra_sources.get(prog, []),
+		   dependencies : test_deps + extra_dependencies.get(prog, []),
 		   install_dir : libexecdir,
 		   install_rpath : libexecdir_rpathdir,
 		   install : true)
@@ -315,8 +363,8 @@ endforeach
 
 foreach prog : i915_progs
 	test_executables += executable(prog,
-		   join_paths('i915', prog + '.c'),
-		   dependencies : test_deps,
+		   [join_paths('i915', prog + '.c')] + extra_sources.get(prog, []),
+		   dependencies : test_deps + extra_dependencies.get(prog, []),
 		   install_dir : libexecdir,
 		   install_rpath : libexecdir_rpathdir,
 		   install : true)
@@ -326,8 +374,8 @@ endforeach
 if build_xe
 	foreach prog : xe_progs
 		test_executables += executable(prog,
-			   join_paths('xe', prog + '.c'),
-			   dependencies : test_deps,
+			   [join_paths('xe', prog + '.c')] + extra_sources.get(prog, []),
+			   dependencies : test_deps + extra_dependencies.get(prog, []),
 			   install_dir : libexecdir,
 			   install_rpath : libexecdir_rpathdir,
 			   install : true)
@@ -357,165 +405,16 @@ if chamelium.found()
 		test_list += prog
 	endforeach
 	test_deps += chamelium
-endif
-
-test_executables += executable('drm_fdinfo',
-	   join_paths('i915', 'drm_fdinfo.c'),
-	   dependencies : test_deps + [ lib_igt_drm_fdinfo ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'drm_fdinfo'
-
-test_executables += executable('dumb_buffer', 'dumb_buffer.c',
-	   dependencies : test_deps + [ libatomic ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'dumb_buffer'
-
-test_executables += executable('gem_create',
-	   join_paths('i915', 'gem_create.c'),
-	   dependencies : test_deps + [ libatomic ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_create'
-
-test_executables += executable('gem_ctx_freq',
-	   join_paths('i915', 'gem_ctx_freq.c'),
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_ctx_freq'
-
-test_executables += executable('gem_ctx_sseu',
-	   join_paths('i915', 'gem_ctx_sseu.c'),
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_ctx_sseu'
-
-test_executables += executable('gem_eio',
-	   join_paths('i915', 'gem_eio.c'),
-	   dependencies : test_deps + [ realtime ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_eio'
-
-test_executables += executable('gem_exec_balancer', 'i915/gem_exec_balancer.c',
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_exec_balancer'
-
-test_executables += executable('gem_mmap_offset',
-	   join_paths('i915', 'gem_mmap_offset.c'),
-	   dependencies : test_deps + [ libatomic ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_mmap_offset'
-
-test_executables += executable('i915_pm_freq_mult',
-	   join_paths('i915', 'i915_pm_freq_mult.c'),
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'i915_pm_freq_mult'
 
-test_executables += executable('i915_pm_rc6_residency',
-	   join_paths('i915', 'i915_pm_rc6_residency.c'),
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'i915_pm_rc6_residency'
-
-test_executables += executable('gem_barrier_race',
-	   join_paths('i915', 'gem_barrier_race.c'),
-	   dependencies : test_deps + [ lib_igt_i915_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'gem_barrier_race'
-
-test_executables += executable('perf_pmu',
-	   join_paths('i915', 'perf_pmu.c'),
-	   dependencies : test_deps + [ lib_igt_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'perf_pmu'
-
-test_executables += executable('perf',
-	   join_paths('i915', 'perf.c'),
-	   dependencies : test_deps + [ lib_igt_i915_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'perf'
-
-test_executables += executable('core_hotunplug', 'core_hotunplug.c',
-	   dependencies : test_deps + [ lib_igt_i915_perf ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'core_hotunplug'
-
-executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
-	   dependencies : test_deps,
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'testdisplay'
-
-test_executables += executable('kms_color',
-	   [ 'kms_color.c', 'kms_color_helper.c' ],
-	   dependencies : test_deps,
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'kms_color'
-
-test_executables += executable('kms_dsc',
-	   [ join_paths('i915', 'kms_dsc.c'), join_paths ('i915', 'kms_dsc_helper.c')],
-	   dependencies : test_deps,
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'kms_dsc'
-
-test_executables += executable('kms_psr2_sf',
-	   [ join_paths('i915', 'kms_psr2_sf.c'), join_paths ('i915', 'kms_dsc_helper.c')],
-	   dependencies : test_deps,
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'kms_psr2_sf'
-
-if chamelium.found()
-       test_executables += executable('kms_chamelium_color',
-                             [ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
-                             dependencies : test_deps + [ chamelium ],
-                             install_dir : libexecdir,
-                             install_rpath : libexecdir_rpathdir,
-                             install : true)
-       test_list += 'kms_chamelium_color'
+	test_executables += executable('kms_chamelium_color',
+				[ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
+				dependencies : test_deps + [ chamelium ],
+				install_dir : libexecdir,
+				install_rpath : libexecdir_rpathdir,
+				install : true)
+	test_list += 'kms_chamelium_color'
 endif
 
-test_executables += executable('sw_sync', 'sw_sync.c',
-	   dependencies : test_deps + [ libatomic ],
-	   install_dir : libexecdir,
-	   install_rpath : libexecdir_rpathdir,
-	   install : true)
-test_list += 'sw_sync'
-
 subdir('amdgpu')
 
 subdir('v3d')
Signature · 1 line
2.40.1
#2 lore raw

PATCH v2 2/5 lib/igt_core: use the macro when checking for list_subtests

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

We're implementing a new argument to display all tests. Before doing that, make the check for it more generic to prepare for the changes.

---
 lib/igt_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/igt_core.c +5 -5
index 3ee3a01c3668..9a0029d294a8 100644
@@ -870,7 +870,7 @@ static void print_version(void)
 {
 	struct utsname uts;
 
-	if (list_subtests)
+	if (igt_only_list_subtests())
 		return;
 
 	uname(&uts);
@@ -1198,12 +1198,12 @@ static int common_init(int *argc, char **argv,
 			break;
 		case OPT_RUN_SUBTEST:
 			assert(optarg);
-			if (!list_subtests)
+			if (!igt_only_list_subtests())
 				run_single_subtest = strdup(optarg);
 			break;
 		case OPT_RUN_DYNAMIC_SUBTEST:
 			assert(optarg);
-			if (!list_subtests)
+			if (!igt_only_list_subtests())
 				run_single_dynamic_subtest = strdup(optarg);
 			break;
 		case OPT_DESCRIPTION:
@@ -1265,7 +1265,7 @@ out:
 		/* exit with no error for -h/--help */
 		exit(ret == -1 ? 0 : IGT_EXIT_INVALID);
 
-	if (!list_subtests) {
+	if (!igt_only_list_subtests()) {
 		bind_fbcon(false);
 		igt_kmsg(KMSG_INFO "%s: executing\n", command_str);
 		print_version();
@@ -3098,7 +3098,7 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	if (!thread_id)
 		return;
 
-	if (list_subtests && level <= IGT_LOG_WARN)
+	if (igt_only_list_subtests() && level <= IGT_LOG_WARN)
 		return;
 
 	if (vasprintf(&line, format, args) == -1)
Signature · 1 line
2.40.1
#3 lore raw

PATCH v2 3/5 lib/igt_core: add an option to show the testlist

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

There are several cases where we need to list the tests the same way as igt_runner displays them.

That should not return errors on failures and should work also when igt_simple_main() macro is used.

Ideally, it should also show dynamic subtests, but this is more complex, specially for Kselftest/KUnit ones. So, for now, let's not handle dynamic ones.

Add an option to produce such testlist.

---
 lib/igt_core.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
lib/igt_core.c +15 -1
index 9a0029d294a8..2ae2cb68835e 100644
@@ -274,6 +274,7 @@ const char *igt_interactive_debug;
 bool igt_skip_crc_compare;
 
 /* subtests helpers */
+static bool show_testlist = false;
 static bool list_subtests = false;
 static bool describe_subtests = false;
 static char *run_single_subtest = NULL;
@@ -326,6 +327,7 @@ enum {
 	 * conflict with core ones
 	 */
 	OPT_LIST_SUBTESTS = 500,
+	OPT_SHOW_TESTLIST,
 	OPT_DESCRIBE_SUBTESTS,
 	OPT_RUN_SUBTEST,
 	OPT_RUN_DYNAMIC_SUBTEST,
@@ -896,6 +898,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 
 	fprintf(f, "Usage: %s [OPTIONS]\n", command_str);
 	fprintf(f, "  --list-subtests\n"
+		   "  --show-testlist\n"
 		   "  --run-subtest <pattern>\n"
 		   "  --dynamic-subtest <pattern>\n"
 		   "  --debug[=log-domain]\n"
@@ -1076,6 +1079,7 @@ static int common_init(int *argc, char **argv,
 	int c, option_index = 0, i, x;
 	static struct option long_options[] = {
 		{"list-subtests",     no_argument,       NULL, OPT_LIST_SUBTESTS},
+		{"show-testlist",     no_argument,       NULL, OPT_SHOW_TESTLIST},
 		{"describe",          optional_argument, NULL, OPT_DESCRIBE_SUBTESTS},
 		{"run-subtest",       required_argument, NULL, OPT_RUN_SUBTEST},
 		{"dynamic-subtest",   required_argument, NULL, OPT_RUN_DYNAMIC_SUBTEST},
@@ -1189,6 +1193,9 @@ static int common_init(int *argc, char **argv,
 			if (!run_single_subtest)
 				list_subtests = true;
 			break;
+		case OPT_SHOW_TESTLIST:
+			show_testlist = true;
+			break;
 		case OPT_DESCRIBE_SUBTESTS:
 			if (optarg)
 				run_single_subtest = strdup(optarg);
@@ -1257,6 +1264,10 @@ out:
 			igt_warn("Unknown subtest: %s\n", run_single_subtest);
 			exit(IGT_EXIT_INVALID);
 		}
+		if (show_testlist) {
+			printf("igt@%s\n", igt_test_name());
+			exit(0);
+		}
 		if (list_subtests)
 			exit(IGT_EXIT_INVALID);
 	}
@@ -1449,6 +1460,9 @@ bool __igt_run_subtest(const char *subtest_name, const char *file, const int lin
 		__igt_print_description(subtest_name, file, line);
 		_clear_current_description();
 		return false;
+	} else if (show_testlist) {
+		printf("igt@%s@%s\n", igt_test_name(), subtest_name);
+		return false;
 	} else if (list_subtests) {
 		printf("%s\n", subtest_name);
 		return false;
@@ -1522,7 +1536,7 @@ const char *igt_subtest_name(void)
  */
 bool igt_only_list_subtests(void)
 {
-	return list_subtests;
+	return list_subtests || show_testlist;
 }
 
 
Signature · 1 line
2.40.1
#4 lore raw

PATCH v2 4/5 tests/meson.build: create testlists for tests

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

Let's dynamically create testlists for during build time, as this can speed up a lot the validation check for testplan.

Ideally, all it would need to to that would be to use this logic at the end of tests/meson.build:

foreach testexe : test_executables
prog = testexe.name()

output = prog.split('/').get(-1) + '.testlist' custom_target(output,
build_by_default : true,
command : [ testexe.full_path(), '--show-testlist'], capture : true,
depends : testexe,
output : output)

Unfortunately, this requies Meson >= 0.54. So, we need to add one custom_target per executable() call.

Also, meson does a very crappy job when checking for dependencies created with executable targets, as it tries to find all binaries during meson runtime, and not while running ninja. Due to that, we also had to change the logic to call an existing binary with:

- command : [ testexe.full_path(), '--show-testlist'],
+ command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist']

---
 tests/meson.build | 60 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 53 insertions(+), 7 deletions(-)
tests/meson.build +53 -7
index 3116c458d60b..9b7301dbf569 100644
@@ -353,33 +353,57 @@ test_executables = []
 test_list = []
 
 foreach prog : test_progs
-	test_executables += executable(prog, [prog + '.c'] + extra_sources.get(prog, []),
+	testexe = executable(prog, [prog + '.c'] + extra_sources.get(prog, []),
 		   dependencies : test_deps + extra_dependencies.get(prog, []),
 		   install_dir : libexecdir,
 		   install_rpath : libexecdir_rpathdir,
 		   install : true)
+	test_executables += testexe
 	test_list += prog
+	name = prog.split('/').get(-1)
+	custom_target(name + '.testlist',
+		     build_by_default : true,
+		     command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+		     capture : true,
+		     depends : testexe,
+		     output : name + '.testlist')
 endforeach
 
 foreach prog : i915_progs
-	test_executables += executable(prog,
+	testexe = executable(prog,
 		   [join_paths('i915', prog + '.c')] + extra_sources.get(prog, []),
 		   dependencies : test_deps + extra_dependencies.get(prog, []),
 		   install_dir : libexecdir,
 		   install_rpath : libexecdir_rpathdir,
 		   install : true)
+	test_executables += testexe
 	test_list += prog
+	name = prog.split('/').get(-1)
+	custom_target(name + '.testlist',
+		     build_by_default : true,
+		     command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+		     capture : true,
+		     depends : testexe,
+		     output : name + '.testlist')
 endforeach
 
 if build_xe
 	foreach prog : xe_progs
-		test_executables += executable(prog,
+		testexe = executable(prog,
 			   [join_paths('xe', prog + '.c')] + extra_sources.get(prog, []),
 			   dependencies : test_deps + extra_dependencies.get(prog, []),
 			   install_dir : libexecdir,
 			   install_rpath : libexecdir_rpathdir,
 			   install : true)
 		test_list += prog
+		test_executables += testexe
+		name = prog.split('/').get(-1)
+		custom_target(name + '.testlist',
+			     build_by_default : true,
+			     command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+			     capture : true,
+			     depends : testexe,
+			     output : name + '.testlist')
 	endforeach
 	build_info += 'Xe **experimental** tests enabled.'
 endif
@@ -395,7 +419,7 @@ endforeach
 
 if chamelium.found()
 	foreach prog : chamelium_progs
-		test_executables += executable(prog,
+		testexe = executable(prog,
 				 [join_paths('chamelium', prog + '.c'),
 					join_paths('chamelium', 'kms_chamelium_helper.c')],
 				 dependencies : test_deps,
@@ -403,16 +427,32 @@ if chamelium.found()
 				 install_rpath : libexecdir_rpathdir,
 				 install : true)
 		test_list += prog
+		test_executables += testexe
+		name = prog.split('/').get(-1)
+		custom_target(name + '.testlist',
+			     build_by_default : true,
+			     command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+			     capture : true,
+			     depends : testexe,
+			     output : name + '.testlist')
 	endforeach
 	test_deps += chamelium
 
-	test_executables += executable('kms_chamelium_color',
+	name = 'kms_chamelium_color'
+	testexe = executable('kms_chamelium_color',
 				[ 'chamelium/kms_chamelium_color.c', 'kms_color_helper.c' ],
 				dependencies : test_deps + [ chamelium ],
 				install_dir : libexecdir,
 				install_rpath : libexecdir_rpathdir,
 				install : true)
-	test_list += 'kms_chamelium_color'
+	test_list += name
+	test_executables += testexe
+	custom_target(name + '.testlist',
+		     build_by_default : true,
+		     command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+		     capture : true,
+		     depends : testexe,
+		     output : name + '.testlist')
 endif
 
 subdir('amdgpu')
@@ -448,11 +488,17 @@ foreach prog : test_list
 	test('testcase check ' + prog, test_script, args : prog)
 endforeach
 
-executable('gem_stress', 'i915/gem_stress.c',
+testexe = executable('gem_stress', 'i915/gem_stress.c',
 	   install : true,
 	   install_dir : libexecdir,
 	   install_rpath : libexecdir_rpathdir,
 	   dependencies : igt_deps)
+custom_target('gem_stress.testlist',
+                build_by_default : true,
+                command : [ '/usr/bin/sh', '-c', testexe.full_path() + ' --show-testlist'],
+                capture : true,
+                depends : testexe,
+                output : 'gem_stress.testlist')
 
 image_files = [
   '1080p-left.png',
Signature · 1 line
2.40.1
#5 lore raw

PATCH v2 5/5 scripts/test_list.py: speedup testlist check logic

In reply to Mauro Carvalho Chehab

From: Mauro Carvalho Chehab <[email protected]>

Now that the build system will generate the testlist for us, just read them when checking for missing symbols.

This should speed up a log the check logic.

After the change, touching on a single file and rebuilding the testplan with check enabled is a lot faster:

	$ touch tests/xe/xe_compute.c
	$ time make
	ninja -C build
	ninja: Entering directory `build'
	[10/10] Generating docs/testplan/i915_tests.html with a custom command
	real	0m4.510s
	user	0m5.944s
	sys	0m0.217s

This can be improved even further if we split the test_executables dependencies per driver.

---
 scripts/test_list.py | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)
scripts/test_list.py +6 -24
index a55d2977c7c3..2c1a6f230fb5 100755
@@ -909,35 +909,17 @@ class TestList:
 
         return subtests
 
-    def __get_testlist(self, name):
-        match = re.match(r"(.*/)?(.*)\.c$", name)
-        if not match:
-            return []
-
-        basename = "igt@" + match.group(2)
-
-        fname = os.path.join(self.igt_build_path, "tests", match.group(2))
-        if not os.path.isfile(fname):
-            print(f"Error: file {fname} doesn't exist.")
-            sys.exit(1)
-        try:
-            result = subprocess.run([ fname, "--list-subtests" ],
-                                    check = True,
-                                    stdout = subprocess.PIPE,
-                                    universal_newlines=True)
-            subtests = result.stdout.splitlines()
-
-            return [basename  + "@" + i for i in subtests]
-        except subprocess.CalledProcessError:
-            # Handle it as a test using igt_simple_main
-            return [basename]
-
     def get_testlist(self):
 
         """ Return a list of tests as reported by --list-subtests """
         tests = []
         for name in self.filenames:
-            tests += self.__get_testlist(name)
+            fname = re.sub(r"\.c$", ".testlist", name.split('/')[-1])
+            fname = os.path.join(self.igt_build_path, "tests", fname)
+
+            with open(fname, 'r', encoding='utf8') as handle:
+                for line in handle:
+                    tests.append(line)
 
         return sorted(tests)
 
Signature · 1 line
2.40.1
#6 lore raw

[igt-dev] ✗ Fi.CI.BUILD: failure for Speedup IGT build time (rev2)

In reply to Mauro Carvalho Chehab
== Series Details ==

== Series Details ==

Series: Speedup IGT build time (rev2)
URL : https://patchwork.freedesktop.org/series/120233/
State : failure

== Summary ==

IGT patchset build failed on latest successful build d581742e53b0fd5c35db4a21fe55fb9ba704a03e tests/amdgpu: add vce decoder test

Installing tools/i915-perf/i915-perf-recorder to /opt/igt/bin
Installing tools/i915-perf/i915-perf-control to /opt/igt/bin
Installing tools/i915-perf/i915-perf-reader to /opt/igt/bin
Installing runner/igt_runner to /opt/igt/bin
Installing runner/igt_resume to /opt/igt/bin
Installing runner/igt_results to /opt/igt/bin
Installing runner/igt_comms_decoder to /opt/igt/bin
Installing assembler/intel-gen4asm to /opt/igt/bin
Installing assembler/intel-gen4disasm to /opt/igt/bin
Installing overlay/intel-gpu-overlay to /opt/igt/bin
Installing man/intel_audio_dump.1.gz to /opt/igt/share/man/man1
Installing man/intel_bios_dumper.1.gz to /opt/igt/share/man/man1
Installing man/intel_error_decode.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_frequency.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_top.1.gz to /opt/igt/share/man/man1
Installing man/intel_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_infoframes.1.gz to /opt/igt/share/man/man1
Installing man/intel_lid.1.gz to /opt/igt/share/man/man1
Installing man/intel_panel_fitter.1.gz to /opt/igt/share/man/man1
Installing man/intel_reg.1.gz to /opt/igt/share/man/man1
Installing man/intel_stepping.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_map.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_small.1.gz to /opt/igt/share/man/man1
Installing man/intel_vbt_decode.1.gz to /opt/igt/share/man/man1
Installing /usr/src/igt-gpu-tools/lib/igt_list.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/intel_chipset.h to /opt/igt/include/i915-perf Installing /usr/src/igt-gpu-tools/lib/i915/perf.h to /opt/igt/include/i915-perf Installing /usr/src/igt-gpu-tools/lib/i915/perf_data.h to /opt/igt/include/i915-perf Installing /usr/src/igt-gpu-tools/lib/i915/perf_data_reader.h to /opt/igt/include/i915-perf Installing /opt/igt/build/lib/i915-perf.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig Installing /usr/src/igt-gpu-tools/tests/1080p-left.png to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/1080p-right.png to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/pass.png to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/fast-feedback.testlist to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/meta.testlist to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/README to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist.txt to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist-pre-merge.txt to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe-fast-feedback.testlist to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe.blocklist.txt to /opt/igt/share/igt-gpu-tools Installing /usr/src/igt-gpu-tools/tools/intel_gpu_abrt to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/tools/intel-gfx-fw-info to /opt/igt/bin
Installing /opt/igt/build/assembler/intel-gen4asm.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig Installing /usr/src/igt-gpu-tools/scripts/code_cov_capture to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_build to /opt/igt/bin Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_test to /opt/igt/bin Installing /usr/src/igt-gpu-tools/scripts/code_cov_gen_report to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_parse_info to /opt/igt/bin