diff options
author | Kir Kolyshkin <kolyshkin@gmail.com> | 2021-04-23 00:54:04 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2021-09-03 20:31:00 +0300 |
commit | b20694835d6ca50cb2c03c78e98ab9ce8a843765 (patch) | |
tree | 1b58beab02814466c20ed05ae06585f5e9520a8c | |
parent | 9cbcaaed39c62e99ef45ea6df1926153884aa5ba (diff) |
test/zdtm: don't use \n with fail()
Macro fail already appends \n to the message, so there's no need to do
it explicitly.
Brought to you by
for f in $(git grep -l fail test/zdtm); do
test -f $f || continue
echo $f
sed -i '\%^[[:space:]]*fail(.*\\n"%s/\\n"/"/' $f
done
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
120 files changed, 359 insertions, 359 deletions
diff --git a/test/zdtm/static/apparmor.c b/test/zdtm/static/apparmor.c index b3a4d7549..a06589815 100644 --- a/test/zdtm/static/apparmor.c +++ b/test/zdtm/static/apparmor.c @@ -22,13 +22,13 @@ int setprofile(void) len = snprintf(profile, sizeof(profile), "changeprofile " PROFILE); if (len < 0 || len >= sizeof(profile)) { - fail("bad sprintf\n"); + fail("bad sprintf"); return -1; } fd = open("/proc/self/attr/current", O_WRONLY); if (fd < 0) { - fail("couldn't open fd\n"); + fail("couldn't open fd"); return -1; } @@ -38,7 +38,7 @@ int setprofile(void) close(fd); if (len < 0) { - fail("couldn't write profile\n"); + fail("couldn't write profile"); return -1; } @@ -55,19 +55,19 @@ int checkprofile(void) f = fopen(path, "r"); if (!f) { - fail("couldn't open lsm current\n"); + fail("couldn't open lsm current"); return -1; } len = fscanf(f, "%[^ \n]s", profile); fclose(f); if (len != 1) { - fail("wrong number of items scanned %d\n", len); + fail("wrong number of items scanned %d", len); return -1; } if (strcmp(profile, PROFILE) != 0) { - fail("bad profile .%s. expected .%s.\n", profile, PROFILE); + fail("bad profile .%s. expected .%s.", profile, PROFILE); return -1; } diff --git a/test/zdtm/static/arm-neon00.c b/test/zdtm/static/arm-neon00.c index ce8123e51..c58218a11 100644 --- a/test/zdtm/static/arm-neon00.c +++ b/test/zdtm/static/arm-neon00.c @@ -49,7 +49,7 @@ int main(int argc, char ** argv) ); if (y1 != y2) - fail("VFP restoration failed: result = %d, expected = %d (a = %d, b = %d, c = %d)\n", y2, y1, a, b, c); + fail("VFP restoration failed: result = %d, expected = %d (a = %d, b = %d, c = %d)", y2, y1, a, b, c); else pass(); diff --git a/test/zdtm/static/binfmt_misc.c b/test/zdtm/static/binfmt_misc.c index 72ab8c1ec..553cc1795 100644 --- a/test/zdtm/static/binfmt_misc.c +++ b/test/zdtm/static/binfmt_misc.c @@ -146,7 +146,7 @@ int main(int argc, char **argv) ssprintf(path, "%s/%s", dirname, NAME[0]); fd = open(path, O_WRONLY); if (fd < 0 || write(fd, "0", 1) != 1) { - fail("Can't disable %s\n", path); + fail("Can't disable %s", path); exit(1); } close(fd); @@ -170,7 +170,7 @@ int main(int argc, char **argv) exit(1); if (strcmp(tmp, dump[i])) { - fail("Content differs:\n%s\nand\n%s\n", tmp, dump[i]); + fail("Content differs:\n%s\nand\n%s", tmp, dump[i]); exit(1); } free(dump[i]); diff --git a/test/zdtm/static/cgroup01.c b/test/zdtm/static/cgroup01.c index cf54c1d9e..f0d00f209 100644 --- a/test/zdtm/static/cgroup01.c +++ b/test/zdtm/static/cgroup01.c @@ -86,13 +86,13 @@ int main(int argc, char **argv) ssprintf(paux, "%s/%s/%s.%d", aux, subname, empty, i); if (stat(paux, &st)) { - fail("couldn't stat %s\n", paux); + fail("couldn't stat %s", paux); ret = -1; goto out_close; } if (!S_ISDIR(st.st_mode)) { - fail("%s is not a directory\n", paux); + fail("%s is not a directory", paux); ret = -1; goto out_close; } @@ -103,7 +103,7 @@ int main(int argc, char **argv) goto out_close; } - fail("empty cgroup not found!\n"); + fail("empty cgroup not found!"); out_close: fclose(cgf); diff --git a/test/zdtm/static/cgroup02.c b/test/zdtm/static/cgroup02.c index 6de22226f..67cc73d9e 100644 --- a/test/zdtm/static/cgroup02.c +++ b/test/zdtm/static/cgroup02.c @@ -148,12 +148,12 @@ int main(int argc, char **argv) } if (!found_zdtmtstroot) { - fail("oldroot not rewritten to zdtmtstroot!\n"); + fail("oldroot not rewritten to zdtmtstroot!"); goto out_close; } if (!found_newroot) { - fail("oldroot not rewritten to newroot!\n"); + fail("oldroot not rewritten to newroot!"); goto out_close; } diff --git a/test/zdtm/static/cgroup03.c b/test/zdtm/static/cgroup03.c index 0b5db2345..757f0c3b4 100644 --- a/test/zdtm/static/cgroup03.c +++ b/test/zdtm/static/cgroup03.c @@ -102,17 +102,17 @@ int checkperms(char *path) } if ((sb.st_mode & 0777) != 0777) { - fail("mode for %s doesn't match (%o)\n", path, sb.st_mode); + fail("mode for %s doesn't match (%o)", path, sb.st_mode); return -1; } if (sb.st_uid != 1000) { - fail("uid for %s doesn't match (%d)\n", path, sb.st_uid); + fail("uid for %s doesn't match (%d)", path, sb.st_uid); return -1; } if (sb.st_gid != 1000) { - fail("gid for %s doesn't match (%d)\n", path, sb.st_gid); + fail("gid for %s doesn't match (%d)", path, sb.st_gid); return -1; } diff --git a/test/zdtm/static/cgroup_stray.c b/test/zdtm/static/cgroup_stray.c index 8532f84da..dc68ee6e5 100644 --- a/test/zdtm/static/cgroup_stray.c +++ b/test/zdtm/static/cgroup_stray.c @@ -206,7 +206,7 @@ int main(int argc, char **argv) } if (!WIFEXITED(status) || WEXITSTATUS(status)) { - fail("exit status %d\n", status); + fail("exit status %d", status); goto out_umount; } diff --git a/test/zdtm/static/child_subreaper.c b/test/zdtm/static/child_subreaper.c index 6d02c9f93..4a27569fc 100644 --- a/test/zdtm/static/child_subreaper.c +++ b/test/zdtm/static/child_subreaper.c @@ -28,7 +28,7 @@ int main(int argc, char **argv) } if (cs_before != cs_after) - fail("%d != %d\n", cs_before, cs_after); + fail("%d != %d", cs_before, cs_after); else pass(); diff --git a/test/zdtm/static/cmdlinenv00.c b/test/zdtm/static/cmdlinenv00.c index 90e7735db..8fffcb3e0 100644 --- a/test/zdtm/static/cmdlinenv00.c +++ b/test/zdtm/static/cmdlinenv00.c @@ -26,7 +26,7 @@ static void read_from_proc(const char *path, char *buf, size_t size) fd = open(path, O_RDONLY); if (fd < 0) { - fail("Can't open cmdline\n"); + fail("Can't open cmdline"); exit(1); } diff --git a/test/zdtm/static/cr_veth.c b/test/zdtm/static/cr_veth.c index deef73579..bc5c0cbd4 100644 --- a/test/zdtm/static/cr_veth.c +++ b/test/zdtm/static/cr_veth.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (!wait_for_veth()) { - fail("failed to inject veth device\n"); + fail("failed to inject veth device"); return 1; } diff --git a/test/zdtm/static/cwd00.c b/test/zdtm/static/cwd00.c index b0736f5e2..e05aea42f 100644 --- a/test/zdtm/static/cwd00.c +++ b/test/zdtm/static/cwd00.c @@ -46,12 +46,12 @@ int main(int argc, char **argv) test_waitsig(); if (!getcwd(cwd2, sizeof(cwd2))) { - fail("can't get cwd: %m\n"); + fail("can't get cwd: %m"); goto cleanup; } if (strcmp(cwd1, cwd2)) - fail("%s != %s\n", cwd1, cwd2); + fail("%s != %s", cwd1, cwd2); else pass(); cleanup: diff --git a/test/zdtm/static/cwd01.c b/test/zdtm/static/cwd01.c index 4e10a6b8b..8751dc514 100644 --- a/test/zdtm/static/cwd01.c +++ b/test/zdtm/static/cwd01.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) aux2 = readlink("/proc/self/cwd", cwd2, sizeof(cwd2)); if (aux2 < 0) { - fail("can't get cwd: %m\n"); + fail("can't get cwd: %m"); goto cleanup; } if (aux2 == sizeof(cwd2)) { @@ -86,7 +86,7 @@ int main(int argc, char **argv) /* FIXME -- criu adds a suffix to removed cwd */ if (strncmp(cwd1, cwd2, aux)) - fail("%s != %s\n", cwd1, cwd2); + fail("%s != %s", cwd1, cwd2); else pass(); cleanup: diff --git a/test/zdtm/static/cwd02.c b/test/zdtm/static/cwd02.c index 82f258627..0d4b276e5 100644 --- a/test/zdtm/static/cwd02.c +++ b/test/zdtm/static/cwd02.c @@ -63,18 +63,18 @@ int main(int argc, char **argv) test_waitsig(); if (fstat(fd, &stf) < 0) { - fail("dir fd closed\n"); + fail("dir fd closed"); goto cleanup; } if (stat("/proc/self/cwd", &std) < 0) { - fail("cwd is not OK\n"); + fail("cwd is not OK"); goto cleanup; } if (stf.st_ino != std.st_ino || stf.st_dev != std.st_dev) { - fail("cwd and opened fd are not the same\n"); + fail("cwd and opened fd are not the same"); goto cleanup; } diff --git a/test/zdtm/static/del_standalone_un.c b/test/zdtm/static/del_standalone_un.c index 5426fc786..f1a7a30f6 100644 --- a/test/zdtm/static/del_standalone_un.c +++ b/test/zdtm/static/del_standalone_un.c @@ -93,7 +93,7 @@ int main(int argc, char **argv) } if (stat(addr.sun_path, &sb) != 0) { - fail("%s doesn't exist after restore\n", addr.sun_path); + fail("%s doesn't exist after restore", addr.sun_path); goto out; } diff --git a/test/zdtm/static/deleted_dev.c b/test/zdtm/static/deleted_dev.c index 41319b7ec..c9ca4f123 100644 --- a/test/zdtm/static/deleted_dev.c +++ b/test/zdtm/static/deleted_dev.c @@ -64,7 +64,7 @@ int main(int argc, char **argv) } if (unlink(filename) != -1 || errno != ENOENT) { - fail("file %s should have been deleted before migration: unlink: %m\n", filename); + fail("file %s should have been deleted before migration: unlink: %m", filename); goto out; } diff --git a/test/zdtm/static/deleted_unix_sock.c b/test/zdtm/static/deleted_unix_sock.c index 4d328e996..4a0f50e68 100644 --- a/test/zdtm/static/deleted_unix_sock.c +++ b/test/zdtm/static/deleted_unix_sock.c @@ -125,46 +125,46 @@ int main(int argc, char ** argv) test_waitsig(); if (kill(pid, SIGTERM)) { - fail("terminating the child failed: %m\n"); + fail("terminating the child failed: %m"); goto out; } if (wait(&ret) != pid) { - fail("wait() returned wrong pid %d: %m\n", pid); + fail("wait() returned wrong pid %d: %m", pid); goto out; } if (WIFEXITED(ret)) { ret = WEXITSTATUS(ret); if (ret) { - fail("child exited with nonzero code %d (%s)\n", ret, strerror(ret)); + fail("child exited with nonzero code %d (%s)", ret, strerror(ret)); goto out; } } if (WIFSIGNALED(ret)) { - fail("child exited on unexpected signal %d\n", WTERMSIG(ret)); + fail("child exited on unexpected signal %d", WTERMSIG(ret)); goto out; } if (read(sock, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } if (close(sock)) { - fail("close failed: %m\n"); + fail("close failed: %m"); goto out; } if (unlink(filename) != -1 || errno != ENOENT) { - fail("file %s should have been deleted before migration: unlink: %m\n", filename); + fail("file %s should have been deleted before migration: unlink: %m", filename); goto out; } diff --git a/test/zdtm/static/env00.c b/test/zdtm/static/env00.c index 1feabfa9f..7207f0c05 100644 --- a/test/zdtm/static/env00.c +++ b/test/zdtm/static/env00.c @@ -26,12 +26,12 @@ int main(int argc, char **argv) env = getenv(envname); if (!env) { - fail("can't get env var \"%s\": %m\n", envname); + fail("can't get env var \"%s\": %m", envname); goto out; } if (strcmp(env, test_author)) - fail("%s != %s\n", env, test_author); + fail("%s != %s", env, test_author); else pass(); out: diff --git a/test/zdtm/static/eventfs00.c b/test/zdtm/static/eventfs00.c index 72fd38a9c..5278777ba 100644 --- a/test/zdtm/static/eventfs00.c +++ b/test/zdtm/static/eventfs00.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) } if (v != EVENTFD_FINAL) { - fail("EVENTFD_FINAL mismatch\n"); + fail("EVENTFD_FINAL mismatch"); exit(1); } diff --git a/test/zdtm/static/fanotify00.c b/test/zdtm/static/fanotify00.c index e948a63aa..0251e46d4 100644 --- a/test/zdtm/static/fanotify00.c +++ b/test/zdtm/static/fanotify00.c @@ -284,25 +284,25 @@ int main (int argc, char *argv[]) close(fd); if (unlink(fanotify_path)) { - fail("can't unlink %s\n", fanotify_path); + fail("can't unlink %s", fanotify_path); exit(1); } if (parse_fanotify_fdinfo(fa_fd, &new, 3)) { - fail("parsing fanotify fdinfo failed\n"); + fail("parsing fanotify fdinfo failed"); exit(1); } show_fanotify_obj(&new); if (cmp_fanotify_obj(&old, &new)) { - fail("fanotify mismatch on fdinfo level\n"); + fail("fanotify mismatch on fdinfo level"); exit(1); } length = read(fa_fd, buf, sizeof(buf)); if (length <= 0) { - fail("No events in fanotify queue\n"); + fail("No events in fanotify queue"); exit(1); } diff --git a/test/zdtm/static/fd.c b/test/zdtm/static/fd.c index a2e89d93f..bf27eaf44 100644 --- a/test/zdtm/static/fd.c +++ b/test/zdtm/static/fd.c @@ -85,7 +85,7 @@ int main(int argc, char **argv) ret = 0; } pfd[ret] = '\0'; - fail("Unexpected fd: %s -> %s\n", de->d_name, pfd); + fail("Unexpected fd: %s -> %s", de->d_name, pfd); return 1; } diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c index a84444af5..6ccd25487 100644 --- a/test/zdtm/static/fdt_shared.c +++ b/test/zdtm/static/fdt_shared.c @@ -81,7 +81,7 @@ static int child3(void *_arg) test_waitsig(); if (close(TEST_FD) != -1) { - fail("%d is exist\n", TEST_FD); + fail("%d is exist", TEST_FD); return 1; } @@ -110,14 +110,14 @@ static int child(void *_arg) waitpid(pid2, &status, 0); if (status) { - fail("The child3 returned %d\n", status); + fail("The child3 returned %d", status); return 1; } waitpid(pid, &status, 0); if (status) { - fail("The child2 returned %d\n", status); + fail("The child2 returned %d", status); return 1; } @@ -185,18 +185,18 @@ int main(int argc, char ** argv) kill(pid, SIGTERM); if (status) { - fail("The child returned %d\n", status); + fail("The child returned %d", status); return 1; } waitpid(pid, &status, 0); if (status) { - fail("The child returned %d\n", status); + fail("The child returned %d", status); return 1; } if (close(TEST_FD) == 0) { - fail("%d was not closed\n", TEST_FD); + fail("%d was not closed", TEST_FD); return 1; } diff --git a/test/zdtm/static/fifo-rowo-pair.c b/test/zdtm/static/fifo-rowo-pair.c index 85aad027d..5becf1689 100644 --- a/test/zdtm/static/fifo-rowo-pair.c +++ b/test/zdtm/static/fifo-rowo-pair.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) task_waiter_complete_current(&t); if (v != TEST_VALUE) { - fail("read data mismatch\n"); + fail("read data mismatch"); exit_shot(pid, 1); } @@ -130,7 +130,7 @@ int main(int argc, char **argv) exit_shot(pid, 1); } if (v != TEST_VALUE) { - fail("read data mismatch\n"); + fail("read data mismatch"); exit_shot(pid, 1); } diff --git a/test/zdtm/static/fifo.c b/test/zdtm/static/fifo.c index ab5674a9e..0381aee39 100644 --- a/test/zdtm/static/fifo.c +++ b/test/zdtm/static/fifo.c @@ -54,7 +54,7 @@ int main(int argc, char **argv) crc = ~0; if (datachk(buf, BUF_SIZE, &crc)) { - fail("data corrupted\n"); + fail("data corrupted"); return 1; } diff --git a/test/zdtm/static/fifo_ro.c b/test/zdtm/static/fifo_ro.c index ea3232937..3347d2003 100644 --- a/test/zdtm/static/fifo_ro.c +++ b/test/zdtm/static/fifo_ro.c @@ -62,7 +62,7 @@ int main(int argc, char **argv) crc = ~0; if (datachk(buf, BUF_SIZE, &crc)) { - fail("data corrupted\n"); + fail("data corrupted"); return 1; } diff --git a/test/zdtm/static/fifo_wronly.c b/test/zdtm/static/fifo_wronly.c index 78fc7c8f7..3aea32c64 100644 --- a/test/zdtm/static/fifo_wronly.c +++ b/test/zdtm/static/fifo_wronly.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) wait(&chret); chret = WEXITSTATUS(chret); if (chret) { - fail("child exited with non-zero code %d (%s)\n", + fail("child exited with non-zero code %d (%s)", chret, strerror(chret)); return 1; } diff --git a/test/zdtm/static/file_attr.c b/test/zdtm/static/file_attr.c index eb1c2a202..d6764b53d 100644 --- a/test/zdtm/static/file_attr.c +++ b/test/zdtm/static/file_attr.c @@ -72,18 +72,18 @@ int main(int argc, char ** argv) test_waitsig(); if (lseek(fd, 0, SEEK_SET) < 0) { - fail("lseeking to the beginning of file failed: %m\n"); + fail("lseeking to the beginning of file failed: %m"); goto out; } if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } @@ -103,12 +103,12 @@ int main(int argc, char ** argv) } if (close(fd)) { - fail("close failed: %m\n"); + fail("close failed: %m"); goto out_noclose; } if (unlink(filename) != -1 || errno != ENOENT) { - fail("file %s should have been deleted before migration: unlink: %m\n", filename); + fail("file %s should have been deleted before migration: unlink: %m", filename); goto out_noclose; } diff --git a/test/zdtm/static/file_fown.c b/test/zdtm/static/file_fown.c index f29ba45af..af20a3174 100644 --- a/test/zdtm/static/file_fown.c +++ b/test/zdtm/static/file_fown.c @@ -55,17 +55,17 @@ static int cmp_pipe_params(struct params *p1, struct params *p2) for (i = 0; i < 2; i++) { if (p1->pipe_flags[i] != p2->pipe_flags[i]) { - fail("pipe flags failed [%d] expected %08o got %08o\n", + fail("pipe flags failed [%d] expected %08o got %08o", i, p1->pipe_flags[i], p2->pipe_flags[i]); return -1; } if (p1->pipe_pid[i] != p2->pipe_pid[i]) { - fail("pipe pid failed [%d] expected %d got %d\n", + fail("pipe pid failed [%d] expected %d got %d", i, p1->pipe_pid[i], p2->pipe_pid[i]); return -1; } if (p1->pipe_sig[i] != p2->pipe_sig[i]) { - fail("pipe sig failed [%d] expected %d got %d\n", + fail("pipe sig failed [%d] expected %d got %d", i, p1->pipe_sig[i], p2->pipe_sig[i]); return -1; } @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) } if (getresuid(&ruid, &euid, &suid)) { - fail("getresuid failed\n"); + fail("getresuid failed"); exit(1); } @@ -103,12 +103,12 @@ int main(int argc, char *argv[]) saio.sa_handler = (sig_t)signal_handler_io; saio.sa_flags = SA_RESTART; if (sigaction(SIGIO, &saio, 0)) { - fail("sigaction failed\n"); + fail("sigaction failed"); exit(1); } if (!getuid() && setresuid(-1, 1, -1)) { - fail("setresuid failed\n"); + fail("setresuid failed"); exit(1); } @@ -118,14 +118,14 @@ int main(int argc, char *argv[]) fcntl(pipes[1], F_SETSIG, SIGIO) || fcntl(pipes[0], F_SETFL, fcntl(pipes[0], F_GETFL) | O_ASYNC) || fcntl(pipes[1], F_SETFL, fcntl(pipes[1], F_GETFL) | O_ASYNC)) { - fail("fcntl failed\n"); + fail("fcntl failed"); exit(1); } fill_pipe_params(shared, pipes); if (setresuid(-1, euid, -1)) { - fail("setresuid failed\n"); + fail("setresuid failed"); exit(1); } @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) fill_pipe_params(&p, pipes); if (write(pipes[1], &p, sizeof(p)) != sizeof(p)) { - fail("write failed\n"); + fail("write failed"); exit(1); } @@ -156,24 +156,24 @@ int main(int argc, char *argv[]) kill(pid, SIGTERM); if (waitpid(pid, &status, P_ALL) == -1) { - fail("waitpid failed\n"); + fail("waitpid failed"); exit(1); } if (read(pipes[0], &obtained, sizeof(obtained)) != sizeof(obtained)) { - fail("read failed\n"); + fail("read failed"); exit(1); } if (shared->sigio < 1) { - fail("shared->sigio = %d (> 0 expected)\n", shared->sigio); + fail("shared->sigio = %d (> 0 expected)", shared->sigio); exit(1); } shared->pipe_pid[1] = pid; if (cmp_pipe_params(shared, &obtained)) { - fail("params comparison failed\n"); + fail("params comparison failed"); exit(1); } diff --git a/test/zdtm/static/file_lease00.c b/test/zdtm/static/file_lease00.c index 226e73abc..3fd1a0d88 100644 --- a/test/zdtm/static/file_lease00.c +++ b/test/zdtm/static/file_lease00.c @@ -73,9 +73,9 @@ int main(int argc, char **argv) test_waitsig(); if (check_lease_type(fd_rd, F_RDLCK)) - fail("Read lease check failed\n"); + fail("Read lease check failed"); else if (check_lease_type(fd_wr, F_WRLCK)) - fail("Write lease check failed\n"); + fail("Write lease check failed"); else pass(); diff --git a/test/zdtm/static/file_lease01.c b/test/zdtm/static/file_lease01.c index 047bca705..6f3dfe60f 100644 --- a/test/zdtm/static/file_lease01.c +++ b/test/zdtm/static/file_lease01.c @@ -74,11 +74,11 @@ int main(int argc, char **argv) test_waitsig(); if (check_lease_type(fds[FD_LEASE_FREE], F_UNLCK)) - fail("Unexpected lease was found (%i)\n", fds[FD_LEASE_FREE]); + fail("Unexpected lease was found (%i)", fds[FD_LEASE_FREE]); else if (check_lease_type(fds[FD_LEASED1], F_RDLCK)) - fail("Lease isn't set (%i)\n", fds[FD_LEASED1]); + fail("Lease isn't set (%i)", fds[FD_LEASED1]); else if (check_lease_type(fds[FD_LEASED2], F_RDLCK)) - fail("Lease isn't set (%i)\n", fds[FD_LEASED2]); + fail("Lease isn't set (%i)", fds[FD_LEASED2]); else pass(); diff --git a/test/zdtm/static/file_lease02.c b/test/zdtm/static/file_lease02.c index 3afb458f9..87c56cfd1 100644 --- a/test/zdtm/static/file_lease02.c +++ b/test/zdtm/static/file_lease02.c @@ -131,11 +131,11 @@ int main(int argc, char **argv) ret = 0; if (sigaction_error) - fail("Ghost signal\n"); + fail("Ghost signal"); else if (check_lease_type(fds[0], F_UNLCK) || check_lease_type(fds[1], F_RDLCK) || check_lease_type(fds[2], F_UNLCK)) - fail("Lease type doesn't match\n"); + fail("Lease type doesn't match"); else pass(); done: diff --git a/test/zdtm/static/file_lease03.c b/test/zdtm/static/file_lease03.c index eeb33d245..799c1b1f1 100644 --- a/test/zdtm/static/file_lease03.c +++ b/test/zdtm/static/file_lease03.c @@ -129,9 +129,9 @@ int main(int argc, char **argv) if (ret < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) fail(); if (sigaction_error) - fail("Ghost signal\n"); + fail("Ghost signal"); else if (check_lease_type(fd, F_UNLCK)) - fail("Lease type doesn't match\n"); + fail("Lease type doesn't match"); else pass(); diff --git a/test/zdtm/static/file_lease04.c b/test/zdtm/static/file_lease04.c index 10fbc6b2a..4ad9af84f 100644 --- a/test/zdtm/static/file_lease04.c +++ b/test/zdtm/static/file_lease04.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) if (ret < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) fail(); else if (sigaction_error) - fail("Ghost signal\n"); + fail("Ghost signal"); else pass(); done: diff --git a/test/zdtm/static/file_locks06.c b/test/zdtm/static/file_locks06.c index e7f4c6293..2fb0080c4 100644 --- a/test/zdtm/static/file_locks06.c +++ b/test/zdtm/static/file_locks06.c @@ -56,7 +56,7 @@ int main(int argc, char **argv) if (check_file_lock_restored(getpid(), fd, &lck) || check_lock_exists(filename, &lck) < 0) - fail("OFD file locks check failed\n"); + fail("OFD file locks check failed"); else pass(); diff --git a/test/zdtm/static/file_locks07.c b/test/zdtm/static/file_locks07.c index fcbfbf1d4..155c1a4a7 100644 --- a/test/zdtm/static/file_locks07.c +++ b/test/zdtm/static/file_locks07.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) test_waitsig(); if (check_file_locks_restored()) - fail("OFD file locks check failed\n"); + fail("OFD file locks check failed"); else pass(); diff --git a/test/zdtm/static/file_locks08.c b/test/zdtm/static/file_locks08.c index 214c90788..a4fa1feb5 100644 --- a/test/zdtm/static/file_locks08.c +++ b/test/zdtm/static/file_locks08.c @@ -75,13 +75,13 @@ int main(int argc, char **argv) if (check_file_lock_restored(getpid(), fd, &lck) || check_lock_exists(filename, &lck) < 0) - fail("OFD file locks check failed\n"); + fail("OFD file locks check failed"); kill(pid, SIGTERM); ret = waitpid(pid, &status, 0); if (ret < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) - fail("OFD file locks check failed\n"); + fail("OFD file locks check failed"); else pass(); diff --git a/test/zdtm/static/file_shared.c b/test/zdtm/static/file_shared.c index 8f1acb160..0e78b07e2 100644 --- a/test/zdtm/static/file_shared.c +++ b/test/zdtm/static/file_shared.c @@ -70,24 +70,24 @@ int main(int argc, char **argv) } off = lseek(fd2, 0, SEEK_CUR); if (off != OFFSET) { - fail("offset1 fail\n"); + fail("offset1 fail"); return 1; } off = lseek(fd3, 0, SEEK_CUR); if (off != OFFSET2) { - fail("offset2 fail\n"); + fail("offset2 fail"); return 1; } ret = fcntl(fd, F_GETFD, 0); if (ret != 0) { - fail("fd cloexec broken\n"); + fail("fd cloexec broken"); return 1; } ret = fcntl(fd2, F_GETFD, 0); if (ret != 1) { - fail("fd2 cloexec broken\n"); + fail("fd2 cloexec broken"); return 1; } @@ -95,17 +95,17 @@ int main(int argc, char **argv) test_waitsig(); off = lseek(fd, 0, SEEK_CUR); if (off != OFFSET) { - fail("offset3 fail\n"); + fail("offset3 fail"); return 1; } off = lseek(fd2, 0, SEEK_CUR); if (off != OFFSET) { - fail("offset4 fail\n"); + fail("offset4 fail"); return 1; } off = lseek(fd3, 0, SEEK_CUR); if (off != OFFSET2) { - fail("offset5 fail\n"); + fail("offset5 fail"); return 1; } return 0; diff --git a/test/zdtm/static/fpu00.c b/test/zdtm/static/fpu00.c index 150b404f2..6cc15a2b2 100644 --- a/test/zdtm/static/fpu00.c +++ b/test/zdtm/static/fpu00.c @@ -68,7 +68,7 @@ void *run_fpu_test(void *unused) res2 = finish(); if (res1 != res2) - fail("%f != %f\n", res1, res2); + fail("%f != %f", res1, res2); else pass(); diff --git a/test/zdtm/static/futex-rl.c b/test/zdtm/static/futex-rl.c index 678e175e3..a5888a340 100644 --- a/test/zdtm/static/futex-rl.c +++ b/test/zdtm/static/futex-rl.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) args = (struct args *)mmap(NULL, sizeof(*args), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0); if ((void *)args == MAP_FAILED) { - fail("mmap failed\n"); + fail("mmap failed"); exit(1); } @@ -86,14 +86,14 @@ int main(int argc, char **argv) test_msg("Creating thread\n"); if (pthread_create(&thread, NULL, thread_fn, (void *)args)) { - fail("Can't create thread\n"); + fail("Can't create thread"); exit(1); } test_msg("Wait for thread work\n"); task_waiter_wait4(&args->waiter, 1); if (args->result == -1) { - fail("thread failed\n"); + fail("thread failed"); exit(1); } diff --git a/test/zdtm/static/futex.c b/test/zdtm/static/futex.c index 2ad82d28b..5d1f2de86 100644 --- a/test/zdtm/static/futex.c +++ b/test/zdtm/static/futex.c @@ -59,7 +59,7 @@ int main(int argc, char **argv) sleep(1); if (kid_passed != 0) - fail("some kids broke through\n"); + fail("some kids broke through"); pthread_mutex_unlock(&m); for (i = 0; i < num_threads; i++) @@ -67,13 +67,13 @@ int main(int argc, char **argv) if (pthread_mutex_trylock(&m)) { if (errno == EBUSY) - fail("kids left my mutex locked\n"); + fail("kids left my mutex locked"); else pr_perror("kids spoiled my mutex"); } if (kid_passed != num_threads) - fail("some kids died during migration\n"); + fail("some kids died during migration"); pass(); out: diff --git a/test/zdtm/static/grow_map.c b/test/zdtm/static/grow_map.c index dd1dffd74..089ff7d45 100644 --- a/test/zdtm/static/grow_map.c +++ b/test/zdtm/static/grow_map.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) munmap(test_addr, PAGE_SIZE); if (fake_grow_down[0] != 'c' || *(fake_grow_down - 1) != 'b') { - fail("%c %c\n", fake_grow_down[0], *(fake_grow_down - 1)); + fail("%c %c", fake_grow_down[0], *(fake_grow_down - 1)); return 1; } diff --git a/test/zdtm/static/inotify_system.c b/test/zdtm/static/inotify_system.c index d504647f2..3d2355436 100644 --- a/test/zdtm/static/inotify_system.c +++ b/test/zdtm/static/inotify_system.c @@ -257,7 +257,7 @@ int errors(int exp_len, int len, char *etalon_buf, char *buf) { exp_event = (struct inotify_event *) &etalon_buf[marker]; else { if (!harmless(event->mask)) { - fail("got unexpected event %s (%x mask)\n", + fail("got unexpected event %s (%x mask)", handle_event(event->mask), event->mask); error++; } diff --git a/test/zdtm/static/loginuid.c b/test/zdtm/static/loginuid.c index 628fe64b9..dc27eeef3 100644 --- a/test/zdtm/static/loginuid.c +++ b/test/zdtm/static/loginuid.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) return -1; if (new_loginuid != test_value) { - fail("loginuid value %d is different after restore: %d\n", + fail("loginuid value %d is different after restore: %d", test_value, new_loginuid); return -1; } diff --git a/test/zdtm/static/macvlan.c b/test/zdtm/static/macvlan.c index 018dffd93..0d5feb233 100644 --- a/test/zdtm/static/macvlan.c +++ b/test/zdtm/static/macvlan.c @@ -40,7 +40,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (!wait_for_macvlan()) { - fail("failed to inject macvlan device\n"); + fail("failed to inject macvlan device"); return 1; } diff --git a/test/zdtm/static/maps00.c b/test/zdtm/static/maps00.c index f2da9b975..60328c4c1 100644 --- a/test/zdtm/static/maps00.c +++ b/test/zdtm/static/maps00.c @@ -133,7 +133,7 @@ static int check_map(struct map *map) if (signal(SIGSEGV, segfault) == SIG_ERR) { - fail("setting SIGSEGV handler failed: %m\n"); + fail("setting SIGSEGV handler failed: %m"); return -1; } if (!sigsetjmp(segv_ret, 1)) @@ -142,7 +142,7 @@ static int check_map(struct map *map) if (datachk(map->ptr, ONE_MAP_SIZE, &crc)) /* perform read access */ if (!(map->flag & MAP_ANONYMOUS) || (map->prot & PROT_WRITE)) { /* anon maps could only be filled when r/w */ - fail("CRC mismatch: ptr %p flag %8x prot %8x\n", + fail("CRC mismatch: ptr %p flag %8x prot %8x", map->ptr, map->flag, map->prot); return -1; } @@ -154,7 +154,7 @@ static int check_map(struct map *map) if (signal(SIGSEGV, segfault) == SIG_ERR) { - fail("setting SIGSEGV handler failed: %m\n"); + fail("setting SIGSEGV handler failed: %m"); return -1; } @@ -166,7 +166,7 @@ static int check_map(struct map *map) if (signal(SIGSEGV, segfault) == SIG_ERR) { - fail("restoring SIGSEGV handler failed: %m\n"); + fail("restoring SIGSEGV handler failed: %m"); return -1; } @@ -197,7 +197,7 @@ static int check_map(struct map *map) if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { - fail("restoring SIGSEGV handler failed: %m\n"); + fail("restoring SIGSEGV handler failed: %m"); return -1; } diff --git a/test/zdtm/static/maps03.c b/test/zdtm/static/maps03.c index 0e0a5b8f2..17299d551 100644 --- a/test/zdtm/static/maps03.c +++ b/test/zdtm/static/maps03.c @@ -37,7 +37,7 @@ int main(int argc, char **argv) test_msg("Testing restored data\n"); if (mem[4L << 30] != 1 || mem[8L << 30] != 2) { - fail("Data corrupted!\n"); + fail("Data corrupted!"); exit(1); } diff --git a/test/zdtm/static/mem-touch.c b/test/zdtm/static/mem-touch.c index 5c8c33998..b11c97f53 100644 --- a/test/zdtm/static/mem-touch.c +++ b/test/zdtm/static/mem-touch.c @@ -53,7 +53,7 @@ int main(int argc, char **argv) test_msg("Page %u matches %u\n", i, backup[i]); if (fail) - fail("Memory corruption\n"); + fail("Memory corruption"); else pass(); diff --git a/test/zdtm/static/mlock_setuid.c b/test/zdtm/static/mlock_setuid.c index a737bddf9..d8aec8315 100644 --- a/test/zdtm/static/mlock_setuid.c +++ b/test/zdtm/static/mlock_setuid.c @@ -49,7 +49,7 @@ int main(int argc, char **argv) if (new_flags & MAP_LOCKED) { pass(); } else { - fail("Vma is not locked after c/r\n"); + fail("Vma is not locked after c/r"); return -1; } diff --git a/test/zdtm/static/mmx00.c b/test/zdtm/static/mmx00.c index f0f7c3c9e..b736a80a1 100644 --- a/test/zdtm/static/mmx00.c +++ b/test/zdtm/static/mmx00.c @@ -87,9 +87,9 @@ int main(int argc, char **argv) finish(resbytes2, reswords2); if (memcmp((uint8_t *) resbytes1, (uint8_t *) resbytes2, sizeof(resbytes1))) - fail("byte op mismatch\n"); + fail("byte op mismatch"); else if (memcmp((uint8_t *) reswords1, (uint8_t *) reswords2, sizeof(reswords2))) - fail("word op mismatch\n"); + fail("word op mismatch"); else pass(); #else diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c index 463091a64..e70d29ae0 100644 --- a/test/zdtm/static/mprotect00.c +++ b/test/zdtm/static/mprotect00.c @@ -31,7 +31,7 @@ static void segfault(int signo) static int check_prot(char *ptr, int prot) { if (signal(SIGSEGV, segfault) == SIG_ERR) { - fail("setting SIGSEGV handler failed: %m\n"); + fail("setting SIGSEGV handler failed: %m"); return -1; } @@ -41,32 +41,32 @@ static int check_prot(char *ptr, int prot) return -1; } if (!(prot & PROT_READ)) { - fail("PROT_READ bypassed\n"); + fail("PROT_READ bypassed"); return -1; } } else /* we come here on return from SIGSEGV handler */ if (prot & PROT_READ) { - fail("PROT_READ rejected\n"); + fail("PROT_READ rejected"); return -1; } if (!sigsetjmp(segv_ret, 1)) { ptr[20] = 67; if (!(prot & PROT_WRITE)) { - fail("PROT_WRITE bypassed\n"); + fail("PROT_WRITE bypassed"); return -1; } } else /* we come here on return from SIGSEGV handler */ if (prot & PROT_WRITE) { - fail("PROT_WRITE rejected\n"); + fail("PROT_WRITE rejected"); return -1; } if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { - fail("restoring SIGSEGV handler failed: %m\n"); + fail("restoring SIGSEGV handler failed: %m"); return -1; } diff --git a/test/zdtm/static/msgque.c b/test/zdtm/static/msgque.c index 6bbb103bd..9ae3caf1f 100644 --- a/test/zdtm/static/msgque.c +++ b/test/zdtm/static/msgque.c @@ -102,7 +102,7 @@ int main(int argc, char **argv) wait(&chret); chret = WEXITSTATUS(chret); if (chret) { - fail("Parent: child exited with non-zero code %d (%s)\n", + fail("Parent: child exited with non-zero code %d (%s)", chret, strerror(chret)); goto out; } @@ -123,7 +123,7 @@ int main(int argc, char **argv) out: if (msgctl(msg, IPC_RMID, 0)) { - fail("Failed to destroy message queue: %d\n", -errno); + fail("Failed to destroy message queue: %d", -errno); return -errno; } return chret; diff --git a/test/zdtm/static/mtime_mmap.c b/test/zdtm/static/mtime_mmap.c index c2e2bddb7..90b4d6883 100644 --- a/test/zdtm/static/mtime_mmap.c +++ b/test/zdtm/static/mtime_mmap.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) ctime_new = fst.st_ctime; /* time of last status change */ if (ctime_new <= ctime_old) { - fail("time of last status change of %s file wasn't changed\n", + fail("time of last status change of %s file wasn't changed", filename); goto failed; } diff --git a/test/zdtm/static/oom_score_adj.c b/test/zdtm/static/oom_score_adj.c index b4275301e..8e9c40782 100644 --- a/test/zdtm/static/oom_score_adj.c +++ b/test/zdtm/static/oom_score_adj.c @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) return -1; if (new_oom_score_adj != test_value) { - fail("OOM score value %d is different after restore: %d\n", + fail("OOM score value %d is different after restore: %d", test_value, new_oom_score_adj); return -1; } diff --git a/test/zdtm/static/overmount_sock.c b/test/zdtm/static/overmount_sock.c index 94e4c7e6f..fb8ea7011 100644 --- a/test/zdtm/static/overmount_sock.c +++ b/test/zdtm/static/overmount_sock.c @@ -147,36 +147,36 @@ int main(int argc, char ** argv) test_waitsig(); if (kill(pid, SIGTERM)) { - fail("terminating the child failed: %m\n"); + fail("terminating the child failed: %m"); goto out; } if (wait(&ret) != pid) { - fail("wait() returned wrong pid %d: %m\n", pid); + fail("wait() returned wrong pid %d: %m", pid); goto out; } if (WIFEXITED(ret)) { ret = WEXITSTATUS(ret); if (ret) { - fail("child exited with nonzero code %d (%s)\n", ret, + fail("child exited with nonzero code %d (%s)", ret, strerror(ret)); goto out; } } if (WIFSIGNALED(ret)) { - fail("child exited on unexpected signal %d\n", WTERMSIG(ret)); + fail("child exited on unexpected signal %d", WTERMSIG(ret)); goto out; } if (read(sock, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", path); + fail("can't read %s: %m", path); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } diff --git a/test/zdtm/static/packet_sock.c b/test/zdtm/static/packet_sock.c index 66175d46b..5ec992edb 100644 --- a/test/zdtm/static/packet_sock.c +++ b/test/zdtm/static/packet_sock.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) } if (ver != TPACKET_V2) { - fail("Version mismatch have %d, want %d\n", ver, TPACKET_V2); + fail("Version mismatch have %d, want %d", ver, TPACKET_V2); return 1; } @@ -272,7 +272,7 @@ int main(int argc, char **argv) } if (rsv != SK_RESERVE) { - fail("Reserve mismatch have %d, want %d\n", rsv, SK_RESERVE); + fail("Reserve mismatch have %d, want %d", rsv, SK_RESERVE); return 1; } diff --git a/test/zdtm/static/pipe01.c b/test/zdtm/static/pipe01.c index ec8d1fb61..fd51988b5 100644 --- a/test/zdtm/static/pipe01.c +++ b/test/zdtm/static/pipe01.c @@ -116,7 +116,7 @@ int main(int argc, char ** argv) crc = ~0; ret = datachk(buf, sizeof(buf), &crc); if (ret) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto err; } } diff --git a/test/zdtm/static/posix_timers.c b/test/zdtm/static/posix_timers.c index 97fd3c0a9..b88114cdb 100644 --- a/test/zdtm/static/posix_timers.c +++ b/test/zdtm/static/posix_timers.c @@ -122,32 +122,32 @@ static int check_handler_status(struct posix_timers_info *info, int timer_ms; if (!info->handler_cnt && !info->oneshot) { - fail("%s: Signal handler wasn't called\n", info->name); + fail("%s: Signal handler wasn't called", info->name); return -EINVAL; } if (info->handler_status) { if (info->handler_status & WRONG_SIGNAL) - fail("%s: Handler: wrong signal received\n", info->name); + fail("%s: Handler: wrong signal received", info->name); if (info->handler_status & WRONG_SI_PTR) - fail("%s: Handler: wrong timer address\n", info->name); + fail("%s: Handler: wrong timer address", info->name); if (info->handler_status & FAIL_OVERRUN) - fail("%s: Handler: failed to get overrun count\n", info->name); + fail("%s: Handler: failed to get overrun count", info->name); return -1; } if (!info->oneshot && !its->it_value.tv_sec && !its->it_value.tv_nsec) { - fail("%s: timer became unset\n", info->name); + fail("%s: timer became unset", info->name); return -EFAULT; } if (info->oneshot && (its->it_interval.tv_sec || its->it_interval.tv_nsec)) { - fail("%s: timer became periodic\n", info->name); + fail("%s: timer became periodic", info->name); return -EFAULT; } if (!info->oneshot && !its->it_interval.tv_sec && !its->it_interval.tv_nsec) { - fail("%s: timer became oneshot\n", info->name); + fail("%s: timer became oneshot", info->name); return -EFAULT; } @@ -155,15 +155,15 @@ static int check_handler_status(struct posix_timers_info *info, int val = its->it_value.tv_sec * 1000 + its->it_value.tv_nsec / 1000 / 1000; if (info->handler_cnt) { if (val != 0) { - fail("%s: timer continues ticking after expiration\n", info->name); + fail("%s: timer continues ticking after expiration", info->name); return -EFAULT; } if (info->handler_cnt > 1) { - fail("%s: timer expired %d times\n", info->name, info->handler_cnt); + fail("%s: timer expired %d times", info->name, info->handler_cnt); return -EFAULT; } if (info->ms_int > ms_passed) { - fail("%s: timer expired too early\n", info->name); + fail("%s: timer expired too early", info->name); return -EFAULT; } return 0; @@ -179,7 +179,7 @@ static int check_handler_status(struct posix_timers_info *info, test_msg("%20s: Handler count : %d\n", info->name, info->handler_cnt); if (displacement > MAX_TIMER_DISPLACEMENT) { - fail("%32s: Time displacement: %d%% (max alloved: %d%%)\n", info->name, displacement, MAX_TIMER_DISPLACEMENT); + fail("%32s: Time displacement: %d%% (max alloved: %d%%)", info->name, displacement, MAX_TIMER_DISPLACEMENT); return -EFAULT; } return 0; @@ -193,19 +193,19 @@ static int check_timers(int delta, struct timespec *sleep_start, struct timespec struct itimerspec val, oldval; if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == -1) { - fail("Failed to unlock signal\n"); + fail("Failed to unlock signal"); return -errno; } while (info->handler) { memset(&val, 0, sizeof(val)); if (timer_settime(info->timerid, 0, &val, &oldval) == -1) { - fail("%s: failed to reset timer\n", info->name); + fail("%s: failed to reset timer", info->name); return -errno; } if (clock_gettime(info->clock, &info->end) == -1) { - fail("Can't get %s end time\n", info->name); + fail("Can't get %s end time", info->name); return -errno; } diff --git a/test/zdtm/static/proc-self.c b/test/zdtm/static/proc-self.c index 8292c08cc..6f0a30e7d 100644 --- a/test/zdtm/static/proc-self.c +++ b/test/zdtm/static/proc-self.c @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) } if (memcmp(path_orig, path_new, sizeof(path_orig))) { - fail("Paths mismatch %s %s\n", path_orig, path_new); + fail("Paths mismatch %s %s", path_orig, path_new); return -1; } diff --git a/test/zdtm/static/pthread00.c b/test/zdtm/static/pthread00.c index 2b248b234..4da824056 100644 --- a/test/zdtm/static/pthread00.c +++ b/test/zdtm/static/pthread00.c @@ -89,7 +89,7 @@ static void *thread_func_1(void *map) pid = test_fork(); if (pid < 0) { - fail("Failed to test_fork()\n"); + fail("Failed to test_fork()"); exit_group(1); } else if (pid == 0) { passage(2); @@ -115,7 +115,7 @@ static void *thread_func_2(void *map) pid = test_fork(); if (pid < 0) { - fail("Failed to test_fork()\n"); + fail("Failed to test_fork()"); exit_group(1); } else if (pid == 0) { passage(4); diff --git a/test/zdtm/static/pty00.c b/test/zdtm/static/pty00.c index 9e4f45232..2c76d9c3e 100644 --- a/test/zdtm/static/pty00.c +++ b/test/zdtm/static/pty00.c @@ -38,7 +38,7 @@ int main(int argc, char ** argv) * receive SIGHUP, so make sure it's delivered. */ if (sigaction(SIGHUP, &sa, 0)) { - fail("sigaction failed\n"); + fail("sigaction failed"); return 1; } diff --git a/test/zdtm/static/rmdir_open.c b/test/zdtm/static/rmdir_open.c index 279aa7898..f671ac48f 100644 --- a/test/zdtm/static/rmdir_open.c +++ b/test/zdtm/static/rmdir_open.c @@ -49,17 +49,17 @@ int main(int argc, char **argv) * still points to some removed directory. */ if (fstat(fd, &st)) { - fail("Can't stat fd\n"); + fail("Can't stat fd"); goto out; } if (!S_ISDIR(st.st_mode)) { - fail("Fd is no longer directory\n"); + fail("Fd is no longer directory"); goto out; } if (st.st_nlink != 0) { - fail("Directory is not removed\n"); + fail("Directory is not removed"); goto out; } diff --git a/test/zdtm/static/s390x_gs_threads.c b/test/zdtm/static/s390x_gs_threads.c index 8d1442194..6f6e7de22 100644 --- a/test/zdtm/static/s390x_gs_threads.c +++ b/test/zdtm/static/s390x_gs_threads.c @@ -118,7 +118,7 @@ static void *thread_run(void *param) gs_epl = malloc(sizeof(unsigned long) * 6); gs_cb = malloc(sizeof(*gs_cb)); if (gs_epl == NULL || gs_cb == NULL) { - fail("Error allocating memory\n"); + fail("Error allocating memory"); exit(1); } gs_cb->gsd = 0x1234000000UL | 26; diff --git a/test/zdtm/static/s390x_mmap_high.c b/test/zdtm/static/s390x_mmap_high.c index 5eb06e6bc..c4bd1c83d 100644 --- a/test/zdtm/static/s390x_mmap_high.c +++ b/test/zdtm/static/s390x_mmap_high.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) for (i = 0; i < MAP_SIZE; i++) { if (buf[i] == VAL) continue; - fail("%d: %d != %d\n", i, buf[i], VAL); + fail("%d: %d != %d", i, buf[i], VAL); goto out; } pass(); diff --git a/test/zdtm/static/seccomp_filter.c b/test/zdtm/static/seccomp_filter.c index 81d985132..501a4941c 100644 --- a/test/zdtm/static/seccomp_filter.c +++ b/test/zdtm/static/seccomp_filter.c @@ -180,7 +180,7 @@ int main(int argc, char ** argv) } if (mode != SECCOMP_MODE_FILTER) { - fail("seccomp mode mismatch %d\n", mode); + fail("seccomp mode mismatch %d", mode); return 1; } diff --git a/test/zdtm/static/seccomp_filter_inheritance.c b/test/zdtm/static/seccomp_filter_inheritance.c index 840136c5c..3129185ea 100644 --- a/test/zdtm/static/seccomp_filter_inheritance.c +++ b/test/zdtm/static/seccomp_filter_inheritance.c @@ -159,7 +159,7 @@ int main(int argc, char ** argv) } if (mode != SECCOMP_MODE_FILTER) { - fail("seccomp mode mismatch %d\n", mode); + fail("seccomp mode mismatch %d", mode); return 1; } diff --git a/test/zdtm/static/seccomp_filter_threads.c b/test/zdtm/static/seccomp_filter_threads.c index f3ca235df..8d5b77d16 100644 --- a/test/zdtm/static/seccomp_filter_threads.c +++ b/test/zdtm/static/seccomp_filter_threads.c @@ -206,7 +206,7 @@ int main(int argc, char ** argv) mode = get_seccomp_mode(pid); if (mode != SECCOMP_MODE_DISABLED) { - fail("seccomp mode mismatch %d\n", mode); + fail("seccomp mode mismatch %d", mode); return 1; } @@ -217,7 +217,7 @@ int main(int argc, char ** argv) } if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - fail("expected 0 exit, got %d\n", WEXITSTATUS(status)); + fail("expected 0 exit, got %d", WEXITSTATUS(status)); exit(1); } diff --git a/test/zdtm/static/seccomp_filter_tsync.c b/test/zdtm/static/seccomp_filter_tsync.c index e374f0aff..739ea96f7 100644 --- a/test/zdtm/static/seccomp_filter_tsync.c +++ b/test/zdtm/static/seccomp_filter_tsync.c @@ -196,7 +196,7 @@ int main(int argc, char ** argv) } if (mode != SECCOMP_MODE_FILTER) { - fail("seccomp mode mismatch %d\n", mode); + fail("seccomp mode mismatch %d", mode); return 1; } diff --git a/test/zdtm/static/seccomp_strict.c b/test/zdtm/static/seccomp_strict.c index ac95ac828..9042924b2 100644 --- a/test/zdtm/static/seccomp_strict.c +++ b/test/zdtm/static/seccomp_strict.c @@ -115,7 +115,7 @@ int main(int argc, char ** argv) exit(1); } if (mode != SECCOMP_MODE_STRICT) { - fail("seccomp mode mismatch %d\n", mode); + fail("seccomp mode mismatch %d", mode); return 1; } diff --git a/test/zdtm/static/selinux00.c b/test/zdtm/static/selinux00.c index b5b3e3cc0..be647834d 100644 --- a/test/zdtm/static/selinux00.c +++ b/test/zdtm/static/selinux00.c @@ -39,7 +39,7 @@ int setprofile(void) fd = open("/proc/self/attr/current", O_WRONLY); if (fd < 0) { - fail("Could not open /proc/self/attr/current\n"); + fail("Could not open /proc/self/attr/current"); return -1; } @@ -47,7 +47,7 @@ int setprofile(void) close(fd); if (len < 0) { - fail("Could not write context\n"); + fail("Could not write context"); return -1; } @@ -63,20 +63,20 @@ int checkprofile(void) fd = open("/proc/self/attr/current", O_RDONLY); if (fd < 0) { - fail("Could not open /proc/self/attr/current\n"); + fail("Could not open /proc/self/attr/current"); return -1; } len = read(fd, context, strlen(CONTEXT)); close(fd); if (len != strlen(CONTEXT)) { - fail("SELinux context has unexpected length %d, expected %zd\n", + fail("SELinux context has unexpected length %d, expected %zd", len, strlen(CONTEXT)); return -1; } if (strncmp(context, CONTEXT, strlen(CONTEXT)) != 0) { - fail("Wrong SELinux context %s expected %s\n", context, CONTEXT); + fail("Wrong SELinux context %s expected %s", context, CONTEXT); return -1; } @@ -94,14 +94,14 @@ int check_sockcreate(void) free(output); /* sockcreate should be empty, if fscanf found something * it is wrong.*/ - fail("sockcreate should be empty\n"); + fail("sockcreate should be empty"); return -1; } if (output) { free(output); /* Same here, output should still be NULL. */ - fail("sockcreate should be empty\n"); + fail("sockcreate should be empty"); return -1; } diff --git a/test/zdtm/static/selinux01.c b/test/zdtm/static/selinux01.c index cbf145d2a..14e99c739 100644 --- a/test/zdtm/static/selinux01.c +++ b/test/zdtm/static/selinux01.c @@ -41,7 +41,7 @@ int setprofile(void) fd = open("/proc/self/attr/current", O_WRONLY); if (fd < 0) { - fail("Could not open /proc/self/attr/current\n"); + fail("Could not open /proc/self/attr/current"); return -1; } @@ -49,7 +49,7 @@ int setprofile(void) close(fd); if (len < 0) { - fail("Could not write context\n"); + fail("Could not write context"); return -1; } @@ -62,7 +62,7 @@ int set_sockcreate(void) fd = open("/proc/self/attr/sockcreate", O_WRONLY); if (fd < 0) { - fail("Could not open /proc/self/attr/sockcreate\n"); + fail("Could not open /proc/self/attr/sockcreate"); return -1; } @@ -70,7 +70,7 @@ int set_sockcreate(void) close(fd); if (len < 0) { - fail("Could not write context\n"); + fail("Could not write context"); return -1; } @@ -86,20 +86,20 @@ int check_sockcreate(void) fd = open("/proc/self/attr/sockcreate", O_RDONLY); if (fd < 0) { - fail("Could not open /proc/self/attr/sockcreate\n"); + fail("Could not open /proc/self/attr/sockcreate"); return -1; } len = read(fd, context, strlen(CONTEXT)); close(fd); if (len != strlen(CONTEXT)) { - fail("SELinux context has unexpected length %d, expected %zd\n", + fail("SELinux context has unexpected length %d, expected %zd", len, strlen(CONTEXT)); return -1; } if (strncmp(context, CONTEXT, strlen(CONTEXT)) != 0) { - fail("Wrong SELinux context %s expected %s\n", context, CONTEXT); + fail("Wrong SELinux context %s expected %s", context, CONTEXT); return -1; } @@ -117,14 +117,14 @@ int check_sockcreate_empty(void) free(output); /* sockcreate should be empty, if fscanf found something * it is wrong.*/ - fail("sockcreate should be empty\n"); + fail("sockcreate should be empty"); return -1; } if (output) { free(output); /* Same here, output should still be NULL. */ - fail("sockcreate should be empty\n"); + fail("sockcreate should be empty"); return -1; } @@ -164,11 +164,11 @@ int main(int argc, char **argv) memset(ctx, 0, 1024); /* Read out the socket label */ if (fgetxattr(sk, "security.selinux", ctx, 1024) == -1) { - fail("Reading xattr 'security.selinux' failed.\n"); + fail("Reading xattr 'security.selinux' failed."); return -1; } if (strncmp(ctx, CONTEXT, strlen(CONTEXT)) != 0) { - fail("Wrong SELinux context %s expected %s\n", ctx, CONTEXT); + fail("Wrong SELinux context %s expected %s", ctx, CONTEXT); return -1; } memset(ctx, 0, 1024); @@ -179,11 +179,11 @@ int main(int argc, char **argv) /* Read out the socket label again */ if (fgetxattr(sk, "security.selinux", ctx, 1024) == -1) { - fail("Reading xattr 'security.selinux' failed.\n"); + fail("Reading xattr 'security.selinux' failed."); return -1; } if (strncmp(ctx, CONTEXT, strlen(CONTEXT)) != 0) { - fail("Wrong SELinux context %s expected %s\n", ctx, CONTEXT); + fail("Wrong SELinux context %s expected %s", ctx, CONTEXT); return -1; } diff --git a/test/zdtm/static/sem.c b/test/zdtm/static/sem.c index 1db8f0082..257dd84ca 100644 --- a/test/zdtm/static/sem.c +++ b/test/zdtm/static/sem.c @@ -98,7 +98,7 @@ static int check_sem_by_id(int id, int num, int val) return -errno; } if (curr != val) { - fail("Sem has wrong value: %d instead of %d\n", curr, val); + fail("Sem has wrong value: %d instead of %d", curr, val); return -EFAULT; } return sem_test(id, lock, unlock, diff --git a/test/zdtm/static/session00.c b/test/zdtm/static/session00.c index 4a239e159..f65b3cdef 100644 --- a/test/zdtm/static/session00.c +++ b/test/zdtm/static/session00.c @@ -217,7 +217,7 @@ int main(int argc, char ** argv) err++; } if (!WIFEXITED(status) || WEXITSTATUS(status)) { - fail("The process with pid %d returns %d\n", pid, status); + fail("The process with pid %d returns %d", pid, status); err++; } } diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c index 084796ae2..850b22cc2 100644 --- a/test/zdtm/static/shm-mp.c +++ b/test/zdtm/static/shm-mp.c @@ -20,7 +20,7 @@ static void segfault(int signo) static int check_prot(char *ptr, char val, int prot) { if (signal(SIGSEGV, segfault) == SIG_ERR) { - fail("setting SIGSEGV handler failed: %m\n"); + fail("setting SIGSEGV handler failed: %m"); return -1; } @@ -30,29 +30,29 @@ static int check_prot(char *ptr, char val, int prot) return -1; } if (!(prot & PROT_READ)) { - fail("PROT_READ bypassed\n"); + fail("PROT_READ bypassed"); return -1; } } else /* we come here on return from SIGSEGV handler */ if (prot & PROT_READ) { - fail("PROT_READ rejected\n"); + fail("PROT_READ rejected"); return -1; } if (!sigsetjmp(segv_ret, 1)) { *ptr = val; if (!(prot & PROT_WRITE)) { - fail("PROT_WRITE bypassed\n"); + fail("PROT_WRITE bypassed"); return -1; } } else /* we come here on return from SIGSEGV handler */ if (prot & PROT_WRITE) { - fail("PROT_WRITE rejected\n"); + fail("PROT_WRITE rejected"); return -1; } if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) { - fail("restoring SIGSEGV handler failed: %m\n"); + fail("restoring SIGSEGV handler failed: %m"); return -1; } diff --git a/test/zdtm/static/shm.c b/test/zdtm/static/shm.c index 5ec0fd73e..7e7d9570b 100644 --- a/test/zdtm/static/shm.c +++ b/test/zdtm/static/shm.c @@ -138,14 +138,14 @@ int main(int argc, char **argv) ret = check_shm_id(shm, shmem_size); if (ret < 0) { - fail("ID check (1) failed\n"); + fail("ID check (1) failed"); fail_count++; goto out_shm; } ret = check_shm_key(key, shmem_size); if (ret < 0) { - fail("KEY check failed\n"); + fail("KEY check failed"); fail_count++; goto out_shm; } @@ -162,7 +162,7 @@ int main(int argc, char **argv) ret = shmctl(shm, IPC_RMID, NULL); if (ret < 0) { - fail("Failed (1) to destroy segment: %d\n", -errno); + fail("Failed (1) to destroy segment: %d", -errno); fail_count++; goto out_shm; } @@ -179,7 +179,7 @@ int main(int argc, char **argv) ret = check_shm_id(shm, shmem_size); if (ret < 0) { - fail("ID check (2) failed\n"); + fail("ID check (2) failed"); fail_count++; goto out_shm; } @@ -187,7 +187,7 @@ int main(int argc, char **argv) out_shm: ret = shmctl(shm, IPC_RMID, NULL); if (ret < 0) { - fail("Failed (2) to destroy segment: %d\n", -errno); + fail("Failed (2) to destroy segment: %d", -errno); fail_count++; } if (fail_count == 0) diff --git a/test/zdtm/static/sigpending.c b/test/zdtm/static/sigpending.c index ac2fdcf84..4d174588c 100644 --- a/test/zdtm/static/sigpending.c +++ b/test/zdtm/static/sigpending.c @@ -105,12 +105,12 @@ static void sig_handler(int signal, siginfo_t *info, void *data) crc = ~0; if (datachk((uint8_t *) siginf_body(info), _si_fields_sz, &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); return; } if (memcmp(info, src, siginfo_filled)) { - fail("Source and received info are differ\n"); + fail("Source and received info are differ"); return; } diff --git a/test/zdtm/static/sk-unix-mntns.c b/test/zdtm/static/sk-unix-mntns.c index 3e480db81..46376ff50 100644 --- a/test/zdtm/static/sk-unix-mntns.c +++ b/test/zdtm/static/sk-unix-mntns.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) task_waiter_init(&t); cwd = get_current_dir_name(); if (!cwd) { - fail("getcwd\n"); + fail("getcwd"); exit(1); } @@ -89,12 +89,12 @@ int main(int argc, char *argv[]) ret = bind(sk, (struct sockaddr *) &addr, addrlen); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } if (connect(csk, (struct sockaddr *) &addr, addrlen)) { - fail("connect\n"); + fail("connect"); exit(1); } @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) } if (strncmp(rbuf, sbuf, len)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } diff --git a/test/zdtm/static/sk-unix-rel.c b/test/zdtm/static/sk-unix-rel.c index 5b3e85289..a62a5c92d 100644 --- a/test/zdtm/static/sk-unix-rel.c +++ b/test/zdtm/static/sk-unix-rel.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) cwd = get_current_dir_name(); if (!cwd) { - fail("getcwd\n"); + fail("getcwd"); exit(1); } @@ -57,25 +57,25 @@ int main(int argc, char *argv[]) sock[0] = socket(AF_UNIX, SOCK_STREAM, 0); sock[1] = socket(AF_UNIX, SOCK_STREAM, 0); if (sock[0] < 0 || sock[1] < 0) { - fail("socket\n"); + fail("socket"); exit(1); } if (setsockopt(sock[0], SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)) < 0 || setsockopt(sock[1], SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int)) < 0) { - fail("setsockopt\n"); + fail("setsockopt"); exit(1); } ret = bind(sock[0], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } ret = listen(sock[0], 16); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) test_waitsig(); if (connect(sock[1], (struct sockaddr *) &addr, addrlen)) { - fail("connect\n"); + fail("connect"); exit(1); } @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) read(ret, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream : '%s'\n", buf); diff --git a/test/zdtm/static/sk-unix-unconn.c b/test/zdtm/static/sk-unix-unconn.c index 72d1348a8..91e3d433b 100644 --- a/test/zdtm/static/sk-unix-unconn.c +++ b/test/zdtm/static/sk-unix-unconn.c @@ -45,7 +45,7 @@ int main(int argc, char ** argv) ret = bind(sk, (struct sockaddr *) &addr, addrlen); if (ret) { - fail("bind\n"); + fail("bind"); return 1; } diff --git a/test/zdtm/static/sock_peercred.c b/test/zdtm/static/sock_peercred.c index 46a3312c5..23c709bb5 100644 --- a/test/zdtm/static/sock_peercred.c +++ b/test/zdtm/static/sock_peercred.c @@ -115,7 +115,7 @@ int main(int argc, char **argv) if (ucred.pid != pid || ucred.gid != getuid() + UID_INC || ucred.gid != getgid() + GID_INC) { - fail("Wrong pid, uid or gid\n"); + fail("Wrong pid, uid or gid"); goto out; } diff --git a/test/zdtm/static/socket-raw.c b/test/zdtm/static/socket-raw.c index 9a359485d..7382bf7c4 100644 --- a/test/zdtm/static/socket-raw.c +++ b/test/zdtm/static/socket-raw.c @@ -383,7 +383,7 @@ int main(int argc, char *argv[]) ret = wait(&status); if (ret == -1 || !WIFEXITED(status) || WEXITSTATUS(status)) { kill(pid, SIGKILL); - fail("Failed waiting server\n"); + fail("Failed waiting server"); exit(1); } diff --git a/test/zdtm/static/socket-tcp-close-wait.c b/test/zdtm/static/socket-tcp-close-wait.c index 2efa89b17..3608e6b37 100644 --- a/test/zdtm/static/socket-tcp-close-wait.c +++ b/test/zdtm/static/socket-tcp-close-wait.c @@ -267,7 +267,7 @@ int main(int argc, char **argv) rcv_size = clean_sk_buf(fd); if (ret != rcv_size) { - fail("The child sent %d bytes, but the parent received %d bytes\n", ret, rcv_size); + fail("The child sent %d bytes, but the parent received %d bytes", ret, rcv_size); return 1; } @@ -278,7 +278,7 @@ int main(int argc, char **argv) /* == End of the final stage == */ if (ret != snd_size) { - fail("The parent sent %d bytes, but the child received %d bytes\n", snd_size, ret); + fail("The parent sent %d bytes, but the child received %d bytes", snd_size, ret); return 1; } diff --git a/test/zdtm/static/socket-tcp-close1.c b/test/zdtm/static/socket-tcp-close1.c index 1fefeea82..49a34a6ef 100644 --- a/test/zdtm/static/socket-tcp-close1.c +++ b/test/zdtm/static/socket-tcp-close1.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) test_waitsig(); if (check_socket_state(fd_s, TCP_LISTEN)) { - fail("Listen socket state is changed\n"); + fail("Listen socket state is changed"); close(fd_s); return 1; } diff --git a/test/zdtm/static/socket-tcp-closing.c b/test/zdtm/static/socket-tcp-closing.c index 23d49cc86..83b21e8ad 100644 --- a/test/zdtm/static/socket-tcp-closing.c +++ b/test/zdtm/static/socket-tcp-closing.c @@ -209,7 +209,7 @@ int main(int argc, char **argv) rcv_size = clean_sk_buf(fd); if (ret != rcv_size) { - fail("The child sent %d bytes, but the parent received %d bytes\n", ret, rcv_size); + fail("The child sent %d bytes, but the parent received %d bytes", ret, rcv_size); return 1; } @@ -234,7 +234,7 @@ int main(int argc, char **argv) } if (ret != snd_size) { - fail("The parent sent %d bytes, but the child received %d bytes\n", snd_size, ret); + fail("The parent sent %d bytes, but the child received %d bytes", snd_size, ret); return 1; } diff --git a/test/zdtm/static/socket-tcp-fin-wait1.c b/test/zdtm/static/socket-tcp-fin-wait1.c index 50da9c152..1264a5959 100644 --- a/test/zdtm/static/socket-tcp-fin-wait1.c +++ b/test/zdtm/static/socket-tcp-fin-wait1.c @@ -223,7 +223,7 @@ int main(int argc, char **argv) } if (ret != snd_size) { - fail("The parent sent %d bytes, but the child received %d bytes\n", snd_size, ret); + fail("The parent sent %d bytes, but the child received %d bytes", snd_size, ret); return 1; } diff --git a/test/zdtm/static/socket-tcp-listen.c b/test/zdtm/static/socket-tcp-listen.c index ab43fe01c..52d21d894 100644 --- a/test/zdtm/static/socket-tcp-listen.c +++ b/test/zdtm/static/socket-tcp-listen.c @@ -140,7 +140,7 @@ int main(int argc, char **argv) return 1; } if (val != 1) { - fail("SO_REUSEADDR are not set for %d\n", fd); + fail("SO_REUSEADDR are not set for %d", fd); return 1; } diff --git a/test/zdtm/static/socket-tcp-reuseport.c b/test/zdtm/static/socket-tcp-reuseport.c index 4cd1802f9..a085ab503 100644 --- a/test/zdtm/static/socket-tcp-reuseport.c +++ b/test/zdtm/static/socket-tcp-reuseport.c @@ -110,7 +110,7 @@ int main(int argc, char **argv) return 1; } if (val == 1) { - fail("SO_REUSEPORT is set for %d\n", fd); + fail("SO_REUSEPORT is set for %d", fd); return 1; } optlen = sizeof(val); @@ -119,7 +119,7 @@ int main(int argc, char **argv) return 1; } if (val != 1) { - fail("SO_REUSEPORT is not set for %d\n", fd); + fail("SO_REUSEPORT is not set for %d", fd); return 1; } diff --git a/test/zdtm/static/socket-tcp.c b/test/zdtm/static/socket-tcp.c index 5158fe348..80c2e7b3b 100644 --- a/test/zdtm/static/socket-tcp.c +++ b/test/zdtm/static/socket-tcp.c @@ -210,7 +210,7 @@ int main(int argc, char **argv) return 1; } if (val != 1) { - fail("SO_REUSEADDR are not set for %d\n", fd); + fail("SO_REUSEADDR are not set for %d", fd); return 1; } diff --git a/test/zdtm/static/socket-tcpbuf.c b/test/zdtm/static/socket-tcpbuf.c index f61f6a507..fbb4043f1 100644 --- a/test/zdtm/static/socket-tcpbuf.c +++ b/test/zdtm/static/socket-tcpbuf.c @@ -196,7 +196,7 @@ int main(int argc, char **argv) return 1; if (size != rcv_buf_size) { - fail("the received buffer contains only %d bytes (%d)\n", size, rcv_buf_size); + fail("the received buffer contains only %d bytes (%d)", size, rcv_buf_size); } rcv_size += size; @@ -300,19 +300,19 @@ int main(int argc, char **argv) ret = clean_sk_buf(fd, 0); if (ret != rcv_buf_size) { - fail("the received buffer contains only %d bytes (%d)\n", ret, rcv_buf_size); + fail("the received buffer contains only %d bytes (%d)", ret, rcv_buf_size); } rcv_size += ret; if (snd != rcv_size) { - fail("The child sent %d bytes, but the parent received %d bytes\n", rcv_buf_size, rcv_size); + fail("The child sent %d bytes, but the parent received %d bytes", rcv_buf_size, rcv_size); return 1; } read_safe(ctl_fd, &ret, sizeof(ret)); if (ret != snd_size) { - fail("The parent sent %d bytes, but the child received %d bytes\n", snd_size, ret); + fail("The parent sent %d bytes, but the child received %d bytes", snd_size, ret); return 1; } diff --git a/test/zdtm/static/socket_dgram_data.c b/test/zdtm/static/socket_dgram_data.c index 2f635b6e6..0f29af0ad 100644 --- a/test/zdtm/static/socket_dgram_data.c +++ b/test/zdtm/static/socket_dgram_data.c @@ -43,15 +43,15 @@ int main(int argc, char **argv) addrlen = sizeof(addr.sun_family) + sizeof(SK_SRV); if (bind(srv, (struct sockaddr *) &addr, addrlen)) { - fail("bind\n"); + fail("bind"); exit(1); } if (connect(clnt1, (struct sockaddr *) &addr, addrlen)) { - fail("connect\n"); + fail("connect"); exit(1); } if (connect(clnt2, (struct sockaddr *) &addr, addrlen)) { - fail("connect\n"); + fail("connect"); exit(1); } diff --git a/test/zdtm/static/socket_queues.c b/test/zdtm/static/socket_queues.c index 375b449e0..86e052db7 100644 --- a/test/zdtm/static/socket_queues.c +++ b/test/zdtm/static/socket_queues.c @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) test_init(argc, argv); if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair_s) == -1) { - fail("socketpair\n"); + fail("socketpair"); exit(1); } @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) write(ssk_pair_s[1], SK_DATA_S1, sizeof(SK_DATA_S1)); if (socketpair(AF_UNIX, SOCK_DGRAM, 0, ssk_pair_d) == -1) { - fail("socketpair\n"); + fail("socketpair"); exit(1); } @@ -57,48 +57,48 @@ int main(int argc, char *argv[]) read(ssk_pair_s[1], buf_left, strlen(SK_DATA_S1) + 1); if (strcmp(buf_left, SK_DATA_S1)) { - fail("SK_DATA_S2: '%s\n", SK_DATA_S1); + fail("SK_DATA_S2: '%s", SK_DATA_S1); exit(1); } read(ssk_pair_s[1], buf_right, strlen(SK_DATA_S2) + 1); if (strcmp(buf_right, SK_DATA_S2)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream1 : '%s' '%s'\n", buf_left, buf_right); read(ssk_pair_s[0], buf_left, strlen(SK_DATA_S2) + 1); if (strcmp(buf_left, SK_DATA_S2)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } read(ssk_pair_s[0], buf_right, strlen(SK_DATA_S1) + 1); if (strcmp(buf_right, SK_DATA_S1)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream2 : '%s' '%s'\n", buf_left, buf_right); read(ssk_pair_d[1], buf_left, strlen(SK_DATA_D1) + 1); if (strcmp(buf_left, SK_DATA_D1)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } read(ssk_pair_d[1], buf_right, strlen(SK_DATA_D2) + 1); if (strcmp(buf_right, SK_DATA_D2)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram1 : '%s' '%s'\n", buf_left, buf_right); read(ssk_pair_d[0], buf_left, strlen(SK_DATA_D2) + 1); if (strcmp(buf_left, SK_DATA_D2)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } read(ssk_pair_d[0], buf_right,strlen(SK_DATA_D1) + 1); if (strcmp(buf_right, SK_DATA_D1)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram2 : '%s' '%s'\n", buf_left, buf_right); diff --git a/test/zdtm/static/socket_snd_addr.c b/test/zdtm/static/socket_snd_addr.c index 7e5376e72..89a0a1762 100644 --- a/test/zdtm/static/socket_snd_addr.c +++ b/test/zdtm/static/socket_snd_addr.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) addrlen = sizeof(addr.sun_family) + sizeof(SK_SRV); if (bind(srv, (struct sockaddr *) &addr, addrlen)) { - fail("bind\n"); + fail("bind"); exit(1); } @@ -59,14 +59,14 @@ int main(int argc, char **argv) addrlen = sizeof(addr.sun_family) + sizeof(SK_NAME); if (bind(clnt, (struct sockaddr *) &addr, addrlen)) { - fail("bind\n"); + fail("bind"); exit(1); } memcpy(addr.sun_path, SK_SRV, sizeof(SK_SRV)); addrlen = sizeof(addr.sun_family) + sizeof(SK_SRV); if (connect(clnt, (struct sockaddr *) &addr, addrlen)) { - fail("connect\n"); + fail("connect"); exit(1); } diff --git a/test/zdtm/static/sockets00.c b/test/zdtm/static/sockets00.c index 41c64c717..4aa8ae098 100644 --- a/test/zdtm/static/sockets00.c +++ b/test/zdtm/static/sockets00.c @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) cwd = get_current_dir_name(); if (!cwd) { - fail("getcwd\n"); + fail("getcwd"); exit(1); } @@ -62,13 +62,13 @@ int main(int argc, char *argv[]) ssk_icon[1] = socket(AF_UNIX, SOCK_STREAM, 0); ssk_icon[2] = socket(AF_UNIX, SOCK_STREAM, 0); if (ssk_icon[0] < 0 || ssk_icon[1] < 0 || ssk_icon[2] < 0) { - fail("socket\n"); + fail("socket"); exit(1); } ret = bind(ssk_icon[0], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } @@ -86,13 +86,13 @@ int main(int argc, char *argv[]) ret = listen(ssk_icon[0], 16); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } ret = connect(ssk_icon[2], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("connect\n"); + fail("connect"); exit(1); } @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) ret = connect(ssk_icon[1], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("connect\n"); + fail("connect"); exit(1); } @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) } if (st_b.st_mode != st_a.st_mode) { - fail("The file permissions for %s were changed %o %o\n", + fail("The file permissions for %s were changed %o %o", path, st_b.st_mode, st_a.st_mode); exit(1); } @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) ret = accept(ssk_icon[0], NULL, NULL); if (ret < 0) { - fail("accept\n"); + fail("accept"); exit(1); } @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) write(ssk_icon[1], SK_DATA, sizeof(SK_DATA)); read(ret, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream1 : '%s'\n", buf); @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) write(ssk_icon[2], SK_DATA, sizeof(SK_DATA)); read(ssk_icon[3], &buf, sizeof(buf)); if (strcmp(buf, SK_DATA)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream2 : '%s'\n", buf); diff --git a/test/zdtm/static/sockets02.c b/test/zdtm/static/sockets02.c index ed4afbbe0..5819e76af 100644 --- a/test/zdtm/static/sockets02.c +++ b/test/zdtm/static/sockets02.c @@ -26,12 +26,12 @@ int main(int argc, char *argv[]) data = (char)lrand48(); if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) { - fail("socketpair\n"); + fail("socketpair"); exit(1); } if (write(ssk_pair[1], &data, sizeof(data)) != sizeof(data)) { - fail("write\n"); + fail("write"); exit(1); } diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c index e4c647d4c..ce668b7f8 100644 --- a/test/zdtm/static/sockets03.c +++ b/test/zdtm/static/sockets03.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) cwd = get_current_dir_name(); if (!cwd) { - fail("getcwd\n"); + fail("getcwd"); exit(1); } @@ -55,31 +55,31 @@ int main(int argc, char *argv[]) sk[0] = socket(AF_UNIX, SOCK_STREAM, 0); sk[1] = socket(AF_UNIX, SOCK_STREAM, 0); if (sk[0] < 0 || sk[1] < 0) { - fail("socket\n"); + fail("socket"); exit(1); } ret = bind(sk[0], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("bind\n"); + fail("bind"); exit(1); } ret = listen(sk[0], 16); if (ret) { - fail("listen\n"); + fail("listen"); exit(1); } ret = shutdown(sk[1], SHUT_RD); if (ret) { - fail("shutdown\n"); + fail("shutdown"); exit(1); } ret = connect(sk[1], (struct sockaddr *) &addr, addrlen); if (ret) { - fail("connect\n"); + fail("connect"); exit(1); } @@ -93,22 +93,22 @@ int main(int argc, char *argv[]) test_waitsig(); if (write(sk[1], SK_DATA, sizeof(SK_DATA)) < 0) { - fail("write\n"); + fail("write"); exit(1); } if (read(sk[2], &buf, sizeof(buf)) < 0) { - fail("read\n"); + fail("read"); exit(1); } if (strncmp(buf, SK_DATA, sizeof(SK_DATA))) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } if (write(sk[2], SK_DATA, sizeof(SK_DATA)) >= 0) { - fail("successful write to shutdown receiver\n"); + fail("successful write to shutdown receiver"); exit(1); } diff --git a/test/zdtm/static/sockets_dgram.c b/test/zdtm/static/sockets_dgram.c index f135a3bbf..35ee88244 100644 --- a/test/zdtm/static/sockets_dgram.c +++ b/test/zdtm/static/sockets_dgram.c @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) (struct sockaddr *) &name_bound, sizeof(name_bound)); read(sk_dgram_bound_server, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_BOUND)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-bound : '%s'\n", buf); @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) write(sk_dgram_conn_client, SK_DATA_CONN, sizeof(SK_DATA_CONN)); read(sk_dgram_conn_server, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_CONN)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-conn : '%s'\n", buf); @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) write(sk_dgram_bound_conn, SK_DATA_BOUND_CONN, sizeof(SK_DATA_BOUND_CONN)); read(sk_dgram_bound_conn, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_BOUND_CONN)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-bound-conn : '%s'\n", buf); @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) (struct sockaddr *) &name_bound, sizeof(name_bound)); read(sk_dgram_bound_server, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_BOUND)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-bound : '%s'\n", buf); @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) write(sk_dgram_conn_client, SK_DATA_CONN, sizeof(SK_DATA_CONN)); read(sk_dgram_conn_server, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_CONN)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-conn : '%s'\n", buf); @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) write(sk_dgram_bound_conn, SK_DATA_BOUND_CONN, sizeof(SK_DATA_BOUND_CONN)); read(sk_dgram_bound_conn, &buf, sizeof(buf)); if (strcmp(buf, SK_DATA_BOUND_CONN)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("dgram-bound-conn : '%s'\n", buf); diff --git a/test/zdtm/static/sockets_spair.c b/test/zdtm/static/sockets_spair.c index ed9ffa94f..a67cdb312 100644 --- a/test/zdtm/static/sockets_spair.c +++ b/test/zdtm/static/sockets_spair.c @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) test_init(argc, argv); if (socketpair(AF_UNIX, SOCK_STREAM, 0, ssk_pair) == -1) { - fail("socketpair\n"); + fail("socketpair"); exit(1); } @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) write(ssk_pair[0], SK_DATA, sizeof(SK_DATA)); read(ssk_pair[1], &buf, sizeof(buf)); if (strcmp(buf, SK_DATA)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream : '%s'\n", buf); @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) write(ssk_pair[0], SK_DATA, sizeof(SK_DATA)); read(ssk_pair[1], &buf, sizeof(buf)); if (strcmp(buf, SK_DATA)) { - fail("data corrupted\n"); + fail("data corrupted"); exit(1); } test_msg("stream : '%s'\n", buf); diff --git a/test/zdtm/static/sse00.c b/test/zdtm/static/sse00.c index 0c04aba1b..c2d601948 100644 --- a/test/zdtm/static/sse00.c +++ b/test/zdtm/static/sse00.c @@ -78,7 +78,7 @@ int main(int argc, char **argv) finish(res2); if (memcmp((uint8_t *) res1, (uint8_t *) res2, sizeof(res1))) - fail("results differ\n"); + fail("results differ"); else pass(); #else diff --git a/test/zdtm/static/sse20.c b/test/zdtm/static/sse20.c index 912528b42..1958eedfa 100644 --- a/test/zdtm/static/sse20.c +++ b/test/zdtm/static/sse20.c @@ -78,7 +78,7 @@ int main(int argc, char **argv) finish(res2); if (memcmp((uint8_t *) res1, (uint8_t *) res2, sizeof(res1))) - fail("results differ\n"); + fail("results differ"); else pass(); #else diff --git a/test/zdtm/static/thread_different_uid_gid.c b/test/zdtm/static/thread_different_uid_gid.c index e229d91ed..4344654e7 100644 --- a/test/zdtm/static/thread_different_uid_gid.c +++ b/test/zdtm/static/thread_different_uid_gid.c @@ -95,7 +95,7 @@ int main(int argc, char **argv) task_waiter_init(&t); if (getuid() != 0) { - fail("Test is expected to be run with root privileges\n"); + fail("Test is expected to be run with root privileges"); exit(1); } diff --git a/test/zdtm/static/umask00.c b/test/zdtm/static/umask00.c index 1157f0d08..5acf5a39b 100644 --- a/test/zdtm/static/umask00.c +++ b/test/zdtm/static/umask00.c @@ -21,7 +21,7 @@ int main(int argc, char **argv) mask2 = umask(0); if (mask != mask2) - fail("mask changed: %o != %o\n", mask, mask2); + fail("mask changed: %o != %o", mask, mask2); else pass(); diff --git a/test/zdtm/static/unhashed_proc.c b/test/zdtm/static/unhashed_proc.c index 1fdc38f67..68132aac2 100644 --- a/test/zdtm/static/unhashed_proc.c +++ b/test/zdtm/static/unhashed_proc.c @@ -58,16 +58,16 @@ int main(int argc, char ** argv) test_waitsig(); if (getcwd(cwd2, sizeof(cwd2))) { - fail("successful getcwd: %s\n", cwd2); + fail("successful getcwd: %s", cwd2); exit(1); } else if (errno != ENOENT) { - fail("wrong errno: %m\n"); + fail("wrong errno: %m"); exit(1); } len = readlink("/proc/self/cwd", cwd2, sizeof(cwd2)-1); if (len < 0) { - fail("can't read cwd symlink %m\n"); + fail("can't read cwd symlink %m"); exit(1); } cwd2[len] = 0; diff --git a/test/zdtm/static/unlink_fstat00.c b/test/zdtm/static/unlink_fstat00.c index 79ea90274..1c196ba43 100644 --- a/test/zdtm/static/unlink_fstat00.c +++ b/test/zdtm/static/unlink_fstat00.c @@ -152,13 +152,13 @@ int main(int argc, char ** argv) goto failed; } if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto failed; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto failed; } diff --git a/test/zdtm/static/unlink_fstat02.c b/test/zdtm/static/unlink_fstat02.c index 1ffeffd73..3d75db3e0 100644 --- a/test/zdtm/static/unlink_fstat02.c +++ b/test/zdtm/static/unlink_fstat02.c @@ -82,7 +82,7 @@ int main(int argc, char ** argv) } if ((fst.st_dev != fst2.st_dev) || (fst.st_ino != fst2.st_ino)) { - fail("files differ after restore\n"); + fail("files differ after restore"); goto failed; } diff --git a/test/zdtm/static/unlink_fstat03.c b/test/zdtm/static/unlink_fstat03.c index b31ef1993..64d069970 100644 --- a/test/zdtm/static/unlink_fstat03.c +++ b/test/zdtm/static/unlink_fstat03.c @@ -75,12 +75,12 @@ int main(int argc, char ** argv) /* An NFS mount is restored with another st_dev */ if (fsst.f_type != NFS_SUPER_MAGIC && fst.st_dev != fst2.st_dev) { - fail("files differ after restore\n"); + fail("files differ after restore"); goto failed; } if (fst.st_ino != fst2.st_ino) { - fail("files differ after restore\n"); + fail("files differ after restore"); goto failed; } diff --git a/test/zdtm/static/uptime_grow.c b/test/zdtm/static/uptime_grow.c index 6d99509ca..ce262c4fc 100644 --- a/test/zdtm/static/uptime_grow.c +++ b/test/zdtm/static/uptime_grow.c @@ -35,7 +35,7 @@ int main(int argc, char **argv) if (!tv_ge(&tm, &tm_old)) { diff_nsec = (tm_old.tv_sec - tm.tv_sec) * 1.0E9 +\ (tm_old.tv_nsec - tm.tv_nsec); - fail("clock step backward for %e nsec\n", diff_nsec); + fail("clock step backward for %e nsec", diff_nsec); exit(1); } tm_old = tm; diff --git a/test/zdtm/static/wait00.c b/test/zdtm/static/wait00.c index f16505c0f..7248d41c0 100644 --- a/test/zdtm/static/wait00.c +++ b/test/zdtm/static/wait00.c @@ -33,24 +33,24 @@ int main(int argc, char ** argv) test_waitsig(); if (kill(pid, SIGTERM)) { - fail("terminating the child failed: %m\n"); + fail("terminating the child failed: %m"); goto out; } if (wait(&ret) != pid) { - fail("wait() returned wrong pid: %m\n"); + fail("wait() returned wrong pid: %m"); goto out; } if (WIFEXITED(ret)) { ret = WEXITSTATUS(ret); if (ret) { - fail("child exited with nonzero code %d (%s)\n", ret, strerror(ret)); + fail("child exited with nonzero code %d (%s)", ret, strerror(ret)); goto out; } } if (WIFSIGNALED(ret)) { - fail("child exited on unexpected signal %d\n", WTERMSIG(ret)); + fail("child exited on unexpected signal %d", WTERMSIG(ret)); goto out; } diff --git a/test/zdtm/static/write_read00.c b/test/zdtm/static/write_read00.c index 1648e3546..c3fc5b18b 100644 --- a/test/zdtm/static/write_read00.c +++ b/test/zdtm/static/write_read00.c @@ -39,18 +39,18 @@ int main(int argc, char ** argv) fd = open(filename, O_RDONLY); if (fd < 0) { - fail("can't open %s: %m\n", filename); + fail("can't open %s: %m", filename); exit(1); } if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } diff --git a/test/zdtm/static/write_read01.c b/test/zdtm/static/write_read01.c index 0d4176742..b556c0ba5 100644 --- a/test/zdtm/static/write_read01.c +++ b/test/zdtm/static/write_read01.c @@ -52,13 +52,13 @@ int main(int argc, char ** argv) /* recover reading */ if (read(fd, buf + len, sizeof(buf) - len) != (sizeof(buf) - len)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } diff --git a/test/zdtm/static/write_read02.c b/test/zdtm/static/write_read02.c index 0a8055805..4100affa8 100644 --- a/test/zdtm/static/write_read02.c +++ b/test/zdtm/static/write_read02.c @@ -50,7 +50,7 @@ int main(int argc, char ** argv) test_waitsig(); if (write(fd, buf + len, sizeof(buf) - len) != (sizeof(buf) - len)) { - fail("can't write %s: %m\n", filename); + fail("can't write %s: %m", filename); goto out; } @@ -58,18 +58,18 @@ int main(int argc, char ** argv) fd = open(filename, O_RDONLY); if (fd < 0) { - fail("can't open %s: %m\n", filename); + fail("can't open %s: %m", filename); return 1; } if (read(fd, buf, full_len) != full_len) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); return 1; } crc = ~0; if (datachk(buf, full_len, &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); return 1; } diff --git a/test/zdtm/static/write_read10.c b/test/zdtm/static/write_read10.c index 4e8a67e84..b572d51d7 100644 --- a/test/zdtm/static/write_read10.c +++ b/test/zdtm/static/write_read10.c @@ -72,51 +72,51 @@ int main(int argc, char ** argv) test_waitsig(); if (kill(pid, SIGTERM)) { - fail("terminating the child failed: %m\n"); + fail("terminating the child failed: %m"); goto out; } if (wait(&ret) != pid) { - fail("wait() returned wrong pid %d: %m\n", pid); + fail("wait() returned wrong pid %d: %m", pid); goto out; } if (WIFEXITED(ret)) { ret = WEXITSTATUS(ret); if (ret) { - fail("child exited with nonzero code %d (%s)\n", ret, strerror(ret)); + fail("child exited with nonzero code %d (%s)", ret, strerror(ret)); goto out; } } if (WIFSIGNALED(ret)) { - fail("child exited on unexpected signal %d\n", WTERMSIG(ret)); + fail("child exited on unexpected signal %d", WTERMSIG(ret)); goto out; } if (lseek(fd, 0, SEEK_SET) < 0) { - fail("lseeking to the beginning of file failed: %m\n"); + fail("lseeking to the beginning of file failed: %m"); goto out; } if (read(fd, buf, sizeof(buf)) != sizeof(buf)) { - fail("can't read %s: %m\n", filename); + fail("can't read %s: %m", filename); goto out; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("CRC mismatch\n"); + fail("CRC mismatch"); goto out; } if (close(fd)) { - fail("close failed: %m\n"); + fail("close failed: %m"); goto out_noclose; } if (unlink(filename) != -1 || errno != ENOENT) { - fail("file %s should have been deleted before migration: unlink: %m\n", + fail("file %s should have been deleted before migration: unlink: %m", filename); goto out_noclose; } diff --git a/test/zdtm/static/zombie00.c b/test/zdtm/static/zombie00.c index df12a7046..def2c8892 100644 --- a/test/zdtm/static/zombie00.c +++ b/test/zdtm/static/zombie00.c @@ -78,28 +78,28 @@ int main(int argc, char ** argv) for (i = 0; i < NR_ZOMBIES; i++) { if (waitpid(zombie[i].pid, &status, 0) != zombie[i].pid) { - fail("Exit with wrong pid\n"); + fail("Exit with wrong pid"); exit(1); } if (zombie[i].exited) { if (!WIFEXITED(status)) { - fail("Not exited, but should (%d)\n", zombie[i].pid); + fail("Not exited, but should (%d)", zombie[i].pid); exit(1); } if (WEXITSTATUS(status) != zombie[i].exitcode) { - fail("Exit with wrong status (%d)\n", zombie[i].pid); + fail("Exit with wrong status (%d)", zombie[i].pid); exit(1); } } else { if (!WIFSIGNALED(status)) { - fail("Not killed, but should (%d)\n", zombie[i].pid); + fail("Not killed, but should (%d)", zombie[i].pid); exit(1); } if (WTERMSIG(status) != zombie[i].exitcode) { - fail("Killed with wrong signal (%d)\n", zombie[i].pid); + fail("Killed with wrong signal (%d)", zombie[i].pid); exit(1); } } diff --git a/test/zdtm/transition/epoll.c b/test/zdtm/transition/epoll.c index 6ab436889..578322b3e 100644 --- a/test/zdtm/transition/epoll.c +++ b/test/zdtm/transition/epoll.c @@ -82,7 +82,7 @@ static void run_child(int num) if (write(fd, buf, buf_size) < 0 && (!stop /* signal SIGUSR2 NOT received */ || (errno != EINTR && errno != EPIPE))) { - fail("child write: %m\n"); + fail("child write: %m"); rv = WRITEERROR; goto out; } @@ -178,17 +178,17 @@ int main(int argc, char **argv) for (i = 0; i < scale; i++) { kill(pids[i], SIGUSR2); if (waitpid(pids[i], &rv, 0) < 0) { - fail("waitpid error: %m\n"); + fail("waitpid error: %m"); counter++; continue; } else { rv = WEXITSTATUS(rv); if (rv < MAX_EXIT_CODE && rv > SUCCESS) { - fail("Child failed: %s (%d)\n", + fail("Child failed: %s (%d)", child_fail_reason[rv], rv); counter++; } else if (rv != SUCCESS) { - fail("Unknown exitcode from child: %d\n", rv); + fail("Unknown exitcode from child: %d", rv); counter++; } } diff --git a/test/zdtm/transition/fifo_dyn.c b/test/zdtm/transition/fifo_dyn.c index 62ebce4f3..2cdb48f46 100644 --- a/test/zdtm/transition/fifo_dyn.c +++ b/test/zdtm/transition/fifo_dyn.c @@ -104,7 +104,7 @@ int main(int argc, char **argv) if (errno == EINTR) continue; else { - fail("write failed: %m\n"); + fail("write failed: %m"); ret = 1; break; } @@ -120,13 +120,13 @@ int main(int argc, char **argv) continue; if (len > 0) { - fail("read failed: %m\n"); + fail("read failed: %m"); ret = 1; break; } if (memcmp(buf, rbuf, wlen)) { - fail("data mismatch\n"); + fail("data mismatch"); ret = 1; break; } @@ -138,7 +138,7 @@ int main(int argc, char **argv) wait(&chret); chret = WEXITSTATUS(chret); if (chret) { - fail("child exited with non-zero code %d (%s)\n", + fail("child exited with non-zero code %d (%s)", chret, strerror(chret)); return 1; } diff --git a/test/zdtm/transition/fifo_loop.c b/test/zdtm/transition/fifo_loop.c index b06592586..2af8ab24f 100644 --- a/test/zdtm/transition/fifo_loop.c +++ b/test/zdtm/transition/fifo_loop.c @@ -146,7 +146,7 @@ int main(int argc, char **argv) if (errno == EINTR) continue; else { - fail("write failed: %m\n"); + fail("write failed: %m"); ret = 1; break; } @@ -163,13 +163,13 @@ int main(int argc, char **argv) } if (len > 0) { - fail("read failed: %m\n"); + fail("read failed: %m"); ret = 1; break; } if (memcmp(buf, rbuf, wlen)) { - fail("data mismatch\n"); + fail("data mismatch"); ret = 1; break; } @@ -180,7 +180,7 @@ int main(int argc, char **argv) test_waitsig(); /* even if failed, wait for migration to complete */ if (kill(0, SIGTERM)) { - fail("failed to send SIGTERM to my process group: %m\n"); + fail("failed to send SIGTERM to my process group: %m"); return 1; /* shouldn't wait() in this case */ } close(readfd); @@ -188,14 +188,14 @@ int main(int argc, char **argv) for (i = 1; i < num_procs; i++) { /* i = 0 - parent */ int chret; if (waitpid(pids[i], &chret, 0) < 0) { - fail("waitpid error: %m\n"); + fail("waitpid error: %m"); ret = 1; continue; } chret = WEXITSTATUS(chret); if (chret) { - fail("child %d exited with non-zero code %d (%s)\n", + fail("child %d exited with non-zero code %d (%s)", i, chret, strerror(chret)); ret = 1; continue; diff --git a/test/zdtm/transition/file_read.c b/test/zdtm/transition/file_read.c index 5d6e4dbba..9b5670c65 100644 --- a/test/zdtm/transition/file_read.c +++ b/test/zdtm/transition/file_read.c @@ -217,21 +217,21 @@ int main(int argc, char **argv) killall(); for (i = 0; i < scale; i++) { if (waitpid(pids[i], &rv, 0) == -1) { - fail("Can't wipe up the kid\n"); + fail("Can't wipe up the kid"); counter++; continue; } if (!WIFEXITED(rv)) { - fail("Kid was killed\n"); + fail("Kid was killed"); counter++; } else { rv = WEXITSTATUS(rv); if (rv < MAX_EXIT_CODE_VAL && rv > SUCCESS) { - fail("Kid failed: %s (%d)\n", + fail("Kid failed: %s (%d)", kids_fail_reasons[rv], rv); counter++; } else if (rv != SUCCESS) { - fail("Unknown exitcode from kid: %d\n", rv); + fail("Unknown exitcode from kid: %d", rv); counter++; } } diff --git a/test/zdtm/transition/lazy-thp.c b/test/zdtm/transition/lazy-thp.c index a0cf33041..01075d773 100644 --- a/test/zdtm/transition/lazy-thp.c +++ b/test/zdtm/transition/lazy-thp.c @@ -29,7 +29,7 @@ int main(int argc, char ** argv) mem = malloc(PAGE_SIZE * N_PAGES); org = malloc(PAGE_SIZE); if (!mem || !org) { - fail("malloc failed\n"); + fail("malloc failed"); exit(1); } @@ -48,7 +48,7 @@ int main(int argc, char ** argv) org[128] = (count % 2 == 0) ? count : 0x42; if (memcmp(org, m, PAGE_SIZE)) { - fail("memory corruption\n"); + fail("memory corruption"); return 1; } } diff --git a/test/zdtm/transition/pipe_loop00.c b/test/zdtm/transition/pipe_loop00.c index 01964c618..99fa79914 100644 --- a/test/zdtm/transition/pipe_loop00.c +++ b/test/zdtm/transition/pipe_loop00.c @@ -113,7 +113,7 @@ int main(int argc, char **argv) if (errno == EINTR) continue; else { - fail("write failed\n"); + fail("write failed"); ret = 1; break; } @@ -129,13 +129,13 @@ int main(int argc, char **argv) continue; if (len > 0) { - fail("read failed: %m\n"); + fail("read failed: %m"); ret = 1; break; } if (memcmp(buf, rbuf, wlen)) { - fail("data mismatch\n"); + fail("data mismatch"); ret = 1; break; } @@ -146,21 +146,21 @@ int main(int argc, char **argv) test_waitsig(); /* even if failed, wait for migration to complete */ if (kill(0, SIGTERM)) { - fail("failed to send SIGTERM to my process group: %m\n"); + fail("failed to send SIGTERM to my process group: %m"); goto out; /* shouldn't wait() in this case */ } for (i = 1; i < num_procs; i++) { /* i = 0 - parent */ int chret; if (wait(&chret) < 0) { - fail("can't wait for a child: %m\n"); + fail("can't wait for a child: %m"); ret = 1; continue; } chret = WEXITSTATUS(chret); if (chret) { - fail("child %d exited with non-zero code %d (%s)\n", + fail("child %d exited with non-zero code %d (%s)", i, chret, strerror(chret)); ret = 1; continue; diff --git a/test/zdtm/transition/pipe_shared00.c b/test/zdtm/transition/pipe_shared00.c index 64708d9f8..9fd261934 100644 --- a/test/zdtm/transition/pipe_shared00.c +++ b/test/zdtm/transition/pipe_shared00.c @@ -102,7 +102,7 @@ int main(int argc, char **argv) while(test_go()) if (write(pipes[1], buf, sizeof(buf)) < 0 && (errno != EINTR || test_go())) { /* only SIGTERM may stop us */ - fail("write failed: %m\n"); + fail("write failed: %m"); ret = 1; break; } @@ -111,21 +111,21 @@ int main(int argc, char **argv) test_waitsig(); /* even if failed, wait for migration to complete */ if (kill(0, SIGTERM)) { - fail("failed to send SIGTERM to my process group: %m\n"); + fail("failed to send SIGTERM to my process group: %m"); goto out; /* shouldn't wait() in this case */ } for (i = 1; i < num_procs; i++) { /* i = 0 - parent */ int chret; if (wait(&chret) < 0) { - fail("can't wait for a child: %m\n"); + fail("can't wait for a child: %m"); ret = 1; continue; } chret = WEXITSTATUS(chret); if (chret) { - fail("child exited with non-zero code %d (%s)\n", + fail("child exited with non-zero code %d (%s)", chret, strerror(chret)); ret = 1; continue; diff --git a/test/zdtm/transition/shmem.c b/test/zdtm/transition/shmem.c index 56b0f678b..39ccfbe9b 100644 --- a/test/zdtm/transition/shmem.c +++ b/test/zdtm/transition/shmem.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) } if (status != *sum) { - fail("checksum mismatch: %x %x\n", status, *sum); + fail("checksum mismatch: %x %x", status, *sum); return 1; } diff --git a/test/zdtm/transition/socket_loop00.c b/test/zdtm/transition/socket_loop00.c index 1d7097bb9..ef9ab56d4 100644 --- a/test/zdtm/transition/socket_loop00.c +++ b/test/zdtm/transition/socket_loop00.c @@ -115,7 +115,7 @@ int main(int argc, char **argv) if (errno == EINTR) continue; else { - fail("write failed\n"); + fail("write failed"); ret = 1; break; } @@ -131,13 +131,13 @@ int main(int argc, char **argv) continue; if (len > 0) { - fail("read failed: %m\n"); + fail("read failed: %m"); ret = 1; break; } if (memcmp(buf, rbuf, wlen)) { - fail("data mismatch\n"); + fail("data mismatch"); ret = 1; break; } @@ -150,29 +150,29 @@ int main(int argc, char **argv) * has been received. Thus, send signal before closing parent fds. */ if (kill(0, SIGTERM)) { - fail("failed to send SIGTERM to my process group: %m\n"); + fail("failed to send SIGTERM to my process group: %m"); goto out; /* shouldn't wait() in this case */ } if (close(out)) - fail("Failed to close parent fd 'out': %m\n"); + fail("Failed to close parent fd 'out': %m"); /* If last child in the chain (from whom we read data) receives signal * after parent has finished reading but before calling write(2), this * child can block forever. To avoid this, close 'in' fd. */ if (close(in)) - fail("failed to close parent fd 'in': %m\n"); + fail("failed to close parent fd 'in': %m"); for (i = 1; i < num_procs; i++) { /* i = 0 - parent */ int chret; if (wait(&chret) < 0) { - fail("can't wait for a child: %m\n"); + fail("can't wait for a child: %m"); ret = 1; continue; } chret = WEXITSTATUS(chret); if (chret) { - fail("child %d exited with non-zero code %d (%s)\n", + fail("child %d exited with non-zero code %d (%s)", i, chret, strerror(chret)); ret = 1; continue; diff --git a/test/zdtm/transition/unix_sock.c b/test/zdtm/transition/unix_sock.c index 64a4919dc..1bcd538cc 100644 --- a/test/zdtm/transition/unix_sock.c +++ b/test/zdtm/transition/unix_sock.c @@ -155,7 +155,7 @@ static int child(void) (errno != EINTR && errno != EPIPE && \ errno != ECONNRESET))) { ret = errno; - fail("child write: %m\n"); + fail("child write: %m"); goto out; } } @@ -246,7 +246,7 @@ out: test_waitsig(); if (kill(0, SIGTERM)) { - fail("failed to send SIGTERM to my process group: %m\n"); + fail("failed to send SIGTERM to my process group: %m"); goto cleanup; /* shouldn't wait() in this case */ } @@ -259,16 +259,16 @@ out: * (not yet delivered), then called write(), blocking forever. */ if(close(child_desc[nproc].sock)) - fail("Can't close server socket: %m\n"); + fail("Can't close server socket: %m"); if (wait(&chret) < 0) { - fail("can't wait for a child: %m\n"); + fail("can't wait for a child: %m"); goto cleanup; } chret = WEXITSTATUS(chret); if (chret) { - fail("child exited with non-zero code %d (%s)\n", + fail("child exited with non-zero code %d (%s)", chret, strerror(chret)); goto cleanup; } |