CVS commit: src/tests/net/icmp

2019-06-11 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Jun 11 08:34:01 UTC 2019

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
In the "got %d/%d" message printed at the end of the pingsize test,
make the latter number show the actual number of ICMP packets the test
attempted to send.  Thus, the two numbers can now be meaningfully
compared, and their difference indicates the number of packets lost.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/net/icmp/t_ping.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/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.23 src/tests/net/icmp/t_ping.c:1.24
--- src/tests/net/icmp/t_ping.c:1.23	Mon Mar 26 09:11:15 2018
+++ src/tests/net/icmp/t_ping.c	Tue Jun 11 08:34:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.24 2019/06/11 08:34:01 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.24 2019/06/11 08:34:01 gson Exp $");
 #endif /* not lint */
 
 #include 
@@ -280,7 +280,7 @@ ATF_TC_BODY(pingsize, tc)
 {
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
-	int succ, i;
+	int sent, succ, i;
 
 	cpid = fork();
 	rump_init();
@@ -299,21 +299,27 @@ ATF_TC_BODY(pingsize, tc)
 
 	netcfg_rump_if(ifname, "1.1.1.20", "255.255.255.0");
 
-	succ = 0;
+	succ = sent = 0;
 
 	/* small sizes */
-	for (i = 0 ; i < IP_MAXPACKET - 6; i++)
+	for (i = 0 ; i < IP_MAXPACKET - 6; i++) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
 	/* medium sizes */
-	for (i = IP_MAXPACKET - 6; i < IP_MAXPACKET - 100; i += 1000)
+	for (i = IP_MAXPACKET - 6; i < IP_MAXPACKET - 100; i += 1000) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
 	/* big sizes */
-	for (i = IP_MAXPACKET - 100; i < IP_MAXPACKET; i += 10)
+	for (i = IP_MAXPACKET - 100; i < IP_MAXPACKET; i += 10) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
-	printf("got %d/%d\n", succ, IP_MAXPACKET);
+	printf("got %d/%d\n", succ, sent);
 	kill(cpid, SIGKILL);
 }
 



Re: CVS commit: src/tests/net/icmp

2010-07-04 Thread Antti Kantee
On Sun Jul 04 2010 at 23:08:03 +0200, Thomas Klausner wrote:
 I don't understand exactly how you're doing this, but I admire what
 you can do with it now :)

I'm happy to give a more detailed explanation on how it works, but I need
one or two questions to determine the place where I should start from.
I'm planning a short article on the unique advantages of rump in kernel
testing (four advantages by my counts so far), and some questions now
might even help me write that one about what people want to read instead
of what I guess they'd want to read.