Mercurial > flash_v2
changeset 960:92d29f6f398a
Revert last accidental checkin of these files
| author | jlarmour |
|---|---|
| date | Wed, 23 Apr 2003 23:48:57 +0000 |
| parents | 699b9301a235 |
| children | 2ffd006ba591 |
| files | packages/net/common/current/tests/nc_test_framework.h packages/net/common/current/tests/ping_lo_test.c packages/net/common/current/tests/ping_test.c |
| diffstat | 3 files changed, 21 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/common/current/tests/nc_test_framework.h +++ b/packages/net/common/current/tests/nc_test_framework.h @@ -73,6 +73,9 @@ typedef void *test_param_t; #define NC_TESTING_SLAVE_PORT 8770 #define NC_TESTING_MASTER_PORT 8771 +#define __string(s) #s +#define _string(s) __string(s) + // // The basic idea behind this test structure is that one end will run // in "slave" mode and the other in "master" mode. Typically, the slave
--- a/packages/net/common/current/tests/ping_lo_test.c +++ b/packages/net/common/current/tests/ping_lo_test.c @@ -19,7 +19,7 @@ //#####DESCRIPTIONBEGIN#### // // Author(s): gthomas, sorin@netappi.com -// Contributors: gthomas, sorin@netappi.com, andrew.lunn@ascom.ch, jlarmour +// Contributors: gthomas, sorin@netappi.com, andrew.lunn@ascom.ch // Date: 2000-01-10 // Purpose: // Description: @@ -37,13 +37,6 @@ #include <netinet/icmp6.h> #endif -#include <pkgconf/system.h> -#include <pkgconf/net.h> - -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - #include <cyg/infra/testcase.h> #ifndef CYGPKG_LIBC_STDIO @@ -135,7 +128,7 @@ show_icmp(unsigned char *pkt, int len, return (from->sin_addr.s_addr == to->sin_addr.s_addr); } -static int +static void ping_host(int s, struct sockaddr_in *host) { struct icmp *icmp = (struct icmp *)pkt1; @@ -184,7 +177,6 @@ ping_host(int s, struct sockaddr_in *hos } } diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); - return ok_recv; } static void @@ -193,7 +185,7 @@ ping_test_loopback( int lo ) struct protoent *p; struct timeval tv; struct sockaddr_in host; - int s, ok_recv; + int s; if ((p = getprotobyname("icmp")) == (struct protoent *)0) { perror("getprotobyname"); @@ -212,14 +204,10 @@ ping_test_loopback( int lo ) host.sin_len = sizeof(host); host.sin_addr.s_addr = htonl(INADDR_LOOPBACK + (0x100 * lo)); host.sin_port = 0; - CYG_TEST_INFO("Pinging valid host"); - ok_recv = ping_host(s, &host); - // check acceptable ping level - loopback should have 0 loss - CYG_TEST_PASS_FAIL( ok_recv == NUM_PINGS, "Good packets acceptable" ); + ping_host(s, &host); // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + NLOOP + 10); - ok_recv = ping_host(s, &host); - CYG_TEST_PASS_FAIL( ok_recv == 0, "No packets should be received" ); + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); + ping_host(s, &host); } #ifdef CYGPKG_NET_INET6 @@ -370,9 +358,7 @@ void net_test(cyg_addrword_t p) { int i; - - CYG_TEST_INIT(); - CYG_TEST_INFO("Start loopback PING test"); + diag_printf("Start PING test\n"); init_all_network_interfaces(); #if NLOOP > 0 @@ -380,14 +366,13 @@ net_test(cyg_addrword_t p) ping_test_loopback( i ); for ( i = 0; i < NLOOP; i++ ) ping_test_loopback( i ); -# ifdef CYGPKG_NET_INET6 +#ifdef CYGPKG_NET_INET6 for ( i = 0; i < NLOOP; i++ ) ping6_test_loopback( i ); -# endif - CYG_TEST_FINISH( "Done pinging loopback" ); // FIXMEJIFL -#else - CYG_TEST_NA( "No loopback interfaces" ); #endif + CYG_TEST_PASS_FINISH( "Done pinging loopback" ); +#endif + CYG_TEST_NA( "No loopback devs" ); } void @@ -408,5 +393,3 @@ cyg_start(void) cyg_thread_resume(thread_handle); // Start it cyg_scheduler_start(); } - -// EOF ping_lo_test.c
--- a/packages/net/common/current/tests/ping_test.c +++ b/packages/net/common/current/tests/ping_test.c @@ -40,10 +40,6 @@ #include <pkgconf/system.h> #include <pkgconf/net.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - #include <cyg/infra/testcase.h> #ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists @@ -167,7 +163,7 @@ show_icmp(unsigned char *pkt, int len, return (from->sin_addr.s_addr == to->sin_addr.s_addr); } -static int +static void ping_host(int s, struct sockaddr_in *host) { struct icmp *icmp = (struct icmp *)pkt1; @@ -221,7 +217,6 @@ ping_host(int s, struct sockaddr_in *hos } TNR_OFF(); diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); - return ok_recv; } #ifdef CYGPKG_NET_INET6 @@ -375,7 +370,7 @@ ping_test(struct bootp *bp) struct protoent *p; struct timeval tv; struct sockaddr_in host; - int s, ok_recv; + int s; if ((p = getprotobyname("icmp")) == (struct protoent *)0) { pexit("getprotobyname"); @@ -394,17 +389,10 @@ ping_test(struct bootp *bp) host.sin_len = sizeof(host); host.sin_addr = bp->bp_siaddr; host.sin_port = 0; - CYG_TEST_INFO("Pinging valid host"); - ok_recv = ping_host(s, &host); - // check acceptable ping level - allow 10% loss - CYG_TEST_PASS_FAIL( ok_recv + (NUM_PINGS/10) >= NUM_PINGS, - "Good packets acceptable" ); + ping_host(s, &host); // Now try a bogus host - CYG_TEST_INFO("Pinging bogus host"); - host.sin_addr.s_addr = inet_addr("10.10.10.10"); - ok_recv = ping_host(s, &host); - // should be 0 packets - CYG_TEST_PASS_FAIL( ok_recv == 0, "No packets should be received" ); + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); + ping_host(s, &host); } void @@ -413,24 +401,19 @@ net_test(cyg_addrword_t p) #ifdef CYGPKG_NET_INET6 struct sockaddr_in6 ipv6router; #endif - int something_tested=0; - CYG_TEST_INIT(); - CYG_TEST_INFO("Start PING test"); - + diag_printf("Start PING test\n"); TNR_INIT(); init_all_network_interfaces(); #ifdef CYGHWR_NET_DRIVER_ETH0 if (eth0_up) { ping_test(ð0_bootp_data); } - something_tested++; #endif #ifdef CYGHWR_NET_DRIVER_ETH1 if (eth1_up) { ping_test(ð1_bootp_data); } - something_tested++; #endif #ifdef CYGPKG_NET_INET6 if (cyg_net_get_ipv6_advrouter(&ipv6router)) { @@ -440,11 +423,7 @@ net_test(cyg_addrword_t p) } #endif TNR_PRINT_ACTIVITY(); - if (!something_tested) { - CYG_TEST_NA("No interfaces found to be tested"); - } else { - CYG_TEST_FINISH("Ping test"); - } + CYG_TEST_PASS_FINISH("Ping test OK"); } void @@ -463,5 +442,3 @@ cyg_start(void) cyg_thread_resume(thread_handle); // Start it cyg_scheduler_start(); } - -// EOF ping_test.c
