Skip to content

Commit a0fd024

Browse files
author
Sabrina Dubroca
committed
selftests: tls: make the new data_steal test less flaky
JIRA: https://issues.redhat.com/browse/RHEL-115640 commit 715c7a3 Author: Jakub Kicinski <kuba@kernel.org> Date: Thu Aug 14 12:43:23 2025 -0700 selftests: tls: make the new data_steal test less flaky The CI has hit a couple of cases of: RUN global.data_steal ... tls.c:2762:data_steal:Expected recv(cfd, buf2, sizeof(buf2), MSG_DONTWAIT) (20000) == -1 (-1) data_steal: Test terminated by timeout FAIL global.data_steal Looks like the 2msec sleep is not long enough. Make the sleep longer, and then instead of second sleep wait for the thieving process to exit. That way we can be sure it called recv() before us. While at it also avoid trying to steal more than a record, this seems to be causing issues in manual testing as well. Fixes: d7e8259 ("selftests: tls: test TCP stealing data from under the TLS socket") Link: https://patch.msgid.link/20250814194323.2014650-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sabrina Dubroca <sdubroca@redhat.com>
1 parent 89270f3 commit a0fd024

File tree

1 file changed

+5
-7
lines changed
  • tools/testing/selftests/net

1 file changed

+5
-7
lines changed

tools/testing/selftests/net/tls.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,27 +2526,25 @@ TEST(data_steal) {
25262526
pid = fork();
25272527
ASSERT_GE(pid, 0);
25282528
if (!pid) {
2529-
EXPECT_EQ(recv(cfd, buf, sizeof(buf), MSG_WAITALL),
2530-
sizeof(buf));
2529+
EXPECT_EQ(recv(cfd, buf, sizeof(buf) / 2, MSG_WAITALL),
2530+
sizeof(buf) / 2);
25312531
exit(!__test_passed(_metadata));
25322532
}
25332533

2534-
usleep(2000);
2534+
usleep(10000);
25352535
ASSERT_EQ(setsockopt(fd, SOL_TLS, TLS_TX, &tls, tls.len), 0);
25362536
ASSERT_EQ(setsockopt(cfd, SOL_TLS, TLS_RX, &tls, tls.len), 0);
25372537

25382538
EXPECT_EQ(send(fd, buf, sizeof(buf), 0), sizeof(buf));
2539-
usleep(2000);
2539+
EXPECT_EQ(wait(&status), pid);
2540+
EXPECT_EQ(status, 0);
25402541
EXPECT_EQ(recv(cfd, buf2, sizeof(buf2), MSG_DONTWAIT), -1);
25412542
/* Don't check errno, the error will be different depending
25422543
* on what random bytes TLS interpreted as the record length.
25432544
*/
25442545

25452546
close(fd);
25462547
close(cfd);
2547-
2548-
EXPECT_EQ(wait(&status), pid);
2549-
EXPECT_EQ(status, 0);
25502548
}
25512549

25522550
static void __attribute__((constructor)) fips_check(void) {

0 commit comments

Comments
 (0)