Skip to contentSkip to conversation

runner: Correctly handle abort before first test

PATCH Superseded Petri Latvala 3 participants 6 messages Dec 21, 2022 – Jan 9, 2023

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 runner: Correctly handle abort before first test

Don't leave the execution in a "please resume me" state if bootup causes an abort condition. Especially handle the case of abort on bootup when resuming correctly, so that it doesn't attempt to run a test on a tainted kernel if we've explicitly configured the runner to not execute when there's a taint.

v2: Fudge the results directory instead to get the desired results:
runner exits with nonzero, and resuming exits with "all done" instead of executing anything.

v3: Use faccessat instead of open+close, use less magic strings,
remember to close fds (Chris)

v4: Use GRACEFUL_EXITCODE in monitor_output, remove the 'resuming'
field (why was it a double?!). (Ryszard)
Stop trying to execute if all tests are already run, to avoid a crash in environment validation.

Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Kamil Konieczny <[email protected]>
Cc Ryszard Knop <[email protected]>
---
 runner/executor.c | 57 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)
runner/executor.c +54 -3
index d2253082..e954c23e 100644
@@ -37,6 +37,7 @@
 
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
+#define GRACEFUL_EXITCODE -SIGHUP
 
 static struct {
 	int *fds;
@@ -1249,7 +1250,7 @@ static int monitor_output(pid_t child,
 					} else {
 						dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n",
 							EXECUTOR_EXIT,
-							-SIGHUP, 0.0);
+							GRACEFUL_EXITCODE, 0.0);
 						if (settings->sync)
 							fdatasync(outputs[_F_JOURNAL]);
 					}
@@ -1720,6 +1721,41 @@ out_dirfd:
 	return result;
 }
 
+static void fill_results_directory_with_notruns(struct job_list *list,
+						int resdirfd)
+{
+	int outputs[_F_LAST];
+	char name[32];
+	int dirfd;
+	size_t i;
+
+	for (i = 0; i < list->size; i++) {
+		snprintf(name, sizeof(name), "%zd", i);
+
+		if (faccessat(resdirfd, name, F_OK, 0) == 0)
+			continue;
+
+		mkdirat(resdirfd, name, 0777);
+		dirfd = openat(resdirfd, name, O_DIRECTORY | O_RDONLY);
+		if (dirfd < 0) {
+			errf("Error accessing individual test result directory\n");
+			return;
+		}
+
+		if (!open_output_files(dirfd, outputs, true)) {
+			errf("Error opening output files\n");
+			close(dirfd);
+			return;
+		}
+
+		dprintf(outputs[_F_OUT], "Forced notrun result because of abort condition on bootup\n");
+		dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n", EXECUTOR_EXIT, GRACEFUL_EXITCODE, 0.0);
+
+		close_outputs(outputs);
+		close(dirfd);
+	}
+}
+
 static int remove_file(int dirfd, const char *name)
 {
 	return unlinkat(dirfd, name, 0) && errno != ENOENT;
@@ -1845,7 +1881,6 @@ bool initialize_execute_state_from_resume(int dirfd,
 	clear_settings(settings);
 	free_job_list(list);
 	memset(state, 0, sizeof(*state));
-	state->resuming = true;
 
 	if (!read_settings_from_dir(settings, dirfd) ||
 	    !read_job_list(list, dirfd)) {
@@ -2183,6 +2218,11 @@ bool execute(struct execute_state *state,
 		return true;
 	}
 
+	if (state->next >= job_list->size) {
+		outf("All tests already executed.\n");
+		return true;
+	}
+
 	igt_list_for_each_entry(env_var, &settings->env_vars, link) {
 		setenv(env_var->key, env_var->value, 1);
 	}
@@ -2271,7 +2311,7 @@ bool execute(struct execute_state *state,
 	close(unamefd);
 
 	/* Check if we're already in abort-state at bootup */
-	if (!state->resuming) {
+	{
 		char *reason;
 
 		if ((reason = need_to_abort(settings)) != NULL) {
@@ -2280,6 +2320,17 @@ bool execute(struct execute_state *state,
 			free(reason);
 			free(nexttest);
 
+			/*
+			 * If an abort condition happened at bootup,
+			 * assume that it happens on every boot,
+			 * making this test execution impossible.
+			 * Write stuff to the results directory
+			 * indicating this so resuming immediately
+			 * finishes instead of getting stuck in an
+			 * infinite reboot loop.
+			 */
+			fill_results_directory_with_notruns(job_list, resdirfd);
+
 			status = false;
 
 			goto end;
Signature · 1 line
2.30.2
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for runner: Correctly handle abort before first test (rev4)

== Series Details ==

== Series Details ==

Series: runner: Correctly handle abort before first test (rev4)
URL : https://patchwork.freedesktop.org/series/96659/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12517 -> IGTPW_8259
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html

Participating hosts (41 -> 43)
------------------------------

Additional (2): bat-adln-1 bat-atsm-1

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_8259:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@hangcheck:
- {bat-atsm-1}: NOTRUN -> [FAIL][1] +37 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/bat-atsm-1/igt@i915_selftest@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence:
- {bat-atsm-1}: NOTRUN -> [SKIP][2] +7 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/bat-atsm-1/igt@[email protected]

Known issues
------------

Here are the changes found in IGTPW_8259 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-ilk-650: NOTRUN -> [SKIP][3] ([fdo#109271]) +20 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/fi-ilk-650/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [PASS][4] -> [DMESG-FAIL][5] ([i915#5334])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html

* igt@kms_chamelium@common-hpd-after-suspend:
- bat-dg1-5: NOTRUN -> [SKIP][6] ([fdo#111827])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/bat-dg1-5/igt@[email protected]

* igt@kms_chamelium@dp-hpd-fast:
- fi-ilk-650: NOTRUN -> [SKIP][7] ([fdo#109271] / [fdo#111827]) +8 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/fi-ilk-650/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-kefka: [PASS][8] -> [FAIL][9] ([i915#6298])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

#### Possible fixes ####

* igt@i915_selftest@live@migrate:
- {bat-adlp-6}: [DMESG-FAIL][10] ([i915#7699]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/bat-adlp-6/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/bat-adlp-6/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@mman:
- fi-rkl-guc: [TIMEOUT][12] ([i915#6794]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/fi-rkl-guc/igt@i915_selftest@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/fi-rkl-guc/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@workarounds:
- bat-dg1-5: [INCOMPLETE][14] ([i915#4983]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/bat-dg1-5/igt@i915_selftest@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/bat-dg1-5/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5174]: https://gitlab.freedesktop.org/drm/intel/issues/5174
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5775]: https://gitlab.freedesktop.org/drm/intel/issues/5775
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#6687]: https://gitlab.freedesktop.org/drm/intel/issues/6687
[i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7100 -> IGTPW_8259

CI-20190529: 20190529
CI_DRM_12517: 0ccc7ebce461c057c63b5879b8ace1a34ea8423a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8259: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html
IGT_7100: 04466b02a9b5356d266a899daa5183c1f6b0e20f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for runner: Correctly handle abort before first test (rev4)

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: runner: Correctly handle abort before first test (rev4)
URL : https://patchwork.freedesktop.org/series/96659/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12517_full -> IGTPW_8259_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html

Participating hosts (14 -> 10)
------------------------------

Missing (4): pig-skl-6260u pig-kbl-iris shard-tglu-10 pig-glk-j5005

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_8259_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@vc4/vc4_tiling@get-bad-modifier:
- {shard-rkl}: NOTRUN -> [SKIP][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-4/igt@vc4/[email protected]

Known issues
------------

Here are the changes found in IGTPW_8259_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_big_fb@4-tiled-16bpp-rotate-270:
- shard-glk: NOTRUN -> [SKIP][2] ([fdo#109271]) +15 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-glk4/igt@[email protected]

* igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-glk: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#3886])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-glk2/igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

* igt@kms_chamelium@hdmi-hpd-enable-disable-mode:
- shard-glk: NOTRUN -> [SKIP][4] ([fdo#109271] / [fdo#111827])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-glk6/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-move-continuous-exceed-sf:
- shard-glk: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#658])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-glk3/igt@[email protected]

#### Possible fixes ####

* igt@fbdev@nullptr:
- {shard-rkl}: [SKIP][6] ([i915#2582]) -> [PASS][7] +1 similar issue
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-5/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-3/igt@[email protected]

* igt@gem_eio@suspend:
- {shard-rkl}: [FAIL][8] ([i915#7052]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-3/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-1/igt@[email protected]

* igt@gem_exec_reloc@basic-write-read-noreloc:
- {shard-rkl}: [SKIP][10] ([i915#3281]) -> [PASS][11] +4 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-4/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-5/igt@[email protected]

* igt@gem_pread@snoop:
- {shard-rkl}: [SKIP][12] ([i915#3282]) -> [PASS][13] +3 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-4/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-5/igt@[email protected]

* igt@gen9_exec_parse@bb-start-far:
- {shard-rkl}: [SKIP][14] ([i915#2527]) -> [PASS][15] +1 similar issue
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-3/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-5/igt@[email protected]

* igt@i915_pm_rpm@drm-resources-equal:
- {shard-rkl}: [SKIP][16] ([fdo#109308]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-5/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@linear-32bpp-rotate-180:
- {shard-rkl}: [SKIP][18] ([i915#1845] / [i915#4098]) -> [PASS][19] +9 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-2/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip:
- {shard-tglu}: [SKIP][20] ([i915#7651]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-tglu-6/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-tglu-5/igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip-async-flip.html

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
- shard-glk: [FAIL][22] ([i915#72]) -> [PASS][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-glk4/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-glk2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-pgflip-blt:
- {shard-tglu}: [SKIP][24] ([i915#1849]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-tglu-6/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-tglu-5/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-rgb101010-draw-pwrite:
- {shard-rkl}: [SKIP][26] ([i915#1849] / [i915#4098]) -> [PASS][27] +9 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-5/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:
- {shard-rkl}: [SKIP][28] ([i915#3558]) -> [PASS][29] +1 similar issue
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-4/igt@kms_plane@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@kms_plane@[email protected]

* igt@kms_properties@crtc-properties-legacy:
- {shard-rkl}: [SKIP][30] ([i915#1849]) -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-5/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@[email protected]

* igt@kms_properties@plane-properties-legacy:
- {shard-dg1}: [DMESG-WARN][32] -> [PASS][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-dg1-18/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-dg1-18/igt@[email protected]

* igt@kms_psr@sprite_mmap_gtt:
- {shard-rkl}: [SKIP][34] ([i915#1072]) -> [PASS][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-5/igt@kms_psr@sprite_mmap_gtt.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/igt@kms_psr@sprite_mmap_gtt.html

* igt@testdisplay:
- {shard-rkl}: [SKIP][36] ([i915#4098]) -> [PASS][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12517/shard-rkl-4/[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/shard-rkl-6/[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3810]: https://gitlab.freedesktop.org/drm/intel/issues/3810
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5122]: https://gitlab.freedesktop.org/drm/intel/issues/5122
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5327]: https://gitlab.freedesktop.org/drm/intel/issues/5327
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#7052]: https://gitlab.freedesktop.org/drm/intel/issues/7052
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#72]: https://gitlab.freedesktop.org/drm/intel/issues/72
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7100 -> IGTPW_8259
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_12517: 0ccc7ebce461c057c63b5879b8ace1a34ea8423a @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8259: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html
IGT_7100: 04466b02a9b5356d266a899daa5183c1f6b0e20f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8259/index.html

Acked-by on v4 1/1
#3 lore raw
In reply to Petri Latvala
Quoted 18 lines · Petri Latvala

Don't leave the execution in a "please resume me" state if bootup causes an abort condition. Especially handle the case of abort on bootup when resuming correctly, so that it doesn't attempt to run a test on a tainted kernel if we've explicitly configured the runner to not execute when there's a taint.

v2: Fudge the results directory instead to get the desired results:
runner exits with nonzero, and resuming exits with "all done" instead of executing anything.

v3: Use faccessat instead of open+close, use less magic strings,
remember to close fds (Chris)

v4: Use GRACEFUL_EXITCODE in monitor_output, remove the 'resuming'
field (why was it a double?!). (Ryszard)
Stop trying to execute if all tests are already run, to avoid a crash in environment validation.

Quoted 5 lines
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Kamil Konieczny <[email protected]>
Cc Ryszard Knop <[email protected]>
Quoted 117 lines
---
 runner/executor.c | 57 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)
runner/executor.c +54 -3
index d2253082..e954c23e 100644
@@ -37,6 +37,7 @@
 
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
+#define GRACEFUL_EXITCODE -SIGHUP
 
 static struct {
 	int *fds;
@@ -1249,7 +1250,7 @@ static int monitor_output(pid_t child,
 					} else {
 						dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n",
 							EXECUTOR_EXIT,
-							-SIGHUP, 0.0);
+							GRACEFUL_EXITCODE, 0.0);
 						if (settings->sync)
 							fdatasync(outputs[_F_JOURNAL]);
 					}
@@ -1720,6 +1721,41 @@ out_dirfd:
 	return result;
 }
 
+static void fill_results_directory_with_notruns(struct job_list *list,
+						int resdirfd)
+{
+	int outputs[_F_LAST];
+	char name[32];
+	int dirfd;
+	size_t i;
+
+	for (i = 0; i < list->size; i++) {
+		snprintf(name, sizeof(name), "%zd", i);
+
+		if (faccessat(resdirfd, name, F_OK, 0) == 0)
+			continue;
+
+		mkdirat(resdirfd, name, 0777);
+		dirfd = openat(resdirfd, name, O_DIRECTORY | O_RDONLY);
+		if (dirfd < 0) {
+			errf("Error accessing individual test result directory\n");
+			return;
+		}
+
+		if (!open_output_files(dirfd, outputs, true)) {
+			errf("Error opening output files\n");
+			close(dirfd);
+			return;
+		}
+
+		dprintf(outputs[_F_OUT], "Forced notrun result because of abort condition on bootup\n");
+		dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n", EXECUTOR_EXIT, GRACEFUL_EXITCODE, 0.0);
+
+		close_outputs(outputs);
+		close(dirfd);
+	}
+}
+
 static int remove_file(int dirfd, const char *name)
 {
 	return unlinkat(dirfd, name, 0) && errno != ENOENT;
@@ -1845,7 +1881,6 @@ bool initialize_execute_state_from_resume(int dirfd,
 	clear_settings(settings);
 	free_job_list(list);
 	memset(state, 0, sizeof(*state));
-	state->resuming = true;
 
 	if (!read_settings_from_dir(settings, dirfd) ||
 	    !read_job_list(list, dirfd)) {
@@ -2183,6 +2218,11 @@ bool execute(struct execute_state *state,
 		return true;
 	}
 
+	if (state->next >= job_list->size) {
+		outf("All tests already executed.\n");
+		return true;
+	}
+
 	igt_list_for_each_entry(env_var, &settings->env_vars, link) {
 		setenv(env_var->key, env_var->value, 1);
 	}
@@ -2271,7 +2311,7 @@ bool execute(struct execute_state *state,
 	close(unamefd);
 
 	/* Check if we're already in abort-state at bootup */
-	if (!state->resuming) {
+	{
 		char *reason;
 
 		if ((reason = need_to_abort(settings)) != NULL) {
@@ -2280,6 +2320,17 @@ bool execute(struct execute_state *state,
 			free(reason);
 			free(nexttest);
 
+			/*
+			 * If an abort condition happened at bootup,
+			 * assume that it happens on every boot,
+			 * making this test execution impossible.
+			 * Write stuff to the results directory
+			 * indicating this so resuming immediately
+			 * finishes instead of getting stuck in an
+			 * infinite reboot loop.
+			 */
+			fill_results_directory_with_notruns(job_list, resdirfd);
+
 			status = false;
 
 			goto end;
Signature · 1 line
2.30.2
#4 lore raw
In reply to Petri Latvala

Hi Petri,

small nits, see below.

Quoted 40 lines · Petri Latvala

Don't leave the execution in a "please resume me" state if bootup causes an abort condition. Especially handle the case of abort on bootup when resuming correctly, so that it doesn't attempt to run a test on a tainted kernel if we've explicitly configured the runner to not execute when there's a taint.

v2: Fudge the results directory instead to get the desired results:
runner exits with nonzero, and resuming exits with "all done" instead of executing anything.

v3: Use faccessat instead of open+close, use less magic strings,
remember to close fds (Chris)

v4: Use GRACEFUL_EXITCODE in monitor_output, remove the 'resuming'
field (why was it a double?!). (Ryszard)
Stop trying to execute if all tests are already run, to avoid a crash in environment validation.

Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Kamil Konieczny <[email protected]>
Cc Ryszard Knop <[email protected]>
---
 runner/executor.c | 57 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)
runner/executor.c +1 -0
index d2253082..e954c23e 100644
@@ -37,6 +37,7 @@
 
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
+#define GRACEFUL_EXITCODE -SIGHUP
 
 static struct {
 	int *fds;

runner/executor.c static int monitor_output(pid_t child, · line 1251

Quoted 2 lines
runner/executor.c +0 -0
@@ -1249,7 +1250,7 @@ static int monitor_output(pid_t child,
 					} else {
 						dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n",

----------------------------------------------------------------------------------- ^ Maybe instead of %.3fs just put here 0.0s ?

runner/executor.c static int monitor_output(pid_t child, · line 1253

Quoted 3 lines
runner/executor.c +1 -1
 							EXECUTOR_EXIT,
-							-SIGHUP, 0.0);
+							GRACEFUL_EXITCODE, 0.0);

-------------------------------------------------------------------------- ^ Then you can drop 0.0 here.

Quoted 26 lines
runner/executor.c +19 -0
 						if (settings->sync)
 							fdatasync(outputs[_F_JOURNAL]);
 					}
@@ -1720,6 +1721,41 @@ out_dirfd:
 	return result;
 }
 
+static void fill_results_directory_with_notruns(struct job_list *list,
+						int resdirfd)
+{
+	int outputs[_F_LAST];
+	char name[32];
+	int dirfd;
+	size_t i;
+
+	for (i = 0; i < list->size; i++) {
+		snprintf(name, sizeof(name), "%zd", i);
+
+		if (faccessat(resdirfd, name, F_OK, 0) == 0)
+			continue;
+
+		mkdirat(resdirfd, name, 0777);
+		dirfd = openat(resdirfd, name, O_DIRECTORY | O_RDONLY);
+		if (dirfd < 0) {
+			errf("Error accessing individual test result directory\n");
+			return;

runner/executor.c out_dirfd: · line 1752

Quoted 10 lines
runner/executor.c +10 -0
+		}
+
+		if (!open_output_files(dirfd, outputs, true)) {
+			errf("Error opening output files\n");
+			close(dirfd);
+			return;
+		}
+
+		dprintf(outputs[_F_OUT], "Forced notrun result because of abort condition on bootup\n");
+		dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n", EXECUTOR_EXIT, GRACEFUL_EXITCODE, 0.0);

--------------------------------------------------- ^ ------------------------------------------ ^ Same here, you can just put here 0.0s instead.

Quoted 10 lines
runner/executor.c +6 -0
+
+		close_outputs(outputs);
+		close(dirfd);
+	}
+}
+
 static int remove_file(int dirfd, const char *name)
 {
 	return unlinkat(dirfd, name, 0) && errno != ENOENT;

runner/executor.c bool initialize_execute_state_from_resume(int dirfd, · line 1848

Quoted 4 lines
runner/executor.c +0 -1
@@ -1845,7 +1881,6 @@ bool initialize_execute_state_from_resume(int dirfd,
 	clear_settings(settings);
 	free_job_list(list);
 	memset(state, 0, sizeof(*state));
-	state->resuming = true;

It's not used anywhere so remove it from header.

With that fixed you can add my r-b,

Regards,
Kamil

Quoted 45 lines
runner/executor.c +17 -1
 	if (!read_settings_from_dir(settings, dirfd) ||
 	    !read_job_list(list, dirfd)) {
@@ -2183,6 +2218,11 @@ bool execute(struct execute_state *state,
 		return true;
 	}
 
+	if (state->next >= job_list->size) {
+		outf("All tests already executed.\n");
+		return true;
+	}
+
 	igt_list_for_each_entry(env_var, &settings->env_vars, link) {
 		setenv(env_var->key, env_var->value, 1);
 	}
@@ -2271,7 +2311,7 @@ bool execute(struct execute_state *state,
 	close(unamefd);
 
 	/* Check if we're already in abort-state at bootup */
-	if (!state->resuming) {
+	{
 		char *reason;
 
 		if ((reason = need_to_abort(settings)) != NULL) {
@@ -2280,6 +2320,17 @@ bool execute(struct execute_state *state,
 			free(reason);
 			free(nexttest);
 
+			/*
+			 * If an abort condition happened at bootup,
+			 * assume that it happens on every boot,
+			 * making this test execution impossible.
+			 * Write stuff to the results directory
+			 * indicating this so resuming immediately
+			 * finishes instead of getting stuck in an
+			 * infinite reboot loop.
+			 */
+			fill_results_directory_with_notruns(job_list, resdirfd);
+
 			status = false;
 
 			goto end;
Signature · 1 line
2.30.2
#5 lore raw
Quoted 95 lines · Kamil Konieczny

Hi Petri,

small nits, see below.

Quoted 40 lines · Petri Latvala

Don't leave the execution in a "please resume me" state if bootup causes an abort condition. Especially handle the case of abort on bootup when resuming correctly, so that it doesn't attempt to run a test on a tainted kernel if we've explicitly configured the runner to not execute when there's a taint.

v2: Fudge the results directory instead to get the desired results:
runner exits with nonzero, and resuming exits with "all done" instead of executing anything.

v3: Use faccessat instead of open+close, use less magic strings,
remember to close fds (Chris)

v4: Use GRACEFUL_EXITCODE in monitor_output, remove the 'resuming'
field (why was it a double?!). (Ryszard)
Stop trying to execute if all tests are already run, to avoid a crash in environment validation.

Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Kamil Konieczny <[email protected]>
Cc Ryszard Knop <[email protected]>
---
 runner/executor.c | 57 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 3 deletions(-)
runner/executor.c +1 -0
index d2253082..e954c23e 100644
@@ -37,6 +37,7 @@
 
 #define KMSG_HEADER "[IGT] "
 #define KMSG_WARN 4
+#define GRACEFUL_EXITCODE -SIGHUP
 
 static struct {
 	int *fds;

runner/executor.c static int monitor_output(pid_t child, · line 1251

Quoted 2 lines
runner/executor.c +0 -0
@@ -1249,7 +1250,7 @@ static int monitor_output(pid_t child,
 					} else {
 						dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n",

----------------------------------------------------------------------------------- ^ Maybe instead of %.3fs just put here 0.0s ?

runner/executor.c static int monitor_output(pid_t child, · line 1253

Quoted 3 lines
runner/executor.c +1 -1
 							EXECUTOR_EXIT,
-							-SIGHUP, 0.0);
+							GRACEFUL_EXITCODE, 0.0);

-------------------------------------------------------------------------- ^ Then you can drop 0.0 here.

Quoted 26 lines
runner/executor.c +19 -0
 						if (settings->sync)
 							fdatasync(outputs[_F_JOURNAL]);
 					}
@@ -1720,6 +1721,41 @@ out_dirfd:
 	return result;
 }
 
+static void fill_results_directory_with_notruns(struct job_list *list,
+						int resdirfd)
+{
+	int outputs[_F_LAST];
+	char name[32];
+	int dirfd;
+	size_t i;
+
+	for (i = 0; i < list->size; i++) {
+		snprintf(name, sizeof(name), "%zd", i);
+
+		if (faccessat(resdirfd, name, F_OK, 0) == 0)
+			continue;
+
+		mkdirat(resdirfd, name, 0777);
+		dirfd = openat(resdirfd, name, O_DIRECTORY | O_RDONLY);
+		if (dirfd < 0) {
+			errf("Error accessing individual test result directory\n");
+			return;

runner/executor.c out_dirfd: · line 1752

Quoted 10 lines
runner/executor.c +10 -0
+		}
+
+		if (!open_output_files(dirfd, outputs, true)) {
+			errf("Error opening output files\n");
+			close(dirfd);
+			return;
+		}
+
+		dprintf(outputs[_F_OUT], "Forced notrun result because of abort condition on bootup\n");
+		dprintf(outputs[_F_JOURNAL], "%s%d (%.3fs)\n", EXECUTOR_EXIT, GRACEFUL_EXITCODE, 0.0);

--------------------------------------------------- ^ ------------------------------------------ ^ Same here, you can just put here 0.0s instead.

Quoted 16 lines
Quoted 10 lines
runner/executor.c +6 -0
+
+		close_outputs(outputs);
+		close(dirfd);
+	}
+}
+
 static int remove_file(int dirfd, const char *name)
 {
 	return unlinkat(dirfd, name, 0) && errno != ENOENT;

runner/executor.c bool initialize_execute_state_from_resume(int dirfd, · line 1848

Quoted 4 lines
runner/executor.c +0 -1
@@ -1845,7 +1881,6 @@ bool initialize_execute_state_from_resume(int dirfd,
 	clear_settings(settings);
 	free_job_list(list);
 	memset(state, 0, sizeof(*state));
-	state->resuming = true;

It's not used anywhere so remove it from header.

I in fact did remove it! But then I forgot to git add...

Signature · 1 line
Petri Latvala
Quoted 51 lines

With that fixed you can add my r-b,

Regards,
Kamil

Quoted 45 lines
runner/executor.c +17 -1
 	if (!read_settings_from_dir(settings, dirfd) ||
 	    !read_job_list(list, dirfd)) {
@@ -2183,6 +2218,11 @@ bool execute(struct execute_state *state,
 		return true;
 	}
 
+	if (state->next >= job_list->size) {
+		outf("All tests already executed.\n");
+		return true;
+	}
+
 	igt_list_for_each_entry(env_var, &settings->env_vars, link) {
 		setenv(env_var->key, env_var->value, 1);
 	}
@@ -2271,7 +2311,7 @@ bool execute(struct execute_state *state,
 	close(unamefd);
 
 	/* Check if we're already in abort-state at bootup */
-	if (!state->resuming) {
+	{
 		char *reason;
 
 		if ((reason = need_to_abort(settings)) != NULL) {
@@ -2280,6 +2320,17 @@ bool execute(struct execute_state *state,
 			free(reason);
 			free(nexttest);
 
+			/*
+			 * If an abort condition happened at bootup,
+			 * assume that it happens on every boot,
+			 * making this test execution impossible.
+			 * Write stuff to the results directory
+			 * indicating this so resuming immediately
+			 * finishes instead of getting stuck in an
+			 * infinite reboot loop.
+			 */
+			fill_results_directory_with_notruns(job_list, resdirfd);
+
 			status = false;
 
 			goto end;
Signature · 1 line
2.30.2