unofficial mirror of bug-guix@gnu.org 
 help / color / Atom feed
* bug#42111: tests/syscalls.scm stumbles on network interface aliases
@ 2020-06-28 15:52 Marius Bakke
  2020-06-28 21:02 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Bakke @ 2020-06-28 15:52 UTC (permalink / raw)
  To: 42111


[-- Attachment #1.1: Type: text/plain, Size: 559 bytes --]

Hello,

The "network-interface-names" test from tests/syscalls.scm fails if a
network interface alias is configured.

I.e. this command:

  ip addr add 127.0.0.2/8 dev lo label lo:lcat

causes the interface to show up in (network-interface-names), but not
(all-network-interface-names), breaking the test.

I could not find a procfs file that displays network aliases, so ISTM
we either need to add syscalls to check IFLA_IFALIAS, or simply ignore
interfaces with a colon (which seems to be required).

This patch does the latter and makes the test succeed:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: diff --]
[-- Type: text/x-patch, Size: 555 bytes --]

diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 6acaa0b131..7aa16ce3f4 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -382,7 +382,10 @@
      (member "lo" names))))
 
 (test-assert "network-interface-names"
-  (match (network-interface-names)
+  (match (filter (lambda (if)
+                   ;; Ignore interface aliases.
+                   (not (string-contains if ":")))
+                 (network-interface-names))
     (((? string? names) ..1)
      (lset<= string=? names (all-network-interface-names)))))
 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#42111: tests/syscalls.scm stumbles on network interface aliases
  2020-06-28 15:52 bug#42111: tests/syscalls.scm stumbles on network interface aliases Marius Bakke
@ 2020-06-28 21:02 ` Ludovic Courtès
  2020-06-28 21:37   ` Marius Bakke
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2020-06-28 21:02 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 42111

Hi!

Marius Bakke <marius@gnu.org> skribis:

> The "network-interface-names" test from tests/syscalls.scm fails if a
> network interface alias is configured.
>
> I.e. this command:
>
>   ip addr add 127.0.0.2/8 dev lo label lo:lcat

Woow.  🐈

> diff --git a/tests/syscalls.scm b/tests/syscalls.scm
> index 6acaa0b131..7aa16ce3f4 100644
> --- a/tests/syscalls.scm
> +++ b/tests/syscalls.scm
> @@ -382,7 +382,10 @@
>       (member "lo" names))))
>  
>  (test-assert "network-interface-names"
> -  (match (network-interface-names)
> +  (match (filter (lambda (if)
> +                   ;; Ignore interface aliases.

Perhaps add “since they don’t show up in (all-network-interface-names)”.

> +                   (not (string-contains if ":")))
> +                 (network-interface-names))

You can use ‘remove’ instead of ‘filter’ + ‘not’.

Otherwise LGTM, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#42111: tests/syscalls.scm stumbles on network interface aliases
  2020-06-28 21:02 ` Ludovic Courtès
@ 2020-06-28 21:37   ` Marius Bakke
  0 siblings, 0 replies; 3+ messages in thread
From: Marius Bakke @ 2020-06-28 21:37 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 42111-done

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

>> diff --git a/tests/syscalls.scm b/tests/syscalls.scm
>> index 6acaa0b131..7aa16ce3f4 100644
>> --- a/tests/syscalls.scm
>> +++ b/tests/syscalls.scm
>> @@ -382,7 +382,10 @@
>>       (member "lo" names))))
>>  
>>  (test-assert "network-interface-names"
>> -  (match (network-interface-names)
>> +  (match (filter (lambda (if)
>> +                   ;; Ignore interface aliases.
>
> Perhaps add “since they don’t show up in (all-network-interface-names)”.
>
>> +                   (not (string-contains if ":")))
>> +                 (network-interface-names))
>
> You can use ‘remove’ instead of ‘filter’ + ‘not’.

ah, much clearer with those suggestions, thanks!

Pushed in 5e113cf4424b2746cbf3633cd2106c62b89e5b49.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 15:52 bug#42111: tests/syscalls.scm stumbles on network interface aliases Marius Bakke
2020-06-28 21:02 ` Ludovic Courtès
2020-06-28 21:37   ` Marius Bakke

unofficial mirror of bug-guix@gnu.org 

Archives are clonable:
	git clone --mirror https://yhetil.org/guix-bugs/0 guix-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-bugs guix-bugs/ https://yhetil.org/guix-bugs \
		bug-guix@gnu.org
	public-inbox-index guix-bugs

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.bugs
	nntp://news.gmane.io/gmane.comp.gnu.guix.bugs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git