FIXTURE_SETUP(zero_len) returns early when ulp_sock_pair() reports
that the TCP_ULP setsockopt failed, so on a kernel built without
CONFIG_TLS the TLS_RX setsockopt never runs. TEST_F(zero_len, test)
then sends its raw records over a plain TCP socket, which hands the
ciphertext back verbatim: every one of the eight variants reports
FAIL on a machine that merely lacks TLS, and those failures mask any
real regression in the same run.

Skip the test when the fixture recorded notls, the convention the
other fixtures in this file already follow.

Fixes: a61a3e961baf ("selftests: tls: add tests for zero-length records")
Signed-off-by: Chuck Lever <[email protected]>
---
 tools/testing/selftests/net/tls.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/net/tls.c 
b/tools/testing/selftests/net/tls.c
index 089e940ac43d..af47d9a6098c 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -2544,6 +2544,9 @@ TEST_F(zero_len, test)
        int rec_off;
        int i;
 
+       if (self->notls)
+               SKIP(return, "no TLS support");
+
        for (i = 0; i < 4 && variant->recs[i]; i++)
                EXPECT_EQ(send(self->fd, variant->recs[i]->cipher_data,
                               variant->recs[i]->cipher_len, 0),

-- 
2.54.0


Reply via email to