82 lines
2.4 KiB
Diff
82 lines
2.4 KiB
Diff
From 28030d2b51951be018d063b49e19972b45c81daf Mon Sep 17 00:00:00 2001
|
|
From: "Dmitry V. Levin" <ldv@altlinux.org>
|
|
Date: Mon, 11 Feb 2019 21:00:05 +0000
|
|
Subject: [PATCH 228/293] tests: robustify preadv2-pwritev2 test against odd
|
|
kernels
|
|
|
|
The test used to assume that either both preadv2 and pwritev2 syscalls
|
|
are implemented or both are not implemented, but, apparently, there are
|
|
kernels in the wild that implement just preadv2 syscall without
|
|
pwritev2.
|
|
|
|
* tests/preadv2-pwritev2.c (main): Skip the dumpio part of the test
|
|
if either preadv2 or pwritev2 syscall is not implemented.
|
|
|
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1668750
|
|
---
|
|
tests/preadv2-pwritev2.c | 31 ++++++++++++++++++++++++-------
|
|
1 file changed, 24 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/tests/preadv2-pwritev2.c b/tests/preadv2-pwritev2.c
|
|
index f0e6987..1dfd674 100644
|
|
--- a/tests/preadv2-pwritev2.c
|
|
+++ b/tests/preadv2-pwritev2.c
|
|
@@ -186,7 +186,7 @@ main(void)
|
|
const unsigned long long pos = 0x7ac5fed6dad7bef8;
|
|
const kernel_ulong_t pos_l = (kernel_ulong_t) pos;
|
|
long rc;
|
|
- int test_dumpio;
|
|
+ bool skip_dumpio_test = false;
|
|
|
|
tprintf("%s", "");
|
|
|
|
@@ -203,9 +203,17 @@ main(void)
|
|
(kernel_ulong_t) (pos >> 32);
|
|
rc = syscall(__NR_preadv2, -1, NULL, vlen, pos_l, pos_h, 1);
|
|
#endif
|
|
- if (rc != -1 || (ENOSYS != errno && EBADF != errno))
|
|
- perror_msg_and_fail("preadv2");
|
|
- test_dumpio = EBADF == errno;
|
|
+ if (rc != -1)
|
|
+ error_msg_and_fail("preadv2: expected -1, returned %ld", rc);
|
|
+ switch (errno) {
|
|
+ case ENOSYS:
|
|
+ skip_dumpio_test = true;
|
|
+ break;
|
|
+ case EBADF:
|
|
+ break;
|
|
+ default:
|
|
+ perror_msg_and_fail("preadv2");
|
|
+ }
|
|
tprintf("preadv2(-1, NULL, %lu, %lld, RWF_HIPRI) = %s\n",
|
|
(unsigned long) vlen, pos, sprintrc(rc));
|
|
|
|
@@ -218,12 +226,21 @@ main(void)
|
|
#else
|
|
rc = syscall(__NR_pwritev2, -1, NULL, vlen, pos_l, pos_h, 1);
|
|
#endif
|
|
- if (rc != -1 || (ENOSYS != errno && EBADF != errno))
|
|
- perror_msg_and_fail("pwritev2");
|
|
+ if (rc != -1)
|
|
+ error_msg_and_fail("pwritev2: expected -1, returned %ld", rc);
|
|
+ switch (errno) {
|
|
+ case ENOSYS:
|
|
+ skip_dumpio_test = true;
|
|
+ break;
|
|
+ case EBADF:
|
|
+ break;
|
|
+ default:
|
|
+ perror_msg_and_fail("pwritev2");
|
|
+ }
|
|
tprintf("pwritev2(-1, NULL, %lu, %lld, RWF_HIPRI) = %s\n",
|
|
(unsigned long) vlen, pos, sprintrc(rc));
|
|
|
|
- if (test_dumpio)
|
|
+ if (!skip_dumpio_test)
|
|
dumpio();
|
|
|
|
tprintf("%s\n", "+++ exited with 0 +++");
|
|
--
|
|
1.7.12.4
|
|
|