* tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test
@ 2017-09-22 10:17 Orson Zhai
2017-09-23 1:20 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Orson Zhai @ 2017-09-22 10:17 UTC (permalink / raw)
To: Shuah Khan
Cc: David S . Miller, milosz.wasilewski, sumit.semwal, netdev,
linux-kselftest, Orson Zhai
The TPACKET_V3 test of PACKET_TX_RING will fail with kernel version
lower than v4.11. Supported code of tx ring was add with commit id
<7f953ab2ba46: af_packet: TX_RING support for TPACKET_V3> at Jan. 3
of 2017.
So skip this item test instead of reporting failing for old kernels.
Signed-off-by: Orson Zhai <orson.zhai@linaro.org>
---
tools/testing/selftests/net/psock_tpacket.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/psock_tpacket.c b/tools/testing/selftests/net/psock_tpacket.c
index 7f6cd9fdacf3..f0cfc18c3726 100644
--- a/tools/testing/selftests/net/psock_tpacket.c
+++ b/tools/testing/selftests/net/psock_tpacket.c
@@ -57,6 +57,7 @@
#include <net/if.h>
#include <inttypes.h>
#include <poll.h>
+#include <errno.h>
#include "psock_lib.h"
@@ -676,7 +677,7 @@ static void __v3_fill(struct ring *ring, unsigned int blocks, int type)
ring->flen = ring->req3.tp_block_size;
}
-static void setup_ring(int sock, struct ring *ring, int version, int type)
+static int setup_ring(int sock, struct ring *ring, int version, int type)
{
int ret = 0;
unsigned int blocks = 256;
@@ -703,7 +704,11 @@ static void setup_ring(int sock, struct ring *ring, int version, int type)
if (ret == -1) {
perror("setsockopt");
- exit(1);
+ if (errno == EINVAL) {
+ printf("[SKIP] This type seems un-supported in current kernel, skipped.\n");
+ return -1;
+ } else
+ exit(1);
}
ring->rd_len = ring->rd_num * sizeof(*ring->rd);
@@ -715,6 +720,7 @@ static void setup_ring(int sock, struct ring *ring, int version, int type)
total_packets = 0;
total_bytes = 0;
+ return 0;
}
static void mmap_ring(int sock, struct ring *ring)
@@ -830,7 +836,12 @@ static int test_tpacket(int version, int type)
sock = pfsocket(version);
memset(&ring, 0, sizeof(ring));
- setup_ring(sock, &ring, version, type);
+ if(setup_ring(sock, &ring, version, type)) {
+ /* skip test when error of invalid argument */
+ close(sock);
+ return 0;
+ }
+
mmap_ring(sock, &ring);
bind_ring(sock, &ring);
walk_ring(sock, &ring);
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test
2017-09-22 10:17 tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test Orson Zhai
@ 2017-09-23 1:20 ` David Miller
2017-09-23 11:27 ` Fathi Boudra
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2017-09-23 1:20 UTC (permalink / raw)
To: orson.zhai
Cc: shuah, milosz.wasilewski, sumit.semwal, netdev, linux-kselftest
From: Orson Zhai <orson.zhai@linaro.org>
Date: Fri, 22 Sep 2017 18:17:17 +0800
> The TPACKET_V3 test of PACKET_TX_RING will fail with kernel version
> lower than v4.11. Supported code of tx ring was add with commit id
> <7f953ab2ba46: af_packet: TX_RING support for TPACKET_V3> at Jan. 3
> of 2017.
>
> So skip this item test instead of reporting failing for old kernels.
>
> Signed-off-by: Orson Zhai <orson.zhai@linaro.org>
The whole point is to make sure the kernel in which the selftest
code is present functions properly.
There are many tests in selftests that only work on recent kernels.
I'm not applying this, sorry.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test
2017-09-23 1:20 ` David Miller
@ 2017-09-23 11:27 ` Fathi Boudra
2017-09-23 16:58 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Fathi Boudra @ 2017-09-23 11:27 UTC (permalink / raw)
To: David Miller
Cc: orson.zhai, Shuah Khan, Milosz Wasilewski,
sumit.semwal@linaro.org, netdev, linux-kselftest
On 23 September 2017 at 04:20, David Miller <davem@davemloft.net> wrote:
> From: Orson Zhai <orson.zhai@linaro.org>
> Date: Fri, 22 Sep 2017 18:17:17 +0800
>
>> The TPACKET_V3 test of PACKET_TX_RING will fail with kernel version
>> lower than v4.11. Supported code of tx ring was add with commit id
>> <7f953ab2ba46: af_packet: TX_RING support for TPACKET_V3> at Jan. 3
>> of 2017.
>>
>> So skip this item test instead of reporting failing for old kernels.
>>
>> Signed-off-by: Orson Zhai <orson.zhai@linaro.org>
>
> The whole point is to make sure the kernel in which the selftest
> code is present functions properly.
>
> There are many tests in selftests that only work on recent kernels.
For the background, a similar discussion happened on this thread:
https://lkml.org/lkml/2017/6/22/802
There's cases where we'd like to run latest selftests on stable kernels.
You're right, there are many tests in selftests that only work on
recent kernels and we intend to fix it.
Skipping gracefully a test because the feature is missing on the
kernel under test is preferred to fail.
> I'm not applying this, sorry.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test
2017-09-23 11:27 ` Fathi Boudra
@ 2017-09-23 16:58 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-09-23 16:58 UTC (permalink / raw)
To: fathi.boudra
Cc: orson.zhai, shuah, milosz.wasilewski, sumit.semwal, netdev,
linux-kselftest
From: Fathi Boudra <fathi.boudra@linaro.org>
Date: Sat, 23 Sep 2017 14:27:15 +0300
> On 23 September 2017 at 04:20, David Miller <davem@davemloft.net> wrote:
>> From: Orson Zhai <orson.zhai@linaro.org>
>> Date: Fri, 22 Sep 2017 18:17:17 +0800
>>
>>> The TPACKET_V3 test of PACKET_TX_RING will fail with kernel version
>>> lower than v4.11. Supported code of tx ring was add with commit id
>>> <7f953ab2ba46: af_packet: TX_RING support for TPACKET_V3> at Jan. 3
>>> of 2017.
>>>
>>> So skip this item test instead of reporting failing for old kernels.
>>>
>>> Signed-off-by: Orson Zhai <orson.zhai@linaro.org>
>>
>> The whole point is to make sure the kernel in which the selftest
>> code is present functions properly.
>>
>> There are many tests in selftests that only work on recent kernels.
>
> For the background, a similar discussion happened on this thread:
> https://lkml.org/lkml/2017/6/22/802
>
> There's cases where we'd like to run latest selftests on stable kernels.
> You're right, there are many tests in selftests that only work on
> recent kernels and we intend to fix it.
> Skipping gracefully a test because the feature is missing on the
> kernel under test is preferred to fail.
This approach is extremely ill advised.
It is hard enough to get developers to add new tests in the first
place.
Having the extra burdon of needing to make the test work on older
kernels is going to discourage test writing even more.
If you want to "backport" tests, handle them the same way -stable
backports are done. With extreme care and making sure they get
backported to the kernel they actually would work on.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-23 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22 10:17 tools: selftests: psock_tpacket: skip un-supported tpacket_v3 test Orson Zhai
2017-09-23 1:20 ` David Miller
2017-09-23 11:27 ` Fathi Boudra
2017-09-23 16:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox