This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [testsuite] asan/clone-test-1.c: Handle clone() failure
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Christophe Lyon <christophe dot lyon at linaro dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 4 Jul 2016 18:11:25 +0200
- Subject: Re: [testsuite] asan/clone-test-1.c: Handle clone() failure
- Authentication-results: sourceware.org; auth=none
- References: <CAKdteObPuyiLYoCgXU8uqE8kaaww4-Vg-JLL+vTHPcs7GMfD7Q@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jul 04, 2016 at 05:44:17PM +0200, Christophe Lyon wrote:
> Hello,
>
> This small patch handles the case were clone() would fail when
> executing asan/clone-test-1.c.
I wonder if the syscall failures shouldn't result in exit of 0 rather than 1
(ideally UNSUPPORTED), because they don't mean the test failed in what it
was testing.
But as the other spots in the test already return 1;, I guess this is fine.
> 2016-07-04 Christophe Lyon <christophe.lyon@linaro.org>
>
> * c-c++-common/asan/clone-test-1.c (main): Handle clone() failure.
> diff --git a/gcc/testsuite/c-c++-common/asan/clone-test-1.c b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> index eeca09f..c58c376 100644
> --- a/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> +++ b/gcc/testsuite/c-c++-common/asan/clone-test-1.c
> @@ -29,6 +29,10 @@ int main(int argc, char **argv) {
> char *sp = child_stack + kStackSize; /* Stack grows down. */
> printf("Parent: %p\n", sp);
> pid_t clone_pid = clone(Child, sp, CLONE_FILES | CLONE_VM, NULL, 0, 0, 0);
> + if (clone_pid == -1) {
> + perror("clone");
> + return 1;
> + }
> int status;
> pid_t wait_result = waitpid(clone_pid, &status, __WCLONE);
> if (wait_result < 0) {
Jakub