aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorPranith Kumar <bobby.prani@gmail.com>2014-09-03 10:31:16 -0400
committerShuah Khan <shuahkh@osg.samsung.com>2014-09-04 12:59:03 -0400
commit57e67900d4c7949ad646a5f43a8ca5180170d2a0 (patch)
tree2f239d436f63d20963cc5f79ef6739ee6acabbd9 /tools/testing
parent69e273c0b0a3c337a521d083374c918dc52c666f (diff)
memfd_test: Make it work on 32-bit systems
This test currently fails on 32-bit systems since we use u64 type to pass the flags to fcntl. This commit changes this to use 'unsigned int' type for flags to fcntl making it work on 32-bit systems. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/memfd/memfd_test.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 3634c909b1b0..cb5001bfa5e3 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -59,9 +59,9 @@ static void mfd_fail_new(const char *name, unsigned int flags)
59 } 59 }
60} 60}
61 61
62static __u64 mfd_assert_get_seals(int fd) 62static unsigned int mfd_assert_get_seals(int fd)
63{ 63{
64 long r; 64 int r;
65 65
66 r = fcntl(fd, F_GET_SEALS); 66 r = fcntl(fd, F_GET_SEALS);
67 if (r < 0) { 67 if (r < 0) {
@@ -69,50 +69,48 @@ static __u64 mfd_assert_get_seals(int fd)
69 abort(); 69 abort();
70 } 70 }
71 71
72 return r; 72 return (unsigned int)r;
73} 73}
74 74
75static void mfd_assert_has_seals(int fd, __u64 seals) 75static void mfd_assert_has_seals(int fd, unsigned int seals)
76{ 76{
77 __u64 s; 77 unsigned int s;
78 78
79 s = mfd_assert_get_seals(fd); 79 s = mfd_assert_get_seals(fd);
80 if (s != seals) { 80 if (s != seals) {
81 printf("%llu != %llu = GET_SEALS(%d)\n", 81 printf("%u != %u = GET_SEALS(%d)\n", seals, s, fd);
82 (unsigned long long)seals, (unsigned long long)s, fd);
83 abort(); 82 abort();
84 } 83 }
85} 84}
86 85
87static void mfd_assert_add_seals(int fd, __u64 seals) 86static void mfd_assert_add_seals(int fd, unsigned int seals)
88{ 87{
89 long r; 88 int r;
90 __u64 s; 89 unsigned int s;
91 90
92 s = mfd_assert_get_seals(fd); 91 s = mfd_assert_get_seals(fd);
93 r = fcntl(fd, F_ADD_SEALS, seals); 92 r = fcntl(fd, F_ADD_SEALS, seals);
94 if (r < 0) { 93 if (r < 0) {
95 printf("ADD_SEALS(%d, %llu -> %llu) failed: %m\n", 94 printf("ADD_SEALS(%d, %u -> %u) failed: %m\n", fd, s, seals);
96 fd, (unsigned long long)s, (unsigned long long)seals);
97 abort(); 95 abort();
98 } 96 }
99} 97}
100 98
101static void mfd_fail_add_seals(int fd, __u64 seals) 99static void mfd_fail_add_seals(int fd, unsigned int seals)
102{ 100{
103 long r; 101 int r;
104 __u64 s; 102 unsigned int s;
105 103
106 r = fcntl(fd, F_GET_SEALS); 104 r = fcntl(fd, F_GET_SEALS);
107 if (r < 0) 105 if (r < 0)
108 s = 0; 106 s = 0;
109 else 107 else
110 s = r; 108 s = (unsigned int)r;
111 109
112 r = fcntl(fd, F_ADD_SEALS, seals); 110 r = fcntl(fd, F_ADD_SEALS, seals);
113 if (r >= 0) { 111 if (r >= 0) {
114 printf("ADD_SEALS(%d, %llu -> %llu) didn't fail as expected\n", 112 printf("ADD_SEALS(%d, %u -> %u) didn't fail as expected\n",
115 fd, (unsigned long long)s, (unsigned long long)seals); 113 fd, s, seals);
116 abort(); 114 abort();
117 } 115 }
118} 116}