Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW

This test is time sensitive. It may fail on virtual machines and for
debug builds.

Continue to run in these environments to get code coverage. But
optionally suppress failure for timing errors (only). This is
controlled with environment variable KSFT_MACHINE_SLOW.

The test continues to return 0 (KSFT_PASS), rather than KSFT_XFAIL
as previously discussed. Because making so_txtime.c return that and
then making so_txtime.sh capture runs that pass that vs KSFT_FAIL
and pass it on added a bunch of (fragile bash) boilerplate, while the
result is interpreted the same as KSFT_PASS anyway.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240201162130.2278240-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Willem de Bruijn and committed by
Paolo Abeni
c41dfb0d 8ff25dac

+5 -2
+5 -2
tools/testing/selftests/net/so_txtime.c
··· 134 134 if (rbuf[0] != ts->data) 135 135 error(1, 0, "payload mismatch. expected %c", ts->data); 136 136 137 - if (llabs(tstop - texpect) > cfg_variance_us) 138 - error(1, 0, "exceeds variance (%d us)", cfg_variance_us); 137 + if (llabs(tstop - texpect) > cfg_variance_us) { 138 + fprintf(stderr, "exceeds variance (%d us)\n", cfg_variance_us); 139 + if (!getenv("KSFT_MACHINE_SLOW")) 140 + exit(1); 141 + } 139 142 } 140 143 141 144 static void do_recv_verify_empty(int fdr)