summaryrefslogtreecommitdiff
path: root/tests/kernel
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2020-02-10 16:51:48 +0000
committerriastradh <riastradh@NetBSD.org>2020-02-10 16:51:48 +0000
commit5cd7ba123aadf96b0fb1b5d02489fdefc2aaf72e (patch)
tree89df032de56cb7d214ccbe92080375c471b6bb71 /tests/kernel
parent836d879a6aaa0ed6b0bc0bc1db0aa52a218e51b1 (diff)
Show errno on failure.
Diffstat (limited to 'tests/kernel')
-rw-r--r--tests/kernel/t_kauth_pr_47598.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/kernel/t_kauth_pr_47598.c b/tests/kernel/t_kauth_pr_47598.c
index f54b289974d..41c95c36983 100644
--- a/tests/kernel/t_kauth_pr_47598.c
+++ b/tests/kernel/t_kauth_pr_47598.c
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2013\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_kauth_pr_47598.c,v 1.3 2014/04/28 08:34:16 martin Exp $");
+__RCSID("$NetBSD: t_kauth_pr_47598.c,v 1.4 2020/02/10 16:51:48 riastradh Exp $");
#include <errno.h>
#include <unistd.h>
@@ -120,21 +120,23 @@ ATF_TC_BODY(kauth_curtain, tc)
* create a socket and bind it to some arbitray free port
*/
s = socket(PF_INET, SOCK_STREAM|SOCK_NONBLOCK, 0);
- ATF_REQUIRE(s != -1);
+ ATF_REQUIRE_MSG(s != -1, "socket: %d", errno);
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_len = sizeof(sa);
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
- ATF_REQUIRE(bind(s, (struct sockaddr *)&sa, sizeof(sa))==0);
- ATF_REQUIRE(listen(s, 16)==0);
+ ATF_REQUIRE_MSG(bind(s, (struct sockaddr *)&sa, sizeof(sa)) == 0,
+ "bind: %d", errno);
+ ATF_REQUIRE_MSG(listen(s, 16) == 0, "listen: %d", errno);
/*
* extract address and open a connection to the port
*/
slen = sizeof(sa);
- ATF_REQUIRE(getsockname(s, (struct sockaddr *)&sa, &slen)==0);
+ ATF_REQUIRE_MSG(getsockname(s, (struct sockaddr *)&sa, &slen) == 0,
+ "getsockname: %d", errno);
s2 = socket(PF_INET, SOCK_STREAM|SOCK_NONBLOCK, 0);
- ATF_REQUIRE(s2 != -1);
+ ATF_REQUIRE_MSG(s2 != -1, "socket: %d", errno);
printf("port is %d\n", ntohs(sa.sin_port));
err = connect(s2, (struct sockaddr *)&sa, sizeof(sa));
ATF_REQUIRE_MSG(err == -1 && errno == EINPROGRESS,