From: Petri Latvala <petri.latvala@intel.com>
To: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/4] lib: Export a function for loading igtrc
Date: Fri, 13 Sep 2019 12:26:21 +0300 [thread overview]
Message-ID: <20190913092621.GM4019@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20190910124124.onjcnqpipsptroqb@ahiler-desk1.fi.intel.com>
On Tue, Sep 10, 2019 at 03:41:24PM +0300, Arkadiusz Hiler wrote:
> On Mon, Sep 09, 2019 at 02:38:06PM +0300, Petri Latvala wrote:
> > Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> > Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> > ---
> > lib/igt_core.c | 40 +++++++++++++++++++++++++++++++---------
> > lib/igt_core.h | 2 ++
> > 2 files changed, 33 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 1cbb09f9..940913c1 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -642,11 +642,21 @@ static void oom_adjust_for_doom(void)
> >
> > }
> >
> > -static void common_init_config(void)
> > +/**
> > + * load_igtrc:
> > + *
> > + * Load .igtrc from the path pointed to by #IGT_CONFIG_PATH or from
> > + * home directory if that is not set. The returned keyfile needs to be
> > + * deallocated using g_key_file_free().
> > + *
> > + * Returns: Pointer to the keyfile, NULL on error.
> > + */
> > +GKeyFile *igt_load_igtrc(void)
> > {
> > char *key_file_env = NULL;
> > char *key_file_loc = NULL;
> > GError *error = NULL;
> > + GKeyFile *file;
> > int ret;
> >
> > /* Determine igt config path */
> > @@ -659,19 +669,35 @@ static void common_init_config(void)
> > }
> >
> > /* Load igt config file */
> > - igt_key_file = g_key_file_new();
> > - ret = g_key_file_load_from_file(igt_key_file, key_file_loc,
> > + file = g_key_file_new();
> > + ret = g_key_file_load_from_file(file, key_file_loc,
> > G_KEY_FILE_NONE, &error);
> > if (!ret) {
> > g_error_free(error);
> > - g_key_file_free(igt_key_file);
> > - igt_key_file = NULL;
> > + g_key_file_free(file);
> > + file = NULL;
> >
> > goto out;
> > }
> >
> > g_clear_error(&error);
> >
> > + out:
> > + if (!key_file_env && key_file_loc)
> > + free(key_file_loc);
> > +
> > + return file;
> > +}
> > +
> > +static void common_init_config(void)
> > +{
> > + GError *error = NULL;
> > + int ret;
> > +
> > + igt_key_file = igt_load_igtrc();
> > + if (!igt_key_file)
> > + return;
> > +
> > if (!igt_frame_dump_path)
> > igt_frame_dump_path =
> > g_key_file_get_string(igt_key_file, "Common",
> > @@ -687,10 +713,6 @@ static void common_init_config(void)
> >
> > if (ret != 0)
> > igt_set_autoresume_delay(ret);
> > -
> > -out:
> > - if (!key_file_env && key_file_loc)
> > - free(key_file_loc);
> > }
> >
> > static void common_init_env(void)
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index 177d2431..521cda10 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -83,6 +83,8 @@ extern const char* __igt_test_description __attribute__((weak));
> > extern bool __igt_plain_output;
> > extern char *igt_frame_dump_path;
> >
> > +struct _GKeyFile *igt_load_igtrc(void);
>
> Why not GKeyFile *...?
That would require #include <glib.h> in igt_core.h and spread that
dependency further than feels ok.
--
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-09-13 9:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 11:38 [igt-dev] [PATCH i-g-t 1/4] lib: Export a function for loading igtrc Petri Latvala
2019-09-09 11:38 ` [igt-dev] [PATCH i-g-t 2/4] runner: Add support for aborting on network failure Petri Latvala
2019-09-10 12:43 ` Arkadiusz Hiler
2019-09-09 11:38 ` [igt-dev] [PATCH i-g-t 3/4] HAX: Check all conditions to abort Petri Latvala
2019-09-09 11:38 ` [igt-dev] [PATCH i-g-t 4/4] HAX: Print ping times to stderr Petri Latvala
2019-09-09 11:50 ` Petri Latvala
2019-09-09 12:12 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib: Export a function for loading igtrc Patchwork
2019-09-09 12:29 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib: Export a function for loading igtrc (rev2) Patchwork
2019-09-09 17:40 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] lib: Export a function for loading igtrc Patchwork
2019-09-09 18:31 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] lib: Export a function for loading igtrc (rev2) Patchwork
2019-09-10 12:41 ` [igt-dev] [PATCH i-g-t 1/4] lib: Export a function for loading igtrc Arkadiusz Hiler
2019-09-13 9:26 ` Petri Latvala [this message]
2019-09-13 10:50 ` Arkadiusz Hiler
2019-09-13 12:48 ` Petri Latvala
2019-09-16 13:00 ` Arkadiusz Hiler
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=20190913092621.GM4019@platvala-desk.ger.corp.intel.com \
--to=petri.latvala@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