All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] testcases: netns: Check TUN support enabled
Date: Thu, 4 Oct 2018 14:59:52 +0200	[thread overview]
Message-ID: <20181004125952.GA32169@dell5510> (raw)
In-Reply-To: <20180802141251.1571-1-mylene.josserand@bootlin.com>

Hi Mylène,

> In case TUN support is not enabled, the test will fail while
> performing the "ip" command with following error:
>    open: No such file or directory
>    netns_netlink    1  TBROK  :  netns_netlink.c:143: system() failed

> As the system() call is not setting errno, we are not able to know
> if the error is produced by a mis-configuration or not.

> Because of that, this commit adds a check during the setup function to see
> if the device "/dev/net/tun" is available or not. It is the file
> that "ip tuntap add mode tap" command is looking for (and fails with
> the "open" error).

> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/kernel/containers/netns/netns_netlink.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

> diff --git a/testcases/kernel/containers/netns/netns_netlink.c b/testcases/kernel/containers/netns/netns_netlink.c
> index 47e8235d6..077ec5dab 100644
> --- a/testcases/kernel/containers/netns/netns_netlink.c
> +++ b/testcases/kernel/containers/netns/netns_netlink.c
> @@ -57,6 +57,15 @@ static void cleanup(void)

>  static void setup(void)
>  {
> +	/* Check that the TUN support is available */
> +	int netfd = open("/dev/net/tun", O_RDWR);
> +	if (netfd == -1) {
> +		if (errno == ENODEV || errno == ENOENT)
> +			tst_brkm(TCONF, NULL, "TUN support is missing?");
> +
> +		tst_brkm(TBROK | TERRNO, NULL, "opening /dev/net/tun failed");
> +	}

Can you please implement your patch via .needs_drivers (recently contributed by
Alexey Kodanev)?


Kind regards,
Petr

      parent reply	other threads:[~2018-10-04 12:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 14:12 [LTP] [PATCH 1/2] testcases: netns: Check TUN support enabled =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-08-02 14:12 ` [LTP] [PATCH 2/2] testcases: netns: Handle "Operation not supported" error =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-08-08 11:16   ` Alexey Kodanev
2018-08-08 13:05     ` Cyril Hrubis
2018-08-08 13:31       ` Thomas Petazzoni
2018-08-08 14:06         ` Cyril Hrubis
2018-08-08 13:53       ` Alexey Kodanev
2018-08-08 14:08         ` Cyril Hrubis
2018-10-04 13:06   ` Petr Vorel
2018-10-08  9:28     ` =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-10-08 10:15       ` Petr Vorel
2018-10-04 12:59 ` Petr Vorel [this message]

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=20181004125952.GA32169@dell5510 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.