summaryrefslogtreecommitdiffstats
path: root/contrib/libs/liburing/test/nop-flags.c
blob: a09ea6d5964842192e26168b55e2dcd800e09959 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
#include "../config-host.h"
/* SPDX-License-Identifier: MIT */
/*
 * Description: test NOP flags (IORING_NOP_FILE, IORING_NOP_FIXED_FILE,
 *		IORING_NOP_FIXED_BUFFER, IORING_NOP_TW, IORING_NOP_CQE32)
 *
 * These flags allow NOP to exercise file lookups, buffer lookups, and
 * task_work completion paths without real I/O, useful for targeted testing.
 */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>

#include "liburing.h"
#include "helpers.h"

#ifndef IORING_NOP_INJECT_RESULT
#define IORING_NOP_INJECT_RESULT	(1U << 0)
#endif
#ifndef IORING_NOP_FILE
#define IORING_NOP_FILE			(1U << 1)
#endif
#ifndef IORING_NOP_FIXED_FILE
#define IORING_NOP_FIXED_FILE		(1U << 2)
#endif
#ifndef IORING_NOP_FIXED_BUFFER
#define IORING_NOP_FIXED_BUFFER		(1U << 3)
#endif
#ifndef IORING_NOP_TW
#define IORING_NOP_TW			(1U << 4)
#endif
#ifndef IORING_NOP_CQE32
#define IORING_NOP_CQE32		(1U << 5)
#endif

static int no_nop_flags;
static int no_nop_file;

/*
 * Detect NOP flags support using INJECT_RESULT. A kernel that supports
 * NOP flags will return the injected value; one that doesn't will
 * return 0 (plain NOP) or -EINVAL.
 */
static int test_nop_detect(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret;

	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_INJECT_RESULT;
	sqe->len = 42;
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit detect: %d\n", ret);
		return T_EXIT_FAIL;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait detect: %d\n", ret);
		return T_EXIT_FAIL;
	}

	if (cqe->res != 42) {
		/* Kernel doesn't support NOP flags */
		no_nop_flags = 1;
		io_uring_cqe_seen(ring, cqe);
		return T_EXIT_SKIP;
	}

	io_uring_cqe_seen(ring, cqe);
	return T_EXIT_PASS;
}

/*
 * Detect IORING_NOP_FILE support by using it with a bad fd.
 * If supported, returns -EBADF. If not, returns 0 (NOP succeeds,
 * kernel ignores the FILE flag).
 */
static int test_nop_file_bad_fd(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FILE;
	sqe->fd = 9999; /* invalid fd */
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		return T_EXIT_FAIL;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		return T_EXIT_FAIL;
	}

	if (cqe->res == 0) {
		/* Kernel doesn't support IORING_NOP_FILE */
		no_nop_file = 1;
		io_uring_cqe_seen(ring, cqe);
		return T_EXIT_SKIP;
	}

	if (cqe->res != -EBADF && cqe->res != -EINVAL) {
		fprintf(stderr, "nop bad fd res: %d (expected -EBADF)\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		return T_EXIT_FAIL;
	}

	io_uring_cqe_seen(ring, cqe);
	return T_EXIT_PASS;
}

/*
 * Test IORING_NOP_FILE - NOP with a normal fd lookup
 */
static int test_nop_file(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret, fd;

	if (no_nop_flags || no_nop_file)
		return T_EXIT_SKIP;

	fd = open("/dev/null", O_RDWR);
	if (fd < 0) {
		perror("open /dev/null");
		return T_EXIT_FAIL;
	}

	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FILE;
	sqe->fd = fd;
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		close(fd);
		return T_EXIT_FAIL;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		close(fd);
		return T_EXIT_FAIL;
	}

	if (cqe->res != 0) {
		if (cqe->res == -EINVAL) {
			no_nop_file = 1;
			return T_EXIT_SKIP;
		}
		fprintf(stderr, "nop file res: %d\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		close(fd);
		return T_EXIT_FAIL;
	}

	io_uring_cqe_seen(ring, cqe);
	close(fd);
	return T_EXIT_PASS;
}

/*
 * Test IORING_NOP_FIXED_FILE - NOP with a fixed file lookup
 */
static int test_nop_fixed_file(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret, fd;

	if (no_nop_flags || no_nop_file)
		return T_EXIT_SKIP;

	fd = open("/dev/null", O_RDWR);
	if (fd < 0) {
		perror("open /dev/null");
		return T_EXIT_FAIL;
	}

	ret = io_uring_register_files(ring, &fd, 1);
	if (ret) {
		fprintf(stderr, "register files: %d\n", ret);
		close(fd);
		return T_EXIT_FAIL;
	}

	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FILE | IORING_NOP_FIXED_FILE;
	sqe->fd = 0; /* fixed file index */
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		goto err;
	}

	if (cqe->res != 0) {
		fprintf(stderr, "nop fixed file res: %d\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		goto err;
	}

	io_uring_cqe_seen(ring, cqe);

	/* Test with invalid fixed file index */
	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FILE | IORING_NOP_FIXED_FILE;
	sqe->fd = 999; /* invalid index */
	sqe->user_data = 2;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit bad index: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait bad index: %d\n", ret);
		goto err;
	}

	if (cqe->res != -EBADF) {
		fprintf(stderr, "nop bad fixed file res: %d (expected -EBADF)\n",
			cqe->res);
		io_uring_cqe_seen(ring, cqe);
		goto err;
	}

	io_uring_cqe_seen(ring, cqe);
	io_uring_unregister_files(ring);
	close(fd);
	return T_EXIT_PASS;
err:
	io_uring_unregister_files(ring);
	close(fd);
	return T_EXIT_FAIL;
}

/*
 * Test IORING_NOP_FIXED_BUFFER - NOP with a registered buffer lookup
 */
static int test_nop_fixed_buffer(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	char buf[4096];
	struct iovec iov = { .iov_base = buf, .iov_len = sizeof(buf) };
	int ret;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	ret = io_uring_register_buffers(ring, &iov, 1);
	if (ret) {
		fprintf(stderr, "register buffers: %d\n", ret);
		return T_EXIT_FAIL;
	}

	/* Valid buffer index */
	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FIXED_BUFFER;
	sqe->buf_index = 0;
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		goto err;
	}

	if (cqe->res != 0) {
		if (cqe->res == -EINVAL) {
			io_uring_cqe_seen(ring, cqe);
			return T_EXIT_SKIP;
		}
		fprintf(stderr, "nop fixed buffer res: %d\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		goto err;
	}
	io_uring_cqe_seen(ring, cqe);

	/* Invalid buffer index */
	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FIXED_BUFFER;
	sqe->buf_index = 999;
	sqe->user_data = 2;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit bad buf: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait bad buf: %d\n", ret);
		goto err;
	}

	if (cqe->res == 0) {
		/* Kernel doesn't support IORING_NOP_FIXED_BUFFER */
		io_uring_cqe_seen(ring, cqe);
		io_uring_unregister_buffers(ring);
		return T_EXIT_SKIP;
	}
	if (cqe->res != -EFAULT) {
		fprintf(stderr, "nop bad buffer res: %d (expected -EFAULT)\n",
			cqe->res);
		io_uring_cqe_seen(ring, cqe);
		goto err;
	}

	io_uring_cqe_seen(ring, cqe);
	io_uring_unregister_buffers(ring);
	return T_EXIT_PASS;
err:
	io_uring_unregister_buffers(ring);
	return T_EXIT_FAIL;
}

/*
 * Test IORING_NOP_TW - NOP completing via task_work
 */
static int test_nop_tw(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret, i;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	/* Submit several NOPs via task_work path */
	for (i = 0; i < 8; i++) {
		sqe = io_uring_get_sqe(ring);
		io_uring_prep_nop(sqe);
		sqe->nop_flags = IORING_NOP_TW;
		sqe->user_data = i + 1;
	}

	ret = io_uring_submit(ring);
	if (ret != 8) {
		fprintf(stderr, "submit tw: %d\n", ret);
		return T_EXIT_FAIL;
	}

	for (i = 0; i < 8; i++) {
		ret = io_uring_wait_cqe(ring, &cqe);
		if (ret) {
			fprintf(stderr, "wait tw: %d\n", ret);
			return T_EXIT_FAIL;
		}
		if (cqe->res != 0) {
			if (cqe->res == -EINVAL) {
				io_uring_cqe_seen(ring, cqe);
				return T_EXIT_SKIP;
			}
			fprintf(stderr, "nop tw res: %d\n", cqe->res);
			io_uring_cqe_seen(ring, cqe);
			return T_EXIT_FAIL;
		}
		io_uring_cqe_seen(ring, cqe);
	}

	return T_EXIT_PASS;
}

/*
 * Test IORING_NOP_TW combined with IORING_NOP_INJECT_RESULT
 */
static int test_nop_tw_inject(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	int ret;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_TW | IORING_NOP_INJECT_RESULT;
	sqe->len = 42;
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		return T_EXIT_FAIL;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		return T_EXIT_FAIL;
	}

	if (cqe->res != 42) {
		if (cqe->res == -EINVAL) {
			io_uring_cqe_seen(ring, cqe);
			return T_EXIT_SKIP;
		}
		fprintf(stderr, "nop tw inject res: %d (expected 42)\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		return T_EXIT_FAIL;
	}

	io_uring_cqe_seen(ring, cqe);
	return T_EXIT_PASS;
}

/*
 * Test IORING_NOP_CQE32 - NOP with extra1/extra2 in big CQE
 */
static int test_nop_cqe32(void)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	struct io_uring ring;
	int ret;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	ret = io_uring_queue_init(8, &ring, IORING_SETUP_CQE32);
	if (ret) {
		if (ret == -EINVAL)
			return T_EXIT_SKIP;
		fprintf(stderr, "ring setup cqe32: %d\n", ret);
		return T_EXIT_FAIL;
	}

	sqe = io_uring_get_sqe(&ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_CQE32;
	sqe->off = 0xdeadbeef12345678ULL; /* extra1 */
	sqe->addr = 0xabcdef0011223344ULL; /* extra2 */
	sqe->user_data = 1;

	ret = io_uring_submit(&ring);
	if (ret != 1) {
		fprintf(stderr, "submit cqe32: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(&ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait cqe32: %d\n", ret);
		goto err;
	}

	if (cqe->res != 0) {
		if (cqe->res == -EINVAL)
			goto skip;
		fprintf(stderr, "nop cqe32 res: %d\n", cqe->res);
		io_uring_cqe_seen(&ring, cqe);
		goto err;
	}

	if (cqe->big_cqe[0] != 0xdeadbeef12345678ULL) {
		fprintf(stderr, "cqe32 extra1: 0x%llx (expected 0xdeadbeef12345678)\n",
			(unsigned long long) cqe->big_cqe[0]);
		io_uring_cqe_seen(&ring, cqe);
		goto err;
	}

	if (cqe->big_cqe[1] != 0xabcdef0011223344ULL) {
		fprintf(stderr, "cqe32 extra2: 0x%llx (expected 0xabcdef0011223344)\n",
			(unsigned long long) cqe->big_cqe[1]);
		io_uring_cqe_seen(&ring, cqe);
		goto err;
	}

	io_uring_cqe_seen(&ring, cqe);
	io_uring_queue_exit(&ring);
	return T_EXIT_PASS;
err:
	io_uring_queue_exit(&ring);
	return T_EXIT_FAIL;
skip:
	io_uring_queue_exit(&ring);
	return T_EXIT_SKIP;
}

/*
 * Test IORING_NOP_CQE32 requires CQE32 or CQE_MIXED ring
 */
static int test_nop_cqe32_no_ring_support(void)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	struct io_uring ring;
	int ret;

	if (no_nop_flags)
		return T_EXIT_SKIP;

	/* Ring without CQE32 */
	ret = io_uring_queue_init(8, &ring, 0);
	if (ret) {
		fprintf(stderr, "ring setup: %d\n", ret);
		return T_EXIT_FAIL;
	}

	sqe = io_uring_get_sqe(&ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_CQE32;
	sqe->off = 1;
	sqe->addr = 2;
	sqe->user_data = 1;

	ret = io_uring_submit(&ring);
	if (ret != 1) {
		fprintf(stderr, "submit: %d\n", ret);
		io_uring_queue_exit(&ring);
		return T_EXIT_FAIL;
	}

	ret = io_uring_wait_cqe(&ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait: %d\n", ret);
		io_uring_queue_exit(&ring);
		return T_EXIT_FAIL;
	}

	if (cqe->res != -EINVAL) {
		fprintf(stderr, "nop cqe32 no support res: %d (expected -EINVAL)\n",
			cqe->res);
		io_uring_cqe_seen(&ring, cqe);
		io_uring_queue_exit(&ring);
		return T_EXIT_FAIL;
	}

	io_uring_cqe_seen(&ring, cqe);
	io_uring_queue_exit(&ring);
	return T_EXIT_PASS;
}

/*
 * Test combined flags: FILE + FIXED_FILE + FIXED_BUFFER + TW
 */
static int test_nop_combined(struct io_uring *ring)
{
	struct io_uring_sqe *sqe;
	struct io_uring_cqe *cqe;
	char buf[4096];
	struct iovec iov = { .iov_base = buf, .iov_len = sizeof(buf) };
	int ret, fd;

	if (no_nop_flags || no_nop_file)
		return T_EXIT_SKIP;

	fd = open("/dev/null", O_RDWR);
	if (fd < 0) {
		perror("open /dev/null");
		return T_EXIT_FAIL;
	}

	ret = io_uring_register_files(ring, &fd, 1);
	if (ret) {
		fprintf(stderr, "register files: %d\n", ret);
		close(fd);
		return T_EXIT_FAIL;
	}

	ret = io_uring_register_buffers(ring, &iov, 1);
	if (ret) {
		fprintf(stderr, "register buffers: %d\n", ret);
		io_uring_unregister_files(ring);
		close(fd);
		return T_EXIT_FAIL;
	}

	/* All flags combined */
	sqe = io_uring_get_sqe(ring);
	io_uring_prep_nop(sqe);
	sqe->nop_flags = IORING_NOP_FILE | IORING_NOP_FIXED_FILE |
			 IORING_NOP_FIXED_BUFFER | IORING_NOP_TW;
	sqe->fd = 0;
	sqe->buf_index = 0;
	sqe->user_data = 1;

	ret = io_uring_submit(ring);
	if (ret != 1) {
		fprintf(stderr, "submit combined: %d\n", ret);
		goto err;
	}

	ret = io_uring_wait_cqe(ring, &cqe);
	if (ret) {
		fprintf(stderr, "wait combined: %d\n", ret);
		goto err;
	}

	if (cqe->res != 0) {
		fprintf(stderr, "nop combined res: %d\n", cqe->res);
		io_uring_cqe_seen(ring, cqe);
		goto err;
	}

	io_uring_cqe_seen(ring, cqe);
	io_uring_unregister_buffers(ring);
	io_uring_unregister_files(ring);
	close(fd);
	return T_EXIT_PASS;
err:
	io_uring_unregister_buffers(ring);
	io_uring_unregister_files(ring);
	close(fd);
	return T_EXIT_FAIL;
}

int main(int argc, char *argv[])
{
	struct io_uring ring;
	int ret;

	if (argc > 1)
		return T_EXIT_SKIP;

	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SUBMIT_ALL);
	if (ret) {
		if (ret == -EINVAL)
			return T_EXIT_SKIP;
		fprintf(stderr, "ring setup failed: %d\n", ret);
		return T_EXIT_FAIL;
	}

	ret = test_nop_detect(&ring);
	if (ret == T_EXIT_SKIP) {
		printf("NOP flags not supported, skipping\n");
		io_uring_queue_exit(&ring);
		return T_EXIT_SKIP;
	} else if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_detect failed\n");
		return T_EXIT_FAIL;
	}

	/* Use bad fd test to detect NOP_FILE support */
	ret = test_nop_file_bad_fd(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_file_bad_fd failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_file(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_file failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_fixed_file(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_fixed_file failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_fixed_buffer(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_fixed_buffer failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_tw(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_tw failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_tw_inject(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_tw_inject failed\n");
		return T_EXIT_FAIL;
	}

	io_uring_queue_exit(&ring);

	ret = test_nop_cqe32();
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_cqe32 failed\n");
		return T_EXIT_FAIL;
	}

	ret = test_nop_cqe32_no_ring_support();
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_cqe32_no_ring_support failed\n");
		return T_EXIT_FAIL;
	}

	/* New ring for combined test since we need fresh file/buffer tables */
	ret = io_uring_queue_init(8, &ring, 0);
	if (ret) {
		fprintf(stderr, "ring setup failed: %d\n", ret);
		return T_EXIT_FAIL;
	}

	ret = test_nop_combined(&ring);
	if (ret == T_EXIT_FAIL) {
		fprintf(stderr, "test_nop_combined failed\n");
		return T_EXIT_FAIL;
	}

	io_uring_queue_exit(&ring);
	return T_EXIT_PASS;
}