From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t v2 05/11] runner/resultgen: Extrude dynamic subtest result texts
Date: Tue, 17 Dec 2019 11:47:54 +0200 [thread overview]
Message-ID: <20191217094800.30687-5-petri.latvala@intel.com> (raw)
In-Reply-To: <20191217094800.30687-1-petri.latvala@intel.com>
The first dynamic part now starts its reported output at the beginning
of its subtest's output, and the last dynamic part ends its reported
output at the end of its subtest's output.
v2: Rebase
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
runner/resultgen.c | 64 ++++++++++++++++++++++++++++++----------------
1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/runner/resultgen.c b/runner/resultgen.c
index 4a5d329c..ed61b922 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -431,17 +431,18 @@ static int find_subtest_idx(struct matches matches,
return find_subtest_idx_limited(matches, bufend, linekey, pattern, subtest_name, 0, matches.size);
}
-static const char *find_subtest_begin_limit(struct matches matches,
- int begin_idx,
- int result_idx,
- const char *buf,
- const char *bufend)
+static const char *find_subtest_begin_limit_limited(struct matches matches,
+ int begin_idx,
+ int result_idx,
+ const char *buf,
+ const char *bufend,
+ int first_idx)
{
/* No matching output at all, include everything */
- if (begin_idx < 0 && result_idx < 0)
+ if (begin_idx < first_idx && result_idx < first_idx)
return buf;
- if (begin_idx < 0) {
+ if (begin_idx < first_idx) {
/*
* Subtest didn't start, but we have the
* result. Probably because an igt_fixture
@@ -450,37 +451,48 @@ static const char *find_subtest_begin_limit(struct matches matches,
* We go backwards one match from the result match,
* and start from the next line.
*/
- if (result_idx > 0)
+ if (result_idx > first_idx)
return next_line(matches.items[result_idx - 1].where, bufend);
else
return buf;
}
/* Include all non-special output before the beginning line. */
- if (begin_idx == 0)
+ if (begin_idx <= first_idx)
return buf;
return next_line(matches.items[begin_idx - 1].where, bufend);
}
-static const char *find_subtest_end_limit(struct matches matches,
- int begin_idx,
- int result_idx,
- const char *buf,
- const char *bufend)
+static const char *find_subtest_begin_limit(struct matches matches,
+ int begin_idx,
+ int result_idx,
+ const char *buf,
+ const char *bufend)
+{
+ return find_subtest_begin_limit_limited(matches, begin_idx, result_idx, buf, bufend, 0);
+}
+
+static const char *find_subtest_end_limit_limited(struct matches matches,
+ int begin_idx,
+ int result_idx,
+ const char *buf,
+ const char *bufend,
+ int first_idx,
+ int last_idx)
{
int k;
/* No matching output at all, include everything */
- if (begin_idx < 0 && result_idx < 0)
+ if (begin_idx < first_idx && result_idx < first_idx)
return bufend;
- if (result_idx < 0) {
+ if (result_idx < first_idx) {
/*
* Incomplete result. Include all output up to the
* next starting subtest, or the result of one.
*/
- for (k = begin_idx + 1; k < matches.size; k++) {
+ for (k = begin_idx + 1; k < last_idx; k++) {
if (matches.items[k].what == STARTING_SUBTEST ||
matches.items[k].what == SUBTEST_RESULT)
return matches.items[k].where;
@@ -490,12 +502,21 @@ static const char *find_subtest_end_limit(struct matches matches,
}
/* Include all non-special output to the next match, whatever it is. */
- if (result_idx < matches.size - 1)
+ if (result_idx < last_idx - 1)
return matches.items[result_idx + 1].where;
return bufend;
}
+static const char *find_subtest_end_limit(struct matches matches,
+ int begin_idx,
+ int result_idx,
+ const char *buf,
+ const char *bufend)
+{
+ return find_subtest_end_limit_limited(matches, begin_idx, result_idx, buf, bufend, 0, matches.size);
+}
+
static void process_dynamic_subtest_output(const char *piglit_name,
const char *igt_version,
size_t igt_version_len,
@@ -538,8 +559,8 @@ static void process_dynamic_subtest_output(const char *piglit_name,
dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
- dynbeg = find_subtest_begin_limit(matches, k, dyn_result_idx, beg, end);
- dynend = find_subtest_end_limit(matches, k, dyn_result_idx, beg, end);
+ dynbeg = find_subtest_begin_limit_limited(matches, k, dyn_result_idx, beg, end, begin_idx + 1);
+ dynend = find_subtest_end_limit_limited(matches, k, dyn_result_idx, beg, end, begin_idx + 1, result_idx);
generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
@@ -938,8 +959,7 @@ static bool fill_from_dmesg(int fd,
}
}
append_line(&dmesg, &dmesglen, formatted);
- if (current_test != NULL)
- append_line(&dynamic_dmesg, &dynamic_dmesg_len, formatted);
+ append_line(&dynamic_dmesg, &dynamic_dmesg_len, formatted);
free(formatted);
}
free(line);
--
2.19.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-12-17 9:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
2019-12-27 8:45 ` Arkadiusz Hiler
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t v2 03/11] runner/resultgen: Extract finding begin/end pointers for test output to helpers Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t v2 04/11] runner/resultgen: Hoist handling of dynamic subtest output to a helper Petri Latvala
2019-12-17 9:47 ` Petri Latvala [this message]
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t 06/11] runner/resultgen: Add support for extra validation hook in find_matches() Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t 07/11] runner/resultgen: Make subtest result line finding more robust Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t 08/11] runner/json_tests: Adapt to dynamic subtest result parsing Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests Petri Latvala
2019-12-17 9:47 ` [igt-dev] [PATCH i-g-t 10/11] runner/json_tests: Adapt to no longer reporting subtests with " Petri Latvala
2019-12-17 9:48 ` [igt-dev] [PATCH i-g-t 11/11] runner/json_tests: Add test for parsing dynamic subtests with same name Petri Latvala
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=20191217094800.30687-5-petri.latvala@intel.com \
--to=petri.latvala@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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