From: Daniel Vetter <daniel@ffwll.ch>
To: tim.gore@intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] lib/igt_core: make single/simple tests use igt_exit
Date: Mon, 29 Sep 2014 15:15:15 +0200 [thread overview]
Message-ID: <20140929131515.GN4109@phenom.ffwll.local> (raw)
In-Reply-To: <1411723644-26558-2-git-send-email-tim.gore@intel.com>
On Fri, Sep 26, 2014 at 10:27:23AM +0100, tim.gore@intel.com wrote:
> From: Tim Gore <tim.gore@intel.com>
>
> Currently tests that use igt_simple_main will simply call
> "exit()" if they pass, making it difficult to ensure that
> any required cleanup is done. At present this is not an
> issue, but it will be when I submit a patch to turn off the
> lowmemorykiller for all tests.
>
> Signed-off-by: Tim Gore <tim.gore@intel.com>
igt_install_exit_handler and you're done. Sorry if I was a bit unclear
with what I've meant exactly. Btw there's some cute docs for all this
stuff:
http://people.freedesktop.org/~danvet/igt/intel-gpu-tools-i-g-t-core.html
Worth reading once in a while, at least the overview sections ;-)
Cheers, Daniel
> ---
> lib/igt_core.c | 9 +++++----
> lib/igt_core.h | 2 +-
> tests/igt_simulation.c | 2 +-
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 5d41468..9344815 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -641,7 +641,7 @@ bool igt_only_list_subtests(void)
> static bool skipped_one = false;
> static bool succeeded_one = false;
> static bool failed_one = false;
> -static int igt_exitcode;
> +static int igt_exitcode = IGT_EXIT_SUCCESS;
>
> static void exit_subtest(const char *) __attribute__((noreturn));
> static void exit_subtest(const char *result)
> @@ -692,7 +692,8 @@ void igt_skip(const char *f, ...)
> assert(in_fixture);
> __igt_fixture_end();
> } else {
> - exit(IGT_EXIT_SKIP);
> + igt_exitcode = IGT_EXIT_SKIP;
> + igt_exit();
> }
> }
>
> @@ -786,7 +787,7 @@ void igt_fail(int exitcode)
> __igt_fixture_end();
> }
>
> - exit(exitcode);
> + igt_exit();
> }
> }
>
> @@ -857,7 +858,7 @@ void igt_exit(void)
> exit(IGT_EXIT_SUCCESS);
>
> if (!test_with_subtests)
> - exit(IGT_EXIT_SUCCESS);
> + exit(igt_exitcode);
>
> /* Calling this without calling one of the above is a failure */
> assert(skipped_one || succeeded_one || failed_one);
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index d74cbf9..974a2fb 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -188,7 +188,7 @@ void igt_simple_init_parse_opts(int argc, char **argv,
> int main(int argc, char **argv) { \
> igt_simple_init(argc, argv); \
> igt_tokencat(__real_main, __LINE__)(); \
> - exit(0); \
> + igt_exit(); \
> } \
> static void igt_tokencat(__real_main, __LINE__)(void) \
>
> diff --git a/tests/igt_simulation.c b/tests/igt_simulation.c
> index 13b2da9..e588959 100644
> --- a/tests/igt_simulation.c
> +++ b/tests/igt_simulation.c
> @@ -65,7 +65,7 @@ static int do_fork(void)
>
> igt_skip_on_simulation();
>
> - exit(0);
> + igt_exit();
> } else {
> if (list_subtests)
> igt_subtest_init(2, argv_list);
> --
> 2.0.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-09-29 13:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 9:27 [PATCH 0/2] Disable Android low memory killer tim.gore
2014-09-26 9:27 ` [PATCH 1/2] lib/igt_core: make single/simple tests use igt_exit tim.gore
2014-09-29 13:15 ` Daniel Vetter [this message]
2014-09-26 9:27 ` [PATCH 2/2] lib/igt_core.c: disable lowmemorykiller during tests tim.gore
2014-09-26 9:49 ` [PATCH 0/2] Disable Android low memory killer Chris Wilson
2014-09-26 10:08 ` Gore, Tim
2014-09-26 10:20 ` Chris Wilson
2014-09-26 10:29 ` Chris Wilson
2014-09-26 10:46 ` Gore, Tim
2014-09-26 11:14 ` Chris Wilson
2014-09-29 13:19 ` Daniel Vetter
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=20140929131515.GN4109@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=tim.gore@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