public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Matus Marhefka <mmarhefk@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] containers: added mountns/mountns05.c
Date: Thu, 30 Oct 2014 17:01:14 +0100	[thread overview]
Message-ID: <20141030160114.GA18064@rei.suse.de> (raw)
In-Reply-To: <1414681678-28439-1-git-send-email-mmarhefk@redhat.com>

Hi!
I do not like these macros.

> +#define REPORT_PARENT_ERROR(errmsg) \
> +{ \
> +	msgctl(id, IPC_RMID, NULL); \

	^
	This should be removed from the test cleanup.

	If you want to call the default cleanup defined in the header
	you can define second cleanup function that does specific
	cleanup and then calls the generic cleanup pass the right
	function pointers to tst_brmk()

> +	tst_brkm(TBROK | TERRNO, cleanup, errmsg); \
> +}
> +
> +#define REPORT_CHLD_ERROR(errmsg) \
> +{ \
> +	perror(errmsg); umount(DIRA); \
> +	msgctl(id, IPC_RMID, NULL); \
> +	wait(&status); return ERRC; \
> +}

Can't we do the cleanup the kenel style?

i.e.

	if (something_failed()) {
		errmsg = "message";
		goto err;
	}

	...

	return result;
err:
	perror(errmsg);
	umout(DIRA);
	msgclt(id, IPC_RMID, NULL);
	wait(&status);
	return ERRC;


...

> diff --git a/testcases/kernel/containers/mountns/mountns_helper.h b/testcases/kernel/containers/mountns/mountns_helper.h
> index d4a6a91..d82c837 100644
> --- a/testcases/kernel/containers/mountns/mountns_helper.h
> +++ b/testcases/kernel/containers/mountns/mountns_helper.h
> @@ -47,6 +47,10 @@ static int check_newns(void)
>  
>  static void cleanup(void)
>  {
> +	int status;
> +
> +	wait(&status);
> +	umount(DIRA);
>  	umount(DIRA);
>  	umount(DIRB);
>  	tst_rmdir();

This changes function called from several testcases, I guess that this
is missing cleanup being added there. Maybe it should deserve to be
pushed as a separate patch with description in commit message.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2014-10-30 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 15:07 [LTP] [PATCH] containers: added mountns/mountns05.c Matus Marhefka
2014-10-30 16:01 ` Cyril Hrubis [this message]
2014-11-05 16:49 ` [LTP] [PATCH v2] " Matus Marhefka
2014-12-02 16:42   ` Cyril Hrubis
     [not found]     ` <1962544618.7994595.1417604885928.JavaMail.zimbra@redhat.com>
2014-12-17 14:10       ` Cyril Hrubis
     [not found]         ` <5495D100.8000107@redhat.com>
2015-01-05 12:38           ` Cyril Hrubis
     [not found]         ` <939621071.8375320.1423670135099.JavaMail.zimbra@redhat.com>
2015-02-12 15:04           ` Cyril Hrubis

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=20141030160114.GA18064@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=mmarhefk@redhat.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