MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

minivend 'make test'



hi -

First off - i did search the faq and the docs
for anything like this and wasn't able to
find anything - but i could just be brain
damaged...the mailing list archives
suggested that my version of perl might
be crippled so i compiled that fresh and i'm
still getting this error.

when i run 'make test' i get this:

[root@Chopin minivend-3.14-4]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch
-Iblib/lib
-I/usr/lib/perl5/5.00502/i386-linux-thread
-I/usr/lib/perl5/5.00502 test.pl
server.......ok 1
socket link..not ok 2
2 tests run

-- 1/ failed.

make: *** [test_dynamic] Error 1

my guess is that if the make test don't work
- the application probably won't work.  so i
took the time to write a perl script that
verifies sockets work on my machine (attached
along with output...).  and i was able to
identify the chunk of code in test.pl that
doesn't seem to be working:

   print SOCK send_arguments();
   print SOCK send_environment();
   print SOCK "end\n";

   while(<SOCK>) {
           $result .= $_;
   }

I put a counter into the loop and found that
it was getting nothing from the socket....but
i can't identify where in the server that it
reads the inbound connection
(Vend::Server::MESSAGES??) and talks back to
the client. (test.pl in this case).  Do I
need to give configure a command line switch
to tell it how to handle something
differently?  Or is there something else
wrong that I'm missing.   i was also able to
verify that the server and the client both
have the socket open when the script is
running (using fuser).

related info:
Kernel ver: 2.2.5
perl ver: 5.00502
libc ver: glibc 2.1

Thanks in advance for your time...

James Hamilton

'socktest'
  ---------------------------------------------
#!/usr/bin/perl -w

use Socket;
use POSIX;

my $LINKFL = "/tmp/socktestsock";
my $uaddr = sockaddr_un($LINKFL);

FORK: {
  if ($pid = fork) {
  # parent code...
    print "Parent: opening socket...\n";
    socket(Server,PF_UNIX,SOCK_STREAM,0)  or die "Parent: socket error=$!\n";
    unlink($LINKFL);
    bind(Server, $uaddr)                  or die "Parent: bind error=$!\n";
    listen(Server,SOMAXCONN)              or die "Parent: listen error=$!\n";
    print "Parent: ready to accept connections on $LINKFL\n";
    for ( ; $paddr = accept(Client,Server); close Client, exit) {
       print "Parent: accepted incoming connetion on $LINKFL, $paddr\n";
       print Client "helo child: ", scalar localtime, "\n";
       sleep 3; select Client; $| = 1; select STDOUT;
       while (<Client>) {
          print "Parent: returning received text=$_";
          print Client $_;
       }
       if(waitpid($pid, WNOHANG)) {
         print "Parent: child exited\n";
       }
    }
  }
  elsif (defined $pid) {
  # child code...
    sleep 3;
    print "Child: opening socket...\n";
    socket(SOCK,PF_UNIX,SOCK_STREAM,0) or die "Child: socket error=$!\n";
    connect(SOCK,$uaddr) or die "Child: connect error=$!\n";
    sleep 3;
    print "Child: waiting for helo\n";
    while (<SOCK>) {
      if (/helo child/) { last; }
    }
    print "Child: received=$_";
    print "Child: sending messages\n";
    select SOCK; $| = 1; select STDOUT;
    for($i=0; $i < 10; $i++) {
      $msg = "$i: " . "hi "x$i . "\n";
      print SOCK $msg;
    }
    print SOCK "end xmit\n";
    print "Child: receiving messages\n";
    while (<SOCK>) {
      print "Child: received text=$_";
      if (/end xmit/) {
         close SOCK;
         exit;
      }
    }
  }
  elsif ($! =~ /No more process/) {
  # try again, possibly recoverable...
    sleep 5;
    redo FORK;
  }
  else {
  # something is amiss...
    die "Can't fork: $!\n";
  }
}

'socktest.out'
  ---------------------------------------------
Child: opening socket...
Child: waiting for helo
Child: received=helo child: Fri Nov 19 15:23:10 1999
Child: sending messages
Child: receiving messages
Child: received text=0:
Child: received text=1: hi
Child: received text=2: hi hi
Child: received text=3: hi hi hi
Child: received text=4: hi hi hi hi
Child: received text=5: hi hi hi hi hi
Child: received text=6: hi hi hi hi hi hi
Child: received text=7: hi hi hi hi hi hi hi
Child: received text=8: hi hi hi hi hi hi hi hi
Child: received text=9: hi hi hi hi hi hi hi hi hi
Child: received text=end xmit
Parent: opening socket...
Parent: ready to accept connections on /tmp/socktestsock
Parent: accepted incoming connetion on /tmp/socktestsock, Parent: returning received text=0:
Parent: returning received text=1: hi
Parent: returning received text=2: hi hi
Parent: returning received text=3: hi hi hi
Parent: returning received text=4: hi hi hi hi
Parent: returning received text=5: hi hi hi hi hi
Parent: returning received text=6: hi hi hi hi hi hi
Parent: returning received text=7: hi hi hi hi hi hi hi
Parent: returning received text=8: hi hi hi hi hi hi hi hi
Parent: returning received text=9: hi hi hi hi hi hi hi hi hi
Parent: returning received text=end xmit
Parent: child exited




Search for: Match: Format: Sort by: