From: "Ser, Simon" <simon.ser@intel.com>
To: "Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 1/3] runner: Reinitialize compiled dmesg regexp each parsing session
Date: Mon, 1 Apr 2019 07:23:45 +0000 [thread overview]
Message-ID: <931ceaabf7244d530eaf86d2faa0c2fc2d48e0b9.camel@intel.com> (raw)
In-Reply-To: <20190401064657.23322-1-arkadiusz.hiler@intel.com>
On Mon, 2019-04-01 at 09:46 +0300, Arkadiusz Hiler wrote:
> Which regexp gets compiled is settings specific, depending whether we
> run piglit-style or not.
>
> If it's optimized to be initialized only once and it is a global
> variable, it will be "stuck" in the mode we have selected with the
> first
> run, which may break tests.
>
> Let's remove this optimization and initialize it each time, as it takes
> less 0.002s on my hardware.
>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
> runner/resultgen.c | 29 +++++++++++------------------
> 1 file changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index 32b59d59..73fda64f 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -499,27 +499,18 @@ static const char igt_dmesg_whitelist[] =
> static const char igt_piglit_style_dmesg_blacklist[] =
> "(\\[drm:|drm_|intel_|i915_)";
>
> -static regex_t re;
> -
> -static int init_regex_whitelist(struct settings *settings)
> +static bool init_regex_whitelist(struct settings *settings, regex_t* re)
Style nit: the * should be on the right
Otherwise, this is:
Reviewed-by: Simon Ser <simon.ser@intel.com>
> {
> - static int status = -1;
> + const char *regex = settings->piglit_style_dmesg ?
> + igt_piglit_style_dmesg_blacklist :
> + igt_dmesg_whitelist;
>
> - if (status == -1) {
> - const char *regex = settings->piglit_style_dmesg ?
> - igt_piglit_style_dmesg_blacklist :
> - igt_dmesg_whitelist;
> -
> - if (regcomp(&re, regex, REG_EXTENDED | REG_NOSUB) != 0)
> {
> - fprintf(stderr, "Cannot compile dmesg
> regexp\n");
> - status = 1;
> - return false;
> - }
> -
> - status = 0;
> + if (regcomp(re, regex, REG_EXTENDED | REG_NOSUB) != 0) {
> + fprintf(stderr, "Cannot compile dmesg regexp\n");
> + return false;
> }
>
> - return status;
> + return true;
> }
>
> static bool parse_dmesg_line(char* line,
> @@ -639,12 +630,13 @@ static bool fill_from_dmesg(int fd,
> char piglit_name[256];
> ssize_t read;
> size_t i;
> + regex_t re;
>
> if (!f) {
> return false;
> }
>
> - if (init_regex_whitelist(settings)) {
> + if (!init_regex_whitelist(settings, &re)) {
> fclose(f);
> return false;
> }
> @@ -723,6 +715,7 @@ static bool fill_from_dmesg(int fd,
>
> free(dmesg);
> free(warnings);
> + regfree(&re);
> fclose(f);
> return true;
> }
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-04-01 7:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 6:46 [igt-dev] [PATCH i-g-t 1/3] runner: Reinitialize compiled dmesg regexp each parsing session Arkadiusz Hiler
2019-04-01 6:46 ` [igt-dev] [PATCH i-g-t 2/3] runner: Refactor metadata parsing Arkadiusz Hiler
2019-04-01 10:24 ` Petri Latvala
2019-04-01 6:46 ` [igt-dev] [PATCH i-g-t 3/3] runner: Add --dmesg-warn-level switch Arkadiusz Hiler
2019-04-01 11:10 ` Petri Latvala
2019-04-01 7:20 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] runner: Reinitialize compiled dmesg regexp each parsing session Patchwork
2019-04-01 7:23 ` Ser, Simon [this message]
2019-04-01 8:16 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=931ceaabf7244d530eaf86d2faa0c2fc2d48e0b9.camel@intel.com \
--to=simon.ser@intel.com \
--cc=arkadiusz.hiler@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