net:icmp.sh in ubuntu_kernel_selftests failed on J-kvm due to leftover ns1

Bug #2007377 reported by Po-Hsu Lin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-kernel-tests
New
Undecided
Roxana Nicolescu

Bug Description

Issue found on J-kvm 5.15.0-1029.34

Test failed because of the leftover /run/netns/ns1 from another test

Running 'make run_tests -C net TEST_PROGS=icmp.sh TEST_GEN_PROGS='' TEST_CUSTOM_PROGS='''
 make: Entering directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux/tools/testing/selftests/net'
 make --no-builtin-rules ARCH=x86 -C ../../../.. headers_install
 make[1]: Entering directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux'
   INSTALL ./usr/include
 make[1]: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux'
 TAP version 13
 1..1
 # selftests: net: icmp.sh
 # Cannot create namespace file "/run/netns/ns1": File exists
 # FAIL - got ICMP response from , should be 192.0.0.8
 not ok 1 selftests: net: icmp.sh # exit=1
 make: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux/tools/testing/selftests/net'

It looks like this came from the fib_tests.sh
Which seems to be updated in this cycle, the test output is different.

In 5.15.0-1029.34
$ sudo ./fib_tests.sh
Single path route test
    Start point
    TEST: IPv4 fibmatch [ OK ]
    TEST: IPv6 fibmatch [ OK ]
    Nexthop device deleted
    TEST: IPv4 fibmatch - no route [ OK ]
    TEST: IPv6 fibmatch - no route [ OK ]

Multipath route test
Error: Multipath support not enabled in kernel.

In 5.15.0-1028.33
 Running 'make run_tests -C net TEST_PROGS=fib_tests.sh TEST_GEN_PROGS='' TEST_CUSTOM_PROGS='''
 make: Entering directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux/tools/testing/selftests/net'
 make --no-builtin-rules ARCH=x86 -C ../../../.. headers_install
 make[1]: Entering directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux'
   INSTALL ./usr/include
 make[1]: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux'
 TAP version 13
 1..1
 # selftests: net: fib_tests.sh
 #
 # Single path route test
 # Error: Unknown device type.
 not ok 1 selftests: net: fib_tests.sh # exit=2
 make: Leaving directory '/home/ubuntu/autotest/client/tmp/ubuntu_kernel_selftests/src/linux/tools/testing/selftests/net'

This icmp.sh test is OK if you run it manually. Thus I won't call it a regression.

Changed in ubuntu-kernel-tests:
assignee: nobody → Roxana Nicolescu (roxanan)
Revision history for this message
Roxana Nicolescu (roxanan) wrote :

Your observations are correct. Thanks for pointing me to the right direction.
fib_test.sh fails at Multipath route test when command
ip -netns ns1 route add 203.0.113.0/24 nexthop via 198.51.100.2 dev dummy0 nexthop via 192.0.2.2 dev dummy1 is executed. This fails because CONFIG_IP_ROUTE_MULTIPATH is not enabled for kvm. Not sure if this is intentional or not, I will have to double check.

Right before, in fib_test.sh they use set -e which will cause an exit if one of the commands fails.
Because nobody calls cleanup function where namespace ns1 is deleted when the next test tries to create this namespace it will fail.

Regardless of the actual root cause of why multipath is not enabled, even if that test fails, the test should always cleanup before exit.

I suggest removing set -e and checking the return code of each command everywhere. The problem though is that this is used in multiple places, so I am not sure why this was chosen in the first place.

I am curious to see other opinions on this.

Revision history for this message
Roxana Nicolescu (roxanan) wrote :

Actually, the easiest would be to just add
trap cleanup EXIT

I see other tests have this already.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Yeah a trap will be more aligning to other tests.
Upstream kernel will need this as well.

Revision history for this message
Roxana Nicolescu (roxanan) wrote :

Yup, will do so.

Revision history for this message
Roxana Nicolescu (roxanan) wrote :
Revision history for this message
Roxana Nicolescu (roxanan) wrote :

Fix is tracked here https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2015956.
I will mark this as duplicate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.