| 335 | } |
| 336 | |
| 337 | static int check_tee(struct io_uring *ring, struct test_ctx *ctx) |
| 338 | { |
| 339 | int ret; |
| 340 | |
| 341 | ret = write_buf(ctx->real_pipe1[1], ctx->buf_in, BUF_SIZE); |
| 342 | if (ret) |
| 343 | return ret; |
| 344 | ret = do_tee(ring, ctx->pipe1[0], ctx->pipe2[1], BUF_SIZE); |
| 345 | if (ret) |
| 346 | return ret; |
| 347 | |
| 348 | ret = check_content(ctx->real_pipe1[0], ctx->buf_out, BUF_SIZE, |
| 349 | ctx->buf_in); |
| 350 | if (ret) { |
| 351 | fprintf(stderr, "tee(), invalid src data\n"); |
| 352 | return ret; |
| 353 | } |
| 354 | |
| 355 | ret = check_content(ctx->real_pipe2[0], ctx->buf_out, BUF_SIZE, |
| 356 | ctx->buf_in); |
| 357 | if (ret) { |
| 358 | fprintf(stderr, "tee(), invalid dst data\n"); |
| 359 | return ret; |
| 360 | } |
| 361 | |
| 362 | return 0; |
| 363 | } |
| 364 | |
| 365 | static int check_zero_tee(struct io_uring *ring, struct test_ctx *ctx) |
| 366 | { |