From 9f6611bb31a6a367859a92a360b46db5f9135602 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 21 Apr 2016 17:49:32 +0000 Subject: [PATCH] tests: use errno2name() Automatically change tests/*.c files using the following sed regexp: sed -i 's/errno == E[[:alnum:]]\+ ? "E[[:alnum:]]\+" : "E[[:alnum:]]\+"/errno2name()/g' --- tests/access.c | 4 ++-- tests/copy_file_range.c | 2 +- tests/creat.c | 2 +- tests/dup.c | 2 +- tests/dup2.c | 2 +- tests/dup3.c | 2 +- tests/epoll_create.c | 2 +- tests/epoll_ctl.c | 6 +++--- tests/epoll_wait.c | 2 +- tests/execveat.c | 16 ++++++++-------- tests/faccessat.c | 2 +- tests/fchdir.c | 2 +- tests/fdatasync.c | 2 +- tests/flock.c | 2 +- tests/fsync.c | 2 +- tests/linkat.c | 4 ++-- tests/membarrier.c | 2 +- tests/mkdir.c | 2 +- tests/mkdirat.c | 2 +- tests/mknod.c | 4 ++-- tests/mlock2.c | 2 +- tests/mlockall.c | 2 +- tests/preadv-pwritev.c | 6 +++--- tests/pwritev.c | 2 +- tests/readv.c | 6 +++--- tests/rename.c | 2 +- tests/renameat.c | 2 +- tests/sched_xetparam.c | 2 +- tests/sched_xetscheduler.c | 2 +- tests/setugid.c | 2 +- tests/shmxt.c | 2 +- tests/splice.c | 2 +- tests/symlinkat.c | 2 +- tests/sync_file_range.c | 2 +- tests/sync_file_range2.c | 2 +- tests/tee.c | 2 +- tests/unlinkat.c | 4 ++-- tests/userfaultfd.c | 2 +- tests/xetpriority.c | 2 +- 39 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/access.c b/tests/access.c index aeb3a791..402540b2 100644 --- a/tests/access.c +++ b/tests/access.c @@ -14,11 +14,11 @@ main(void) long rc = syscall(__NR_access, sample, F_OK); printf("access(\"%s\", F_OK) = %ld %s (%m)\n", - sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT"); + sample, rc, errno2name()); rc = syscall(__NR_access, sample, R_OK|W_OK|X_OK); printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n", - sample, rc, errno == ENOSYS ? "ENOSYS" : "ENOENT"); + sample, rc, errno2name()); return 0; } diff --git a/tests/copy_file_range.c b/tests/copy_file_range.c index e90bf6a1..9b304c07 100644 --- a/tests/copy_file_range.c +++ b/tests/copy_file_range.c @@ -53,7 +53,7 @@ main(void) len, flags) == -1); printf("copy_file_range(%d, [%lld], %d, [%lld], %zu, %u) = -1 %s (%m)\n", (int) fd_in, *off_in, (int) fd_out, *off_out, len, flags, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/creat.c b/tests/creat.c index d922dd7c..52d9d62d 100644 --- a/tests/creat.c +++ b/tests/creat.c @@ -16,7 +16,7 @@ main(void) int rc = syscall(__NR_creat, TMP_FILE, S_IRUSR); printf("creat(\"%s\", %#o) = %d %s (%m)\n", TMP_FILE, S_IRUSR, rc, - errno == ENOSYS ? "ENOSYS" : "ETXTBSY"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/dup.c b/tests/dup.c index 57945aae..6debeb49 100644 --- a/tests/dup.c +++ b/tests/dup.c @@ -10,7 +10,7 @@ main(void) int rc = dup(fd); printf("dup(%d) = %d %s (%m)\n", fd, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/dup2.c b/tests/dup2.c index 0705af69..734746fa 100644 --- a/tests/dup2.c +++ b/tests/dup2.c @@ -15,7 +15,7 @@ main(void) int rc = syscall(__NR_dup2, fd_old, fd_new); printf("dup2(%d, %d) = %d %s (%m)\n", (int) fd_old, (int) fd_new, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/dup3.c b/tests/dup3.c index b57f05a6..f2c6a31e 100644 --- a/tests/dup3.c +++ b/tests/dup3.c @@ -16,7 +16,7 @@ main(void) int rc = syscall(__NR_dup3, fd_old, fd_new, O_CLOEXEC); printf("dup3(%d, %d, O_CLOEXEC) = %d %s (%m)\n", (int) fd_old, (int) fd_new, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/epoll_create.c b/tests/epoll_create.c index 0b9e3a50..486b8213 100644 --- a/tests/epoll_create.c +++ b/tests/epoll_create.c @@ -12,7 +12,7 @@ main(void) { int rc = syscall(__NR_epoll_create, -1); printf("epoll_create(-1) = %d %s (%m)\n", - rc, errno == ENOSYS ? "ENOSYS" : "EINVAL"); + rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/epoll_ctl.c b/tests/epoll_ctl.c index 7237f0f7..b636a7d4 100644 --- a/tests/epoll_ctl.c +++ b/tests/epoll_ctl.c @@ -19,15 +19,15 @@ main(void) printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2, {EPOLLIN," " {u32=%u, u64=%" PRIu64 "}}) = %d %s (%m)\n", ev->data.u32, ev->data.u64, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); rc = syscall(__NR_epoll_ctl, -3, EPOLL_CTL_DEL, -4, ev); printf("epoll_ctl(-3, EPOLL_CTL_DEL, -4, %p) = %d %s (%m)\n", - ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF"); + ev, rc, errno2name()); rc = syscall(__NR_epoll_ctl, -1L, EPOLL_CTL_MOD, -16L, 0); printf("epoll_ctl(-1, EPOLL_CTL_MOD, -16, NULL) = %d %s (%m)\n", - rc, errno == ENOSYS ? "ENOSYS" : "EFAULT"); + rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/epoll_wait.c b/tests/epoll_wait.c index 98b431f0..be72fc70 100644 --- a/tests/epoll_wait.c +++ b/tests/epoll_wait.c @@ -15,7 +15,7 @@ main(void) int rc = syscall(__NR_epoll_wait, -1, ev, 1, -2); printf("epoll_wait(-1, %p, 1, -2) = %d %s (%m)\n", - ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF"); + ev, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/execveat.c b/tests/execveat.c index d4ead406..ec0dc768 100644 --- a/tests/execveat.c +++ b/tests/execveat.c @@ -74,7 +74,7 @@ main(void) #ifdef VERBOSE_EXECVEAT q_envp[0], q_envp[1], envp[2], envp[3], envp[4], #endif - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); tail_argv[ARRAY_SIZE(q_argv)] = NULL; tail_envp[ARRAY_SIZE(q_envp)] = NULL; @@ -91,7 +91,7 @@ main(void) #ifdef VERBOSE_EXECVEAT q_envp[0], q_envp[1], #endif - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); syscall(__NR_execveat, -100, FILENAME, tail_argv + 2, tail_envp + 1, 0x1100); printf("execveat(AT_FDCWD, \"%s\", [\"%s\"]" @@ -105,7 +105,7 @@ main(void) #ifdef VERBOSE_EXECVEAT q_envp[1], #endif - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); char **const empty = tail_alloc(sizeof(*empty)); char **const efault = empty + 1; @@ -119,7 +119,7 @@ main(void) ", [/* 0 vars */]" #endif ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", - Q_FILENAME, errno == ENOSYS ? "ENOSYS" : "ENOENT"); + Q_FILENAME, errno2name()); char str_a[] = "012345678901234567890123456789012"; char str_b[] = "_abcdefghijklmnopqrstuvwxyz()[]{}"; @@ -150,7 +150,7 @@ main(void) printf("], [/* %u vars */", DEFAULT_STRLEN + 1); #endif printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); syscall(__NR_execveat, -100, FILENAME, a + 1, b + 1, 0x1100); printf("execveat(AT_FDCWD, \"%s\", [\"%s\"", Q_FILENAME, a[1]); @@ -164,17 +164,17 @@ main(void) printf("], [/* %d vars */", DEFAULT_STRLEN); #endif printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); syscall(__NR_execveat, -100, FILENAME, NULL, efault, 0x1100); printf("execveat(AT_FDCWD, \"%s\", NULL, %p" ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", - Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT"); + Q_FILENAME, efault, errno2name()); syscall(__NR_execveat, -100, FILENAME, efault, NULL, 0x1100); printf("execveat(AT_FDCWD, \"%s\", %p, NULL" ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n", - Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT"); + Q_FILENAME, efault, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/faccessat.c b/tests/faccessat.c index 39c006a5..1a8da4f8 100644 --- a/tests/faccessat.c +++ b/tests/faccessat.c @@ -16,7 +16,7 @@ main(void) int rc = syscall(__NR_faccessat, fd, sample, F_OK); printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n", (int) fd, sample, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/fchdir.c b/tests/fchdir.c index c9153a20..40511173 100644 --- a/tests/fchdir.c +++ b/tests/fchdir.c @@ -14,7 +14,7 @@ main(void) long rc = syscall(__NR_fchdir, fd); printf("fchdir(%d) = %ld %s (%m)\n", - (int) fd, rc, errno == ENOSYS ? "ENOSYS" : "EBADF"); + (int) fd, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/fdatasync.c b/tests/fdatasync.c index 382f47da..1923b500 100644 --- a/tests/fdatasync.c +++ b/tests/fdatasync.c @@ -14,7 +14,7 @@ main(void) int rc = syscall(__NR_fdatasync, fd); printf("fdatasync(%d) = %d %s (%m)\n", (int) fd, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/flock.c b/tests/flock.c index cd25185c..feb6cae3 100644 --- a/tests/flock.c +++ b/tests/flock.c @@ -15,7 +15,7 @@ main(void) int rc = syscall(__NR_flock, fd, LOCK_SH); printf("flock(%d, LOCK_SH) = %d %s (%m)\n", (int) fd, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/fsync.c b/tests/fsync.c index 774420ee..3dcf101e 100644 --- a/tests/fsync.c +++ b/tests/fsync.c @@ -14,7 +14,7 @@ main(void) int rc = syscall(__NR_fsync, fd); printf("fsync(%d) = %d %s (%m)\n", (int) fd, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/linkat.c b/tests/linkat.c index 1577f0dd..e1dd2176 100644 --- a/tests/linkat.c +++ b/tests/linkat.c @@ -18,14 +18,14 @@ main(void) int rc = syscall(__NR_linkat, fd_old, sample_1, fd_new, sample_2, 0); printf("linkat(%d, \"%s\", %d, \"%s\", 0) = %d %s (%m)\n", (int) fd_old, sample_1, (int) fd_new, sample_2, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); rc = syscall(__NR_linkat, -100, sample_1, -100, sample_2, -1L); printf("linkat(%s, \"%s\", %s, \"%s\", %s) = %d %s (%m)\n", "AT_FDCWD", sample_1, "AT_FDCWD", sample_2, "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW" "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff", - rc, errno == ENOSYS ? "ENOSYS" : "EINVAL"); + rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/membarrier.c b/tests/membarrier.c index 6aa6c9e4..7364d0fd 100644 --- a/tests/membarrier.c +++ b/tests/membarrier.c @@ -40,7 +40,7 @@ main(void) { assert(syscall(__NR_membarrier, 3, 255) == -1); printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n", - errno == ENOSYS ? "ENOSYS" : "EINVAL"); + errno2name()); if (errno != ENOSYS) { /* the test needs to be updated? */ assert(syscall(__NR_membarrier, 0, 0) == 1); diff --git a/tests/mkdir.c b/tests/mkdir.c index 0a810c14..2ff44947 100644 --- a/tests/mkdir.c +++ b/tests/mkdir.c @@ -14,7 +14,7 @@ main(void) long rc = syscall(__NR_mkdir, sample, 0600); printf("mkdir(\"%s\", 0600) = %ld %s (%m)\n", - sample, rc, errno == ENOSYS ? "ENOSYS" : "EEXIST"); + sample, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/mkdirat.c b/tests/mkdirat.c index 03f85c2d..dd3a1661 100644 --- a/tests/mkdirat.c +++ b/tests/mkdirat.c @@ -16,7 +16,7 @@ main(void) int rc = syscall(__NR_mkdirat, fd, sample, 0600); printf("mkdirat(%d, \"%s\", 0600) = %d %s (%m)\n", (int) fd, sample, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/mknod.c b/tests/mknod.c index 48367fed..198e556b 100644 --- a/tests/mknod.c +++ b/tests/mknod.c @@ -23,14 +23,14 @@ main(void) int rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0); printf("mknod(\"%s\", S_IFREG|0600) = %d %s (%m)\n", TMP_FILE, rc, - errno == ENOSYS ? "ENOSYS" : "EEXIST"); + errno2name()); const unsigned long dev = (unsigned long) 0xdeadbeef00000000 | makedev(1, 7); rc = syscall(__NR_mknod, TMP_FILE, S_IFCHR | 0400, dev); printf("mknod(\"%s\", S_IFCHR|0400, makedev(1, 7)) = %d %s (%m)\n", TMP_FILE, rc, - errno == ENOSYS ? "ENOSYS" : "EEXIST"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/mlock2.c b/tests/mlock2.c index 4e850fdb..b8f4f487 100644 --- a/tests/mlock2.c +++ b/tests/mlock2.c @@ -40,7 +40,7 @@ main(void) { assert(syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) == -1); printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe)" - " = -1 %s (%m)\n", errno == ENOSYS ? "ENOSYS" : "EINVAL"); + " = -1 %s (%m)\n", errno2name()); puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/mlockall.c b/tests/mlockall.c index 97cfdcfc..2a27ce45 100644 --- a/tests/mlockall.c +++ b/tests/mlockall.c @@ -42,7 +42,7 @@ main(void) puts("mlockall(MCL_CURRENT) = 0"); } else { printf("mlockall(MCL_CURRENT) = -1 %s (%m)\n", - errno == ENOMEM ? "ENOMEM" : "EPERM"); + errno2name()); } puts("+++ exited with 0 +++"); diff --git a/tests/preadv-pwritev.c b/tests/preadv-pwritev.c index 8ceae350..9f4fb4c2 100644 --- a/tests/preadv-pwritev.c +++ b/tests/preadv-pwritev.c @@ -70,13 +70,13 @@ main(void) if (rc != -1) perror_msg_and_fail("pwritev: expected -1, returned %ld", rc); tprintf("pwritev(1, %p, 42, 0) = -1 %s (%m)\n", - efault, errno == EINVAL ? "EINVAL" : "EFAULT"); + efault, errno2name()); rc = preadv(0, efault, 42, 0); if (rc != -1) perror_msg_and_fail("preadv: expected -1, returned %ld", rc); tprintf("preadv(0, %p, 42, 0) = -1 %s (%m)\n", - efault, errno == EINVAL ? "EINVAL" : "EFAULT"); + efault, errno2name()); static const char r0_c[] = "01234567"; const char *r0_d = hexdump_strdup(r0_c); @@ -108,7 +108,7 @@ main(void) rc); tprintf("pwritev(1, [{\"%s\", %u}, %p], 2, 0) = -1 %s (%m)\n", w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_), - errno == EINVAL ? "EINVAL" : "EFAULT"); + errno2name()); const unsigned int w_len = LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c); diff --git a/tests/pwritev.c b/tests/pwritev.c index 0c8afcbd..b0ecfe64 100644 --- a/tests/pwritev.c +++ b/tests/pwritev.c @@ -118,7 +118,7 @@ main(void) print_iovec(iov + i, n, LEN - i); printf(", %u, %lld) = -1 %s (%m)\n", n, (long long) offset + LEN + i, - errno == EINVAL ? "EINVAL" : "EFAULT"); + errno2name()); } iov->iov_base = iov + LEN * 2; diff --git a/tests/readv.c b/tests/readv.c index a8af8729..08aea7af 100644 --- a/tests/readv.c +++ b/tests/readv.c @@ -62,11 +62,11 @@ main(void) assert(writev(1, efault, 42) == -1); tprintf("writev(1, %p, 42) = -1 %s (%m)\n", - efault, errno == EINVAL ? "EINVAL" : "EFAULT"); + efault, errno2name()); assert(readv(0, efault, 42) == -1); tprintf("readv(0, %p, 42) = -1 %s (%m)\n", - efault, errno == EINVAL ? "EINVAL" : "EFAULT"); + efault, errno2name()); static const char r0_c[] = "01234567"; const char *r0_d = hexdump_strdup(r0_c); @@ -93,7 +93,7 @@ main(void) assert(writev(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2) == -1); tprintf("writev(1, [{\"%s\", %u}, %p], 2) = -1 %s (%m)\n", w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_), - errno == EINVAL ? "EINVAL" : "EFAULT"); + errno2name()); const unsigned int w_len = LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c); diff --git a/tests/rename.c b/tests/rename.c index 2fb88d64..a4469fc4 100644 --- a/tests/rename.c +++ b/tests/rename.c @@ -16,7 +16,7 @@ main(void) int rc = syscall(__NR_rename, OLD_FILE, NEW_FILE); printf("rename(\"%s\", \"%s\") = %d %s (%m)\n", OLD_FILE, NEW_FILE, rc, - errno == ENOSYS ? "ENOSYS" : "ENOENT"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/renameat.c b/tests/renameat.c index f17e9b01..c7745b99 100644 --- a/tests/renameat.c +++ b/tests/renameat.c @@ -18,7 +18,7 @@ main(void) int rc = syscall(__NR_renameat, fd_old, OLD_FILE, fd_new, NEW_FILE); printf("renameat(%d, \"%s\", %d, \"%s\") = %d %s (%m)\n", (int) fd_old, OLD_FILE, (int) fd_new, NEW_FILE, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/sched_xetparam.c b/tests/sched_xetparam.c index d968a2c5..d075a35e 100644 --- a/tests/sched_xetparam.c +++ b/tests/sched_xetparam.c @@ -20,7 +20,7 @@ main(void) rc = syscall(__NR_sched_setparam, 0, param); printf("sched_setparam(0, [%d]) = %d %s (%m)\n", param->sched_priority, rc, - errno == EPERM ? "EPERM" : "EINVAL"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/sched_xetscheduler.c b/tests/sched_xetscheduler.c index dbf3c1f6..db638e68 100644 --- a/tests/sched_xetscheduler.c +++ b/tests/sched_xetscheduler.c @@ -51,7 +51,7 @@ main(void) rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, param); printf("sched_setscheduler(0, SCHED_FIFO, [%d]) = %d %s (%m)\n", param->sched_priority, rc, - errno == EPERM ? "EPERM" : "EINVAL"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/setugid.c b/tests/setugid.c index 0578f69b..46e6e995 100644 --- a/tests/setugid.c +++ b/tests/setugid.c @@ -88,7 +88,7 @@ main(void) errno = saved_errno; if (expected) printf(") = -1 %s (%m)\n", - errno == EPERM ? "EPERM" : "EINVAL"); + errno2name()); else printf(") = 0\n"); } diff --git a/tests/shmxt.c b/tests/shmxt.c index c6e1652f..9662b9da 100644 --- a/tests/shmxt.c +++ b/tests/shmxt.c @@ -29,7 +29,7 @@ main(void) shmat(id, NULL, SHM_REMAP); printf("%s(%d, NULL, SHM_REMAP) = -1 %s (%m)\n", - SHMAT, id, errno == ENOSYS ? "ENOSYS" : "EINVAL"); + SHMAT, id, errno2name()); void *shmaddr = shmat(id, NULL, SHM_RDONLY); if (shmaddr == (void *)(-1)) diff --git a/tests/splice.c b/tests/splice.c index ac24b2a7..81b5c9b9 100644 --- a/tests/splice.c +++ b/tests/splice.c @@ -54,7 +54,7 @@ main(void) printf("splice(%d, [%lld], %d, [%lld], %zu, %s) = -1 %s (%m)\n", (int) fd_in, *off_in, (int) fd_out, *off_out, len, "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT", - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/symlinkat.c b/tests/symlinkat.c index 37d055aa..aada5e50 100644 --- a/tests/symlinkat.c +++ b/tests/symlinkat.c @@ -16,7 +16,7 @@ main(void) long rc = syscall(__NR_symlinkat, oldpath, fd, newpath); printf("symlinkat(\"%s\", %d, \"%s\") = %ld %s (%m)\n", oldpath, (int) fd, newpath, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/sync_file_range.c b/tests/sync_file_range.c index 2c3848ca..4843a786 100644 --- a/tests/sync_file_range.c +++ b/tests/sync_file_range.c @@ -52,7 +52,7 @@ main(void) "sync_file_range", fd, (long long) offset, (long long) nbytes, - errno == ENOSYS ? "ENOSYS" : "EINVAL"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/sync_file_range2.c b/tests/sync_file_range2.c index aa38c27b..bc307a7a 100644 --- a/tests/sync_file_range2.c +++ b/tests/sync_file_range2.c @@ -52,7 +52,7 @@ main(void) "sync_file_range2", fd, (long long) offset, (long long) nbytes, - errno == ENOSYS ? "ENOSYS" : "EINVAL"); + errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/tee.c b/tests/tee.c index abdf3830..12493b5f 100644 --- a/tests/tee.c +++ b/tests/tee.c @@ -50,7 +50,7 @@ main(void) printf("tee(%d, %d, %zu, %s) = -1 %s (%m)\n", (int) fd_in, (int) fd_out, len, "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT", - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/unlinkat.c b/tests/unlinkat.c index 2a268a28..8f3cd64c 100644 --- a/tests/unlinkat.c +++ b/tests/unlinkat.c @@ -16,14 +16,14 @@ main(void) int rc = syscall(__NR_unlinkat, fd, sample, 0); printf("unlinkat(%d, \"%s\", 0) = %d %s (%m)\n", (int) fd, sample, rc, - errno == ENOSYS ? "ENOSYS" : "EBADF"); + errno2name()); rc = syscall(__NR_unlinkat, -100, sample, -1L); printf("unlinkat(%s, \"%s\", %s) = %d %s (%m)\n", "AT_FDCWD", sample, "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW" "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff", - rc, errno == ENOSYS ? "ENOSYS" : "EINVAL"); + rc, errno2name()); puts("+++ exited with 0 +++"); return 0; diff --git a/tests/userfaultfd.c b/tests/userfaultfd.c index 5dc294bc..a2f5375d 100644 --- a/tests/userfaultfd.c +++ b/tests/userfaultfd.c @@ -41,7 +41,7 @@ main(void) { assert(syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC) == -1); printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = -1 %s (%m)\n", - errno == ENOSYS ? "ENOSYS" : "EINVAL"); + errno2name()); puts("+++ exited with 0 +++"); return 0; } diff --git a/tests/xetpriority.c b/tests/xetpriority.c index aefe5e95..016387d7 100644 --- a/tests/xetpriority.c +++ b/tests/xetpriority.c @@ -24,7 +24,7 @@ main(void) printf("setpriority(PRIO_PROCESS, %d, 0) = 0\n", pid); } else { printf("setpriority(PRIO_PROCESS, %d, 0) = -1 %s (%m)\n", - pid, errno == EPERM ? "EPERM" : "EACCES"); + pid, errno2name()); } puts("+++ exited with 0 +++"); -- 2.40.0