X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FUDPEcho%2Ftests%2Fseqtest.pl;fp=apps%2FUDPEcho%2Ftests%2Fseqtest.pl;h=b3b170a004c683075d9c86a43897544499c83a25;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=0000000000000000000000000000000000000000;hpb=adf1de6c009d13b7b52e68535c63b28f59c97400;p=tinyos-2.x.git diff --git a/apps/UDPEcho/tests/seqtest.pl b/apps/UDPEcho/tests/seqtest.pl new file mode 100755 index 00000000..b3b170a0 --- /dev/null +++ b/apps/UDPEcho/tests/seqtest.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +# make sure we don't break on any length boundaries + +use strict; +use warnings; +use FileHandle; +use IPC::Open2; + +if (@ARGV != 1) { + print "Usage: seqtest.pl \n"; + exit(1); +} + +my $alpha = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +my $testbuf = ""; +while (length($testbuf) < 1280 - 40 - 8) { + $testbuf .= $alpha; +} + +open2(*READER, *WRITER, "nc6 -u $ARGV[0] 7"); + +my $trials = 0; +while (1) { + my $len; + for ($len = 1; $len < 1000; $len++) { + print $len . "\n"; + print WRITER substr($testbuf, 0, $len) . "\n"; + + my $rin = ''; + vec($rin,fileno(READER),1) = 1; + my $found = select($rin, undef, undef, "6"); + if ($found == 1) { + my $foo; + sysread READER, $foo, 1280; + if ($foo eq $testbuf) { + print "WARNING: payload mismatch\n"; + } + } else { + print "FAILURE: len: $len\n"; + } + + $trials++; + print "TRIAL: $trials\n"; + sleep(.05); + } +} +# need to kill off the nc6 process +print WRITER eof; +