mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Avoid excessive save/restore cycles in socket_ipv4_udp_unbound tests.
PiperOrigin-RevId: 338805321
This commit is contained in:
@@ -2435,6 +2435,7 @@ cc_library(
|
||||
"@com_google_absl//absl/memory",
|
||||
gtest,
|
||||
"//test/util:posix_error",
|
||||
"//test/util:save_util",
|
||||
"//test/util:test_util",
|
||||
],
|
||||
alwayslink = 1,
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "test/syscalls/linux/ip_socket_test_util.h"
|
||||
#include "test/syscalls/linux/socket_test_util.h"
|
||||
#include "test/util/posix_error.h"
|
||||
#include "test/util/save_util.h"
|
||||
#include "test/util/test_util.h"
|
||||
|
||||
namespace gvisor {
|
||||
@@ -2108,6 +2109,9 @@ TEST_P(IPv4UDPUnboundSocketTest, ReuseAddrReusePortDistribution) {
|
||||
|
||||
constexpr int kMessageSize = 10;
|
||||
|
||||
// Saving during each iteration of the following loop is too expensive.
|
||||
DisableSave ds;
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
// Send a new message to the REUSEADDR/REUSEPORT group. We use a new socket
|
||||
// each time so that a new ephemerial port will be used each time. This
|
||||
@@ -2120,6 +2124,8 @@ TEST_P(IPv4UDPUnboundSocketTest, ReuseAddrReusePortDistribution) {
|
||||
SyscallSucceedsWithValue(sizeof(send_buf)));
|
||||
}
|
||||
|
||||
ds.reset();
|
||||
|
||||
// Check that both receivers got messages. This checks that we are using load
|
||||
// balancing (REUSEPORT) instead of the most recently bound socket
|
||||
// (REUSEADDR).
|
||||
|
||||
Reference in New Issue
Block a user