Since this test tries 0-32 values as 'advice', it needs to expect the
little-known ABI hack used for fadvise64 on s390 in the kernel,
see Linux kernel commit 068e1b94bbd268f375349f68531829c8b7c210bc.

Signed-off-by: Jiri Jaburek <jjabu...@redhat.com>
---
 testcases/kernel/syscalls/fadvise/posix_fadvise03.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise03.c 
b/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
index db88765..1e77740 100644
--- a/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
+++ b/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
@@ -65,9 +65,25 @@ int defined_advise[] = {
        POSIX_FADV_NORMAL,
        POSIX_FADV_SEQUENTIAL,
        POSIX_FADV_RANDOM,
-       POSIX_FADV_NOREUSE,
        POSIX_FADV_WILLNEED,
+#if defined(__s390__) && __WORDSIZE == 32
+       /* POSIX_FADV_DONTNEED and POSIX_FADV_NOREUSE are 6,7 on 31bit s390,
+        * but the kernel accepts 4,5 as well and rewrites them internally,
+        * see Linux kernel commit 068e1b94bbd268f375349f68531829c8b7c210bc
+        *
+        * since header definitions are incomplete - posix fcntl.h doesn't care
+        * and defines them as 4,5 while linux/fadvise.h (which uses 6,7)
+        * matches only 64bit - we need to hardcode the values here for
+        * all 4 cases, unfortunately
+        */
+       4, /* POSIX_FADV_DONTNEED */
+       5, /* POSIX_FADV_NOREUSE */
+       6, /* POSIX_FADV_DONTNEED */
+       7, /* POSIX_FADV_NOREUSE */
+#else
        POSIX_FADV_DONTNEED,
+       POSIX_FADV_NOREUSE,
+#endif
 };
 
 #define defined_advise_total (sizeof(defined_advise) / 
sizeof(defined_advise[0]))
-- 
2.1.0


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to