Skip to contentSkip to conversation

runner: Implement --dry-run

PATCH In review Petri Latvala 3 participants 4 messages Jan 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 runner: Implement --dry-run

Actually implement --dry-run to not execute tests. With dry-run active, attempting to execute will figure out the list of things to execute, serialize them along with settings, and stop. This will be useful for CI that wants to post-mortem on failed test rounds to generate a list of tests that should have been executed and produce json result files (full of 'notrun') for proper statistics.

Cc Andi Shyti <[email protected]>
Cc Martin Peres <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Tomi Sarvela <[email protected]>
---
 runner/executor.c     |  7 +++++
 runner/executor.h     |  1 +
 runner/runner_tests.c | 70 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
runner/executor.c +7 -0
index 54c530b7..3f1eb010 100644
@@ -1153,6 +1153,8 @@ bool initialize_execute_state(struct execute_state *state,
 
 	init_time_left(state, settings);
 
+	state->dry = settings->dry_run;
+
 	return true;
 }
 
@@ -1204,6 +1206,11 @@ bool execute(struct execute_state *state,
 	double time_spent = 0.0;
 	bool status = true;
 
+	if (state->dry) {
+		printf("Dry run, not executing. Invoke igt_resume if you want to execute.\n");
+		return false;
+	}
+
 	if ((resdirfd = open(settings->results_path, O_DIRECTORY | O_RDONLY)) < 0) {
 		/* Initialize state should have done this */
 		fprintf(stderr, "Error: Failure opening results path %s\n",
runner/executor.h +1 -0
index 12883f15..6c83e649 100644
@@ -14,6 +14,7 @@ struct execute_state
 	 */
 	double time_left;
 	double resuming;
+	bool dry;
 };
 
 enum {
runner/runner_tests.c +70 -0

76 lines not on this page · raw message

Signature · 6 lines
2.19.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for runner: Implement --dry-run

== Series Details ==

== Series Details ==

Series: runner: Implement --dry-run
URL : https://patchwork.freedesktop.org/series/55551/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5460 -> IGTPW_2266
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/55551/revisions/1/mbox/

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

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

### IGT changes ###

#### Possible fixes ####

* igt@kms_frontbuffer_tracking@basic:
- {fi-icl-u2}: FAIL [fdo#103167] -> PASS

* igt@kms_pipe_crc_basic@read-crc-pipe-b:
- fi-byt-clapper: FAIL [fdo#107362] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-blb-e6850: INCOMPLETE [fdo#107718] -> PASS

* igt@pm_rpm@basic-rte:
- {fi-icl-u2}: DMESG-WARN [fdo#108654] -> PASS

* igt@prime_vgem@basic-fence-flip:
- fi-ilk-650: FAIL [fdo#104008] -> PASS
- fi-gdg-551: FAIL [fdo#103182] -> PASS

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

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
[fdo#104008]: https://bugs.freedesktop.org/show_bug.cgi?id=104008
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315

Participating hosts (46 -> 37)
------------------------------

Missing (9): fi-ilk-m540 fi-skl-6770hq fi-skl-guc fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-ivb-3520m fi-bdw-samus fi-kbl-r

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

* IGT: IGT_4781 -> IGTPW_2266

CI_DRM_5460: 5d3cf486ec004d6dfba7497503da6578d29bc1e1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2266: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2266/
IGT_4781: 34e312999df75d6ac68ca7714b9137df56acc3f8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2266/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for runner: Implement --dry-run

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: runner: Implement --dry-run
URL : https://patchwork.freedesktop.org/series/55551/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5460_full -> IGTPW_2266_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/55551/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_schedule@pi-ringfull-vebox:
- shard-kbl: NOTRUN -> FAIL [fdo#103158]

* igt@gem_linear_blits@interruptible:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-apl: PASS -> DMESG-WARN [fdo#107956]

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
- shard-apl: PASS -> FAIL [fdo#106510] / [fdo#108145]
- shard-glk: PASS -> FAIL [fdo#108145]

* igt@kms_cursor_crc@cursor-256x256-random:
- shard-glk: PASS -> FAIL [fdo#103232] +4
- shard-apl: PASS -> FAIL [fdo#103232] +3

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-kbl: PASS -> FAIL [fdo#103167] +2
- shard-apl: PASS -> FAIL [fdo#103167] +1

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
- shard-glk: PASS -> FAIL [fdo#103167] +11

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-glk: PASS -> INCOMPLETE [fdo#103359] / [k.org#198133]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-kbl: NOTRUN -> FAIL [fdo#108145] / [fdo#108590]

* igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
- shard-glk: PASS -> FAIL [fdo#103166] +4

* igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
- shard-apl: PASS -> FAIL [fdo#103166] +1

#### Possible fixes ####

* igt@gem_tiled_swapping@non-threaded:
- shard-apl: {SKIP} [fdo#109271] -> PASS

* igt@i915_suspend@fence-restore-untiled:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS +1

* igt@kms_available_modes_crc@available_mode_test_crc:
- shard-kbl: FAIL [fdo#106641] -> PASS

* igt@kms_color@pipe-b-degamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* igt@kms_cursor_crc@cursor-64x21-random:
- shard-apl: FAIL [fdo#103232] -> PASS +2

* igt@kms_cursor_crc@cursor-64x64-random:
- shard-kbl: FAIL [fdo#103232] -> PASS +1
- shard-glk: FAIL [fdo#103232] -> PASS +1

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite:
- shard-apl: FAIL [fdo#103167] -> PASS +4

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-glk: FAIL [fdo#103167] -> PASS +3
- shard-kbl: FAIL [fdo#103167] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-kbl: DMESG-WARN [fdo#103313] -> PASS

* igt@kms_plane@plane-position-covered-pipe-c-planes:
- shard-apl: FAIL [fdo#103166] -> PASS +5

* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-glk: FAIL [fdo#108145] -> PASS

* igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- shard-glk: FAIL [fdo#103166] -> PASS

* igt@kms_setmode@basic:
- shard-apl: FAIL [fdo#99912] -> PASS

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

[fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#106510]: https://bugs.freedesktop.org/show_bug.cgi?id=106510
[fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (7 -> 5)
------------------------------

Missing (2): shard-skl shard-iclb

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

* IGT: IGT_4781 -> IGTPW_2266
* Piglit: piglit_4509 -> None

CI_DRM_5460: 5d3cf486ec004d6dfba7497503da6578d29bc1e1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2266: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2266/
IGT_4781: 34e312999df75d6ac68ca7714b9137df56acc3f8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2266/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v1 1/1
#3 lore raw
In reply to Petri Latvala
Quoted 7 lines · Petri Latvala

Actually implement --dry-run to not execute tests. With dry-run active, attempting to execute will figure out the list of things to execute, serialize them along with settings, and stop. This will be useful for CI that wants to post-mortem on failed test rounds to generate a list of tests that should have been executed and produce json result files (full of 'notrun') for proper statistics.

Quoted 5 lines
Cc Andi Shyti <[email protected]>
Cc Martin Peres <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Tomi Sarvela <[email protected]>

Looks clean and very well tested! Thanks!

Quoted 115 lines
---
 runner/executor.c     |  7 +++++
 runner/executor.h     |  1 +
 runner/runner_tests.c | 70 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
runner/executor.c +7 -0
index 54c530b7..3f1eb010 100644
@@ -1153,6 +1153,8 @@ bool initialize_execute_state(struct execute_state *state,
 
 	init_time_left(state, settings);
 
+	state->dry = settings->dry_run;
+
 	return true;
 }
 
@@ -1204,6 +1206,11 @@ bool execute(struct execute_state *state,
 	double time_spent = 0.0;
 	bool status = true;
 
+	if (state->dry) {
+		printf("Dry run, not executing. Invoke igt_resume if you want to execute.\n");
+		return false;
+	}
+
 	if ((resdirfd = open(settings->results_path, O_DIRECTORY | O_RDONLY)) < 0) {
 		/* Initialize state should have done this */
 		fprintf(stderr, "Error: Failure opening results path %s\n",
runner/executor.h +1 -0
index 12883f15..6c83e649 100644
@@ -14,6 +14,7 @@ struct execute_state
 	 */
 	double time_left;
 	double resuming;
+	bool dry;
 };
 
 enum {
runner/runner_tests.c +63 -0
index 6213b8e7..0965612a 100644
@@ -742,6 +742,76 @@ igt_main
 		}
 	}
 
+	igt_subtest_group {
+		char dirname[] = "tmpdirXXXXXX";
+		struct job_list list;
+		int dirfd = -1, subdirfd = -1, fd = -1;
+
+		igt_fixture {
+			init_job_list(&list);
+			igt_require(mkdtemp(dirname) != NULL);
+			rmdir(dirname);
+		}
+
+		igt_subtest("dry-run-option") {
+			struct execute_state state;
+			const char *argv[] = { "runner",
+					       "--dry-run",
+					       testdatadir,
+					       dirname,
+			};
+
+			igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+			igt_assert(create_job_list(&list, &settings));
+
+			igt_assert(initialize_execute_state(&state, &settings, &list));
+			igt_assert_eq(state.next, 0);
+			igt_assert(state.dry);
+			igt_assert_eq(list.size, 5);
+
+			igt_assert_f((dirfd = open(dirname, O_DIRECTORY | O_RDONLY)) >= 0,
+				     "Dry run initialization didn't create the results directory.\n");
+
+			/* Execute from just initialize_execute_state should fail */
+			igt_assert(!execute(&state, &settings, &list));
+			igt_assert(openat(dirfd, "0", O_DIRECTORY | O_RDONLY) < 0);
+			igt_assert_f((fd = openat(dirfd, "metadata.txt", O_RDONLY)) >= 0,
+				     "Dry run initialization didn't serialize settings.\n");
+			close(fd);
+			igt_assert_f((fd = openat(dirfd, "joblist.txt", O_RDONLY)) >= 0,
+				     "Dry run initialization didn't serialize the job list.\n");
+			close(fd);
+			igt_assert_f((fd = openat(dirfd, "uname.txt", O_RDONLY)) < 0,
+				     "Dry run initialization created uname.txt.\n");
+
+			igt_assert(initialize_execute_state_from_resume(dirfd, &state, &settings, &list));
+			igt_assert_eq(state.next, 0);
+			igt_assert(!state.dry);
+			igt_assert_eq(list.size, 5);
+			/* initialize_execute_state_from_resume() closes the dirfd */
+			igt_assert_f((dirfd = open(dirname, O_DIRECTORY | O_RDONLY)) >= 0,
+				     "Dry run resume somehow deleted the results directory.\n");
+
+			/* Execute from resume should work */
+			igt_assert(execute(&state, &settings, &list));
+			igt_assert_f((fd = openat(dirfd, "uname.txt", O_RDONLY)) >= 0,
+				     "Dry run resume didn't create uname.txt.\n");
+			close(fd);
+			igt_assert_f((subdirfd = openat(dirfd, "0", O_DIRECTORY | O_RDONLY)) >= 0,
+				     "Dry run resume didn't create result directory.\n");
+			igt_assert_f((fd = openat(subdirfd, "journal.txt", O_RDONLY)) >= 0,
+				     "Dry run resume didn't create a journal.\n");
+		}
+
+		igt_fixture {
+			close(fd);

runner/runner_tests.c igt_main · line 817

Quoted 10 lines
runner/runner_tests.c +7 -0
+			close(dirfd);
+			close(subdirfd);
+			clear_directory(dirname);
+			free_job_list(&list);
+		}
+	}
+
 	igt_subtest_group {
 		char dirname[] = "tmpdirXXXXXX";
 		struct job_list list;

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev