From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 4/7] runner/runner_tests: Add tests for socket communications
Date: Fri, 28 Oct 2022 15:49:49 +0200 [thread overview]
Message-ID: <Y1vd/S2yz6gnEQXA@kamilkon-desk1> (raw)
In-Reply-To: <20221010145708.1986912-4-petri.latvala@intel.com>
Hi Petri,
On 2022-10-10 at 17:57:05 +0300, Petri Latvala wrote:
imho at least one line of comment here but it's your choice.
Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arek@hiler.eu>
> ---
> runner/runner_tests.c | 186 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 186 insertions(+)
>
> diff --git a/runner/runner_tests.c b/runner/runner_tests.c
> index db0ce2ac..a7e968f8 100644
> --- a/runner/runner_tests.c
> +++ b/runner/runner_tests.c
> @@ -7,6 +7,7 @@
> #include <json.h>
>
> #include "igt.h"
> +#include "runnercomms.h"
>
> #include "settings.h"
> #include "job_list.h"
> @@ -239,6 +240,16 @@ static void assert_execution_results_exist(int dirfd)
> assert_execution_created(dirfd, "dmesg.txt");
> }
>
> +static void write_packet_with_canary(int fd, struct runnerpacket *packet)
> +{
> + uint32_t canary = socket_dump_canary();
> +
> + write(fd, &canary, sizeof(canary));
> + write(fd, packet, packet->size);
> +
> + free(packet);
> +}
> +
> igt_main
> {
> struct settings *settings = malloc(sizeof(*settings));
> @@ -1226,6 +1237,62 @@ igt_main
> }
> }
>
> + igt_subtest_group {
> + char dirname[] = "tmpdirXXXXXX";
> + struct job_list *list = malloc(sizeof(*list));
> + volatile int dirfd = -1, subdirfd = -1, fd = -1;
> +
> + igt_fixture {
> + init_job_list(list);
> + igt_require(mkdtemp(dirname) != NULL);
> + }
> +
> + igt_subtest("execute-initialize-subtest-started-comms") {
> + struct execute_state state;
> + const char *argv[] = { "runner",
> + "--allow-non-root",
> + "--multiple-mode",
> + "-t", "successtest",
> + testdatadir,
> + dirname,
> + };
> + const char excludestring[] = "!first-subtest";
> +
> + igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, settings));
> + igt_assert(create_job_list(list, settings));
> + igt_assert(list->size == 1);
> + igt_assert(list->entries[0].subtest_count == 0);
> +
> + igt_assert(serialize_settings(settings));
> + igt_assert(serialize_job_list(list, settings));
> +
> + igt_assert((dirfd = open(dirname, O_DIRECTORY | O_RDONLY)) >= 0);
> + igt_assert(mkdirat(dirfd, "0", 0770) == 0);
> + igt_assert((subdirfd = openat(dirfd, "0", O_DIRECTORY | O_RDONLY)) >= 0);
> + igt_assert((fd = openat(subdirfd, "comms", O_CREAT | O_WRONLY | O_EXCL, 0660)) >= 0);
> + write_packet_with_canary(fd, runnerpacket_subtest_start("first-subtest"));
> +
> + free_job_list(list);
> + clear_settings(settings);
> + igt_assert(initialize_execute_state_from_resume(dirfd, &state, settings, list));
> +
> + igt_assert_eq(state.next, 0);
> + igt_assert_eq(list->size, 1);
> + igt_assert_eq(list->entries[0].subtest_count, 2);
> + igt_assert_eqstr(list->entries[0].subtests[0], "*");
> + igt_assert_eqstr(list->entries[0].subtests[1], excludestring);
> + }
> +
> + igt_fixture {
> + close(fd);
> + close(subdirfd);
> + close(dirfd);
> + clear_directory(dirname);
> + free_job_list(list);
> + free(list);
> + }
> + }
> +
> igt_subtest_group {
> char dirname[] = "tmpdirXXXXXX";
> struct job_list *list = malloc(sizeof(*list));
> @@ -1282,6 +1349,62 @@ igt_main
> }
> }
>
> + igt_subtest_group {
> + char dirname[] = "tmpdirXXXXXX";
> + struct job_list *list = malloc(sizeof(*list));
> + volatile int dirfd = -1, subdirfd = -1, fd = -1;
> +
> + igt_fixture {
> + init_job_list(list);
> + igt_require(mkdtemp(dirname) != NULL);
> + }
> +
> + igt_subtest("execute-initialize-all-subtests-started-comms") {
> + struct execute_state state;
> + const char *argv[] = { "runner",
> + "--allow-non-root",
> + "--multiple-mode",
> + "-t", "successtest@first-subtest",
> + "-t", "successtest@second-subtest",
> + testdatadir,
> + dirname,
> + };
> +
> + igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, settings));
> + igt_assert(create_job_list(list, settings));
> + igt_assert(list->size == 1);
> + igt_assert(list->entries[0].subtest_count == 2);
> +
> + igt_assert(serialize_settings(settings));
> + igt_assert(serialize_job_list(list, settings));
> +
> + igt_assert((dirfd = open(dirname, O_DIRECTORY | O_RDONLY)) >= 0);
> + igt_assert(mkdirat(dirfd, "0", 0770) == 0);
> + igt_assert((subdirfd = openat(dirfd, "0", O_DIRECTORY | O_RDONLY)) >= 0);
> + igt_assert((fd = openat(subdirfd, "comms", O_CREAT | O_WRONLY | O_EXCL, 0660)) >= 0);
> + write_packet_with_canary(fd, runnerpacket_subtest_start("first-subtest"));
> + write_packet_with_canary(fd, runnerpacket_subtest_start("second-subtest"));
> +
> + free_job_list(list);
> + clear_settings(settings);
> + igt_assert(initialize_execute_state_from_resume(dirfd, &state, settings, list));
> +
> + /* All subtests are in journal, the entry should be considered completed */
> + igt_assert_eq(state.next, 1);
> + igt_assert_eq(list->size, 1);
> + igt_assert_eq(list->entries[0].subtest_count, 4);
> + }
> +
> + igt_fixture {
> + close(fd);
> + close(subdirfd);
> + close(dirfd);
> + clear_directory(dirname);
> + free_job_list(list);
> + free(list);
> + }
> + }
> +
> igt_subtest_group {
> char dirname[] = "tmpdirXXXXXX";
> struct job_list *list = malloc(sizeof(*list));
> @@ -1341,6 +1464,66 @@ igt_main
> }
> }
>
> + igt_subtest_group {
> + char dirname[] = "tmpdirXXXXXX";
> + struct job_list *list = malloc(sizeof(*list));
> + volatile int dirfd = -1, subdirfd = -1, fd = -1;
> +
> + igt_fixture {
> + init_job_list(list);
> + igt_require(mkdtemp(dirname) != NULL);
> + }
> +
> + igt_subtest("execute-initialize-subtests-complete-comms") {
> + struct execute_state state;
> + const char *argv[] = { "runner",
> + "--allow-non-root",
> + "--multiple-mode",
> + testdatadir,
> + dirname,
> + };
> +
> + igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, settings));
> + igt_assert(create_job_list(list, settings));
> + igt_assert(list->size == NUM_TESTDATA_BINARIES);
> +
> + if (!strcmp(list->entries[0].binary, "no-subtests")) {
> + struct job_list_entry tmp = list->entries[0];
> + list->entries[0] = list->entries[1];
> + list->entries[1] = tmp;
> + }
> +
> + igt_assert(list->entries[0].subtest_count == 0);
> +
> + igt_assert(serialize_settings(settings));
> + igt_assert(serialize_job_list(list, settings));
> +
> + igt_assert_lte(0, dirfd = open(dirname, O_DIRECTORY | O_RDONLY));
> + igt_assert_eq(mkdirat(dirfd, "0", 0770), 0);
> + igt_assert((subdirfd = openat(dirfd, "0", O_DIRECTORY | O_RDONLY)) >= 0);
> + igt_assert((fd = openat(subdirfd, "comms", O_CREAT | O_WRONLY | O_EXCL, 0660)) >= 0);
> + write_packet_with_canary(fd, runnerpacket_subtest_start("first-subtest"));
> + write_packet_with_canary(fd, runnerpacket_subtest_start("second-subtest"));
> + write_packet_with_canary(fd, runnerpacket_exit(0, "0.000s"));
> +
> + free_job_list(list);
> + clear_settings(settings);
> + igt_assert(initialize_execute_state_from_resume(dirfd, &state, settings, list));
> +
> + igt_assert_eq(state.next, 1);
> + igt_assert_eq(list->size, NUM_TESTDATA_BINARIES);
> + }
> +
> + igt_fixture {
> + close(fd);
> + close(subdirfd);
> + close(dirfd);
> + clear_directory(dirname);
> + free_job_list(list);
> + free(list);
> + }
> + }
> +
> igt_subtest_group {
> struct job_list *list = malloc(sizeof(*list));
> volatile int dirfd = -1, subdirfd = -1, fd = -1;
> @@ -1490,6 +1673,8 @@ igt_main
> char dirname[] = "tmpdirXXXXXX";
>
> igt_fixture {
> + /* This test checks that the stdout parsing for result without time data works, so use that */
> + setenv("IGT_RUNNER_DISABLE_SOCKET_COMMUNICATION", "1", 1);
> igt_require(mkdtemp(dirname) != NULL);
> rmdir(dirname);
> }
> @@ -1554,6 +1739,7 @@ igt_main
> close(dirfd);
> clear_directory(dirname);
> free_job_list(list);
> + unsetenv("IGT_RUNNER_DISABLE_SOCKET_COMMUNICATION");
> }
> }
>
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-10-28 13:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 14:57 [igt-dev] [PATCH i-g-t 1/7] lib/runnercomms: Structured communication from tests to igt_runner Petri Latvala
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: Send logs to runner with comms Petri Latvala
2022-10-28 13:46 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 3/7] runner: Use socket communications Petri Latvala
2022-10-28 13:47 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 4/7] runner/runner_tests: Add tests for " Petri Latvala
2022-10-28 13:49 ` Kamil Konieczny [this message]
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 5/7] lib/tests: Add unit tests for socket communication packet creation Petri Latvala
2022-10-28 13:51 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 6/7] runner: Add a socket comms decoder Petri Latvala
2022-10-28 13:52 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 7/7] runner: Disable socket communications for now Petri Latvala
2022-10-28 13:59 ` Kamil Konieczny
2022-10-31 10:16 ` Petri Latvala
2022-10-10 15:56 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/7] lib/runnercomms: Structured communication from tests to igt_runner Patchwork
2022-10-10 21:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-11 6:25 ` Petri Latvala
2022-10-11 16:44 ` Vudum, Lakshminarayana
2022-10-11 6:45 ` Patchwork
2022-10-11 15:56 ` Patchwork
2022-10-11 16:38 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2022-10-28 13:42 ` [igt-dev] [PATCH i-g-t 1/7] " Kamil Konieczny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1vd/S2yz6gnEQXA@kamilkon-desk1 \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox