2026-07-26, 20:33:34 -0400, Chuck Lever wrote:
> +static void zero_len_sock_pair(struct __test_metadata *_metadata,
> +                            int *fd, int *cfd, bool *notls)
> +{
> +     struct tls_crypto_info_keys tls12;
> +     int ret;
> +
> +     tls_crypto_info_init(TLS_1_2_VERSION, TLS_CIPHER_AES_CCM_128,
> +                          &tls12, 0);
> +
> +     ulp_sock_pair(_metadata, fd, cfd, notls);
> +     if (*notls)
> +             return;
> +
> +     /* fd stays keyless; these fixtures send raw records over it */
> +     ret = setsockopt(*cfd, SOL_TLS, TLS_RX, &tls12, tls12.len);
> +     ASSERT_EQ(ret, 0);
> +}
> +
> +/* Send a variant's records; return the last one carrying payload */
> +static const struct raw_rec *
> +zero_len_send_recs(struct __test_metadata *_metadata, int fd,
> +                const struct raw_rec *const *recs)
> +{
> +     const struct raw_rec *payload = NULL;
> +     int i;
> +
> +     for (i = 0; i < 4 && recs[i]; i++) {
> +             EXPECT_EQ(send(fd, recs[i]->cipher_data, recs[i]->cipher_len, 
> 0),
> +                       recs[i]->cipher_len);
> +             if (recs[i]->plain_len)
> +                     payload = recs[i];
> +     }
> +
> +     return payload;
> +}

nit: those are identical to the existing FIXTURE_SETUP(zero_len) and
the TX part of TEST_F(zero_len, test), so they should also be used
there.

Or since you're reusing similar variants (for both zero_len_peek and
zero_len_splice), maybe just add the new TEST_F chunks as subtests of
the existing zero_len FIXTURE? There's only partial overlap in the
current version, but there should be a set of {recv_ret, peek_ret,
splice_ret} that works for each.


-- 
Sabrina

Reply via email to