Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/icmp In the "got %d/%d" message printed at the end...



details:   https://anonhg.NetBSD.org/src/rev/c1d6b757e45a
branches:  trunk
changeset: 451892:c1d6b757e45a
user:      gson <gson%NetBSD.org@localhost>
date:      Tue Jun 11 08:34:01 2019 +0000

description:
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.

diffstat:

 tests/net/icmp/t_ping.c |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 365238d7bb12 -r c1d6b757e45a tests/net/icmp/t_ping.c
--- a/tests/net/icmp/t_ping.c   Tue Jun 11 08:09:35 2019 +0000
+++ b/tests/net/icmp/t_ping.c   Tue Jun 11 08:34:01 2019 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/types.h>
@@ -280,7 +280,7 @@
 {
        char ifname[IFNAMSIZ];
        pid_t cpid;
-       int succ, i;
+       int sent, succ, i;
 
        cpid = fork();
        rump_init();
@@ -299,21 +299,27 @@
 
        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 - 60000; i++)
+       for (i = 0 ; i < IP_MAXPACKET - 60000; i++) {
+               sent++;
                succ += doping("1.1.1.10", 1, i);
+       }
 
        /* medium sizes */
-       for (i = IP_MAXPACKET - 60000; i < IP_MAXPACKET - 100; i += 1000)
+       for (i = IP_MAXPACKET - 60000; 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);
 }
 



Home | Main Index | Thread Index | Old Index