From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: Re: [PATCH 17/18] tests: Correct determination of host interface name in tests
Date: Tue, 19 Jul 2022 16:20:45 +1000 [thread overview]
Message-ID: <YtZNPZcskrY+P+Cv@yekko> (raw)
In-Reply-To: <20220715052141.890703-18-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]
On Fri, Jul 15, 2022 at 03:21:40PM +1000, David Gibson wrote:
> By default, passt itself attaches to the first host interface with a
> default route. However, when determining the host interface name the tests
> implicitly select the *last* host interface: they use a jq expression which
> will list all interfaces with default routes, but the way output detection
> works in the scripts, it will only pick up the last line.
>
> If there are multiple interfaces with default routes on the host, and they
> each have a different address, this can cause spurious test
> failures.
It seems this change is not enough to always fix the tests when there
are multiple default routes. I'm still sometimes getting failures,
now because passt itself doesn't seem to be picking the interface
with the first default route.
I'm wondering if this is because ip(8) is sorting the output, not just
presenting it in the same order that the underlying netlink interface
does.
> Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> ---
> test/dhcp/passt | 2 +-
> test/two_guests/basic | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/dhcp/passt b/test/dhcp/passt
> index 3d2e939..f45227a 100644
> --- a/test/dhcp/passt
> +++ b/test/dhcp/passt
> @@ -16,7 +16,7 @@ htools ip jq sed tr head
>
> test Interface name
> gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
> -hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
> +hout HOST_IFNAME ip -j -4 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]'
> check [ -n "__IFNAME__" ]
>
> test DHCP: address
> diff --git a/test/two_guests/basic b/test/two_guests/basic
> index cf0b975..f7c016d 100644
> --- a/test/two_guests/basic
> +++ b/test/two_guests/basic
> @@ -18,7 +18,7 @@ htools ip jq md5sum cut
> test Interface names
> g1out IFNAME1 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
> g2out IFNAME2 ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
> -hout HOST_IFNAME ip -j -4 route show|jq -rM '.[] | select(.dst == "default").dev'
> +hout HOST_IFNAME ip -j -4 route show|jq -rM '[.[] | select(.dst == "default").dev] | .[0]'
> check [ -n "__IFNAME1__" ]
> check [ -n "__IFNAME2__" ]
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-07-19 6:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 5:21 [PATCH 00/18] Test fixes, batch 5 David Gibson
2022-07-15 5:21 ` [PATCH 01/18] tests: Remove no longer needed /usr/bin/bash link David Gibson
2022-07-15 5:21 ` [PATCH 02/18] tests: Let Fedora find dhclient-script in /usr/sbin David Gibson
2022-07-15 5:21 ` [PATCH 03/18] tests: Add rudimentary debugging to dhclient-script David Gibson
2022-07-15 5:21 ` [PATCH 04/18] tests: Add some extra dhclient support directories to mbuto.img David Gibson
2022-07-15 5:21 ` [PATCH 05/18] tests: More robust parsing of resolv.conf for DHCP tests David Gibson
2022-07-15 5:21 ` [PATCH 06/18] tests: Handle the case of a nameserver on host localhost David Gibson
2022-07-15 5:21 ` [PATCH 07/18] tests: Correctly handle domain search list in dhclient-script David Gibson
2022-07-15 5:21 ` [PATCH 08/18] tests: Fix detection of empty 'hout' responses in passt{,_in_ns} tests David Gibson
2022-07-15 5:21 ` [PATCH 09/18] tests: Fix creation of test file in udp passt tests David Gibson
2022-07-15 5:21 ` [PATCH 10/18] valgrind needs futex David Gibson
2022-07-15 5:21 ` [PATCH 11/18] tests: Use socat instead of netcat David Gibson
2022-07-15 5:21 ` [PATCH 12/18] tests: Remove unnecessary ^D in passt_in_ns teardown David Gibson
2022-07-15 5:21 ` [PATCH 13/18] tests: Remove unnecessary truncation of temporary files in udp tests David Gibson
2022-07-15 5:21 ` [PATCH 14/18] tests: Use dhclient --no-pid for namespaces in two_guests tests David Gibson
2022-07-15 5:21 ` [PATCH 15/18] tests: Clean up better after iperf tests David Gibson
2022-07-15 5:21 ` [PATCH 16/18] tests: No need to retrieve host ifname in ndp/pasta David Gibson
2022-07-15 5:21 ` [PATCH 17/18] tests: Correct determination of host interface name in tests David Gibson
2022-07-19 6:20 ` David Gibson [this message]
2022-07-19 19:05 ` Stefano Brivio
2022-07-20 2:47 ` David Gibson
2022-07-20 7:24 ` David Gibson
2022-07-20 8:23 ` Stefano Brivio
2022-07-20 10:33 ` David Gibson
2022-07-15 5:21 ` [PATCH 18/18] demo: Use git protocol downloads David Gibson
2022-07-21 12:13 ` [PATCH 00/18] Test fixes, batch 5 Stefano Brivio
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=YtZNPZcskrY+P+Cv@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).