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 <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 @@ 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 - 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); }