Commit a007f53b authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

arm/test: fix printing formats in tests

Fixes:

cow01.c: In function 'parent_check':
../lib/zdtmtst.h:120:11: error: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
  test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", \
           ^
cow01.c:287:5: note: in expansion of macro 'fail'
     fail("%s[%#x]: %p is not COW-ed (pagemap of "
     ^~~~
In file included from inotify_system.c:14:0:
inotify_system.c: In function 'read_set':
../lib/zdtmtst.h:117:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Werror=form
at=]
  test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
           ^
inotify_system.c:299:3: note: in expansion of macro 'pr_perror'
   pr_perror("read(%d, buf, %lu) Failed, errno=%d",
   ^~~~~~~~~
deleted_dev.c:53:36: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type '__dev_t {aka long long unsigned
 int}' [-Werror=format=]
   test_msg("mode %x want %x, dev %lx want %lx\n",
                                    ^
deleted_dev.c:53:45: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'dev_t {aka long long unsigned i
nt}' [-Werror=format=]
   test_msg("mode %x want %x, dev %lx want %lx\n",
                                             ^
../lib/zdtmtst.h:117:11: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'off64_t {aka long long int
' [-Werror=format=]
  test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", \
           ^

Nothing really interesting, but printings with right format specifier.
Signed-off-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 0ca79b6d
...@@ -188,9 +188,10 @@ static int check_fd(struct autofs_params *p) ...@@ -188,9 +188,10 @@ static int check_fd(struct autofs_params *p)
} }
if (st.st_dev != p->fd_stat.st_dev) { if (st.st_dev != p->fd_stat.st_dev) {
skip("%s: st_dev differs: %lu != %lu " skip("%s: st_dev differs: %llu != %llu "
"(waiting for \"device namespaces\")", p->mountpoint, "(waiting for \"device namespaces\")", p->mountpoint,
st.st_dev, p->fd_stat.st_dev); (long long unsigned)st.st_dev,
(long long unsigned)p->fd_stat.st_dev);
// ret++; // ret++;
} }
if (st.st_mode != p->fd_stat.st_mode) { if (st.st_mode != p->fd_stat.st_mode) {
...@@ -200,7 +201,7 @@ static int check_fd(struct autofs_params *p) ...@@ -200,7 +201,7 @@ static int check_fd(struct autofs_params *p)
} }
if (st.st_nlink != p->fd_stat.st_nlink) { if (st.st_nlink != p->fd_stat.st_nlink) {
pr_err("%s: st_nlink differs: %ld != %ld\n", p->mountpoint, pr_err("%s: st_nlink differs: %ld != %ld\n", p->mountpoint,
st.st_nlink, p->fd_stat.st_nlink); (long)st.st_nlink, (long)p->fd_stat.st_nlink);
ret++; ret++;
} }
if (st.st_uid != p->fd_stat.st_uid) { if (st.st_uid != p->fd_stat.st_uid) {
...@@ -214,8 +215,9 @@ static int check_fd(struct autofs_params *p) ...@@ -214,8 +215,9 @@ static int check_fd(struct autofs_params *p)
ret++; ret++;
} }
if (st.st_rdev != p->fd_stat.st_rdev) { if (st.st_rdev != p->fd_stat.st_rdev) {
pr_err("%s: st_rdev differs: %ld != %ld\n", p->mountpoint, pr_err("%s: st_rdev differs: %lld != %lld\n", p->mountpoint,
st.st_rdev, p->fd_stat.st_rdev); (long long)st.st_rdev,
(long long)p->fd_stat.st_rdev);
ret++; ret++;
} }
if (st.st_size != p->fd_stat.st_size) { if (st.st_size != p->fd_stat.st_size) {
...@@ -484,7 +486,7 @@ static int automountd_loop(int pipe, const char *mountpoint, struct autofs_param ...@@ -484,7 +486,7 @@ static int automountd_loop(int pipe, const char *mountpoint, struct autofs_param
return -EINVAL; return -EINVAL;
} }
if (bytes != sizeof(*packet)) { if (bytes != sizeof(*packet)) {
pr_err("read less than expected: %ld\n", bytes); pr_err("read less than expected: %zd\n", bytes);
return -EINVAL; return -EINVAL;
} }
err = automountd_serve(mountpoint, param, packet); err = automountd_serve(mountpoint, param, packet);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <linux/limits.h> #include <linux/limits.h>
#include <sys/user.h> #include <sys/user.h>
...@@ -285,7 +286,7 @@ static int parent_check(struct test_cases *test_cases, int fd) ...@@ -285,7 +286,7 @@ static int parent_check(struct test_cases *test_cases, int fd)
if (is_cow_ret == 1) { if (is_cow_ret == 1) {
errno = 0; errno = 0;
fail("%s[%#x]: %p is not COW-ed (pagemap of " fail("%s[%#x]: %p is not COW-ed (pagemap of "
"child=[%#08lx], parent=[%#08lx])", "child=[%"PRIx64"], parent=[%"PRIx64"])",
test_cases->tname, i, addr + i * PAGE_SIZE, test_cases->tname, i, addr + i * PAGE_SIZE,
map_child, map_parent); map_child, map_parent);
} }
......
...@@ -50,8 +50,10 @@ int main(int argc, char **argv) ...@@ -50,8 +50,10 @@ int main(int argc, char **argv)
if (st.st_mode != mode || st.st_rdev != dev) { if (st.st_mode != mode || st.st_rdev != dev) {
fail("%s is no longer the device file we had", filename); fail("%s is no longer the device file we had", filename);
test_msg("mode %x want %x, dev %lx want %lx\n", test_msg("mode %x want %x, dev %llx want %llx\n",
st.st_mode, mode, st.st_rdev, dev); st.st_mode, mode,
(long long unsigned)st.st_rdev,
(long long unsigned)dev);
goto out; goto out;
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <inttypes.h>
#include "zdtmtst.h" #include "zdtmtst.h"
...@@ -65,7 +66,7 @@ int main(int argc, char *argv[]) ...@@ -65,7 +66,7 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
test_msg("created eventfd with %lx\n", v); test_msg("created eventfd with %"PRIu64"\n", v);
ret = write(efd, &v, sizeof(v)); ret = write(efd, &v, sizeof(v));
if (ret != sizeof(v)) { if (ret != sizeof(v)) {
......
...@@ -297,7 +297,7 @@ int read_set(int inot_fd, char *event_set) { ...@@ -297,7 +297,7 @@ int read_set(int inot_fd, char *event_set) {
int len; int len;
if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) { if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) {
pr_perror("read(%d, buf, %lu) Failed, errno=%d", pr_perror("read(%d, buf, %lu) Failed, errno=%d",
inot_fd, EVENT_BUF_LEN, errno); inot_fd, (unsigned long)EVENT_BUF_LEN, errno);
return -1; return -1;
} }
return len; return len;
......
...@@ -296,7 +296,8 @@ next_event: ...@@ -296,7 +296,8 @@ next_event:
int read_set(int inot_fd, char *event_set) { int read_set(int inot_fd, char *event_set) {
int len; int len;
if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) { if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) {
pr_perror("read(%d, buf, %lu) Failed", inot_fd, EVENT_BUF_LEN); pr_perror("read(%d, buf, %lu) Failed",
inot_fd, (unsigned long)EVENT_BUF_LEN);
return -1; return -1;
} }
return len; return len;
......
...@@ -118,7 +118,8 @@ int ns_child(void *_arg) ...@@ -118,7 +118,8 @@ int ns_child(void *_arg)
#else #else
if (st1.st_nlink != 0) { if (st1.st_nlink != 0) {
#endif #endif
pr_perror("Wrong number of links: %lu", st1.st_nlink); pr_perror("Wrong number of links: %lu",
(long unsigned)st1.st_nlink);
exit(1); exit(1);
} }
......
...@@ -28,7 +28,8 @@ int main(int argc, char ** argv) ...@@ -28,7 +28,8 @@ int main(int argc, char ** argv)
} }
if (lseek64(fd, offset, SEEK_SET) < 0) { if (lseek64(fd, offset, SEEK_SET) < 0) {
pr_perror("can't lseek %s, offset= %lx", filename, offset); pr_perror("can't lseek %s, offset= %llx", filename,
(long long unsigned)offset);
goto failed; goto failed;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment