Module Name: src
Committed By: pooka
Date: Mon Feb 28 21:21:14 UTC 2011
Modified Files:
src/tests/fs/nfs/nfsservice: rumpnfsd.c
src/tests/net/config: netconfig.c
Log Message:
make netcfg produce sensible results in a non-atf env
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/fs/nfs/nfsservice/rumpnfsd.c
cvs rdiff -u -r1.6 -r1.7 src/tests/net/config/netconfig.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/fs/nfs/nfsservice/rumpnfsd.c
diff -u src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.6 src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.7
--- src/tests/fs/nfs/nfsservice/rumpnfsd.c:1.6 Fri Dec 31 18:11:27 2010
+++ src/tests/fs/nfs/nfsservice/rumpnfsd.c Mon Feb 28 21:21:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpnfsd.c,v 1.6 2010/12/31 18:11:27 pooka Exp $ */
+/* $NetBSD: rumpnfsd.c,v 1.7 2011/02/28 21:21:14 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -64,6 +64,9 @@
pthread_t t;
int rv;
+ /* for netcfg */
+ noatf = 1;
+
/* use defaults? */
if (argc == 1) {
ethername = "etherbus";
Index: src/tests/net/config/netconfig.c
diff -u src/tests/net/config/netconfig.c:1.6 src/tests/net/config/netconfig.c:1.7
--- src/tests/net/config/netconfig.c:1.6 Tue Aug 17 12:04:34 2010
+++ src/tests/net/config/netconfig.c Mon Feb 28 21:21:14 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: netconfig.c,v 1.6 2010/08/17 12:04:34 pooka Exp $ */
+/* $NetBSD: netconfig.c,v 1.7 2011/02/28 21:21:14 pooka Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: netconfig.c,v 1.6 2010/08/17 12:04:34 pooka Exp $");
+__RCSID("$NetBSD: netconfig.c,v 1.7 2011/02/28 21:21:14 pooka Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -46,6 +46,7 @@
#include <netinet/ip_icmp.h>
#include <atf-c.h>
+#include <err.h>
#include <errno.h>
#include <string.h>
@@ -54,13 +55,18 @@
#include "../../h_macros.h"
+int noatf;
+
static void __unused
netcfg_rump_makeshmif(const char *busname, char *ifname)
{
int rv, ifnum;
if ((rv = rump_pub_shmif_create(busname, &ifnum)) != 0) {
- atf_tc_fail("makeshmif: rump_pub_shmif_create %d", rv);
+ if (noatf)
+ err(1, "makeshmif: rump_pub_shmif_create %d", rv);
+ else
+ atf_tc_fail("makeshmif: rump_pub_shmif_create %d", rv);
}
sprintf(ifname, "shmif%d", ifnum);
}
@@ -71,7 +77,10 @@
int rv;
if ((rv = rump_pub_virtif_create(ifnum)) != 0) {
- atf_tc_fail("makeshmif: rump_pub_virtif_create %d", rv);
+ if (noatf)
+ err(1, "makeshmif: rump_pub_virtif_create %d", rv);
+ else
+ atf_tc_fail("makeshmif: rump_pub_virtif_create %d", rv);
}
sprintf(ifname, "virt%d", ifnum);
}
@@ -86,7 +95,10 @@
s = -1;
if ((s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
- atf_tc_fail_errno("if config socket");
+ if (noatf)
+ err(1, "if config socket");
+ else
+ atf_tc_fail_errno("if config socket");
}
inaddr = inet_addr(addr);
@@ -113,8 +125,11 @@
sin->sin_addr.s_addr = inaddr | ~inmask;
rv = rump_sys_ioctl(s, SIOCAIFADDR, &ia);
- if (rv) {
- atf_tc_fail_errno("SIOCAIFADDR");
+ if (rv == -1) {
+ if (noatf)
+ err(1, "SIOCAIFADDR");
+ else
+ atf_tc_fail_errno("SIOCAIFADDR");
}
rump_sys_close(s);
}
@@ -134,7 +149,10 @@
s = rump_sys_socket(PF_ROUTE, SOCK_RAW, 0);
if (s == -1) {
- atf_tc_fail_errno("routing socket");
+ if (noatf)
+ err(1, "routing socket");
+ else
+ atf_tc_fail_errno("routing socket");
}
memset(&m_rtmsg, 0, sizeof(m_rtmsg));
@@ -173,7 +191,10 @@
rv = rump_sys_write(s, &m_rtmsg, len);
if (rv != (int)len) {
- atf_tc_fail_errno("write routing message");
+ if (noatf)
+ err(1, "write routing message");
+ else
+ atf_tc_fail_errno("write routing message");
}
rump_sys_close(s);
}