X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=blobdiff_plain;f=test.pl;h=7978fbc392604c1172b2aef3790a3cfaaca58ae5;hp=b5561d9f58208cc2adaf5a46c67c58400db09fc5;hb=f0e0609c1a000a8d98434b565a73e24e95367c25;hpb=a0bb3f45a1f576f36a286f21c3fec3ee16013fce diff --git a/test.pl b/test.pl index b5561d9..7978fbc 100644 --- a/test.pl +++ b/test.pl @@ -14,10 +14,10 @@ print "ok 1\n"; ######################### End of black magic. -print "not " if Net::Z3950::SimpleServer::yaz_diag_srw_to_bib1(11) != 3; +print "not " if Net::Z3950::SimpleServer::yaz_diag_srw_to_bib1(11) != 107; print "ok 2\n"; -print "not " if Net::Z3950::SimpleServer::yaz_diag_bib1_to_srw(3) != 11; +print "not " if Net::Z3950::SimpleServer::yaz_diag_bib1_to_srw(3) != 48; print "ok 3\n"; # Insert your test code below (better if it prints "ok 13" @@ -87,6 +87,9 @@ sub my_close_handler { } +my $socketFile = "/tmp/SimpleServer-test-$$"; +my $socket = "unix:$socketFile"; + if (!defined($pid = fork() )) { die "Cannot fork: $!\n"; } elsif ($pid) { ## Parent launches server @@ -96,14 +99,15 @@ if (!defined($pid = fork() )) { SEARCH => \&my_search_handler, FETCH => \&my_fetch_handler); - $handler->launch_server("test.pl", "-1", @ARGV); + $handler->launch_server("test.pl", "-1", $socket); } else { ## Child starts the client - sleep(2); - open(CLIENT, "| yaz-client tcp:localhost:9999 > /dev/null") + sleep(1); + open(CLIENT, "| yaz-client $socket > /dev/null") or die "Couldn't fork client: $!\n"; print CLIENT "f test\n"; print CLIENT "s\n"; print CLIENT "close\n"; print CLIENT "quit\n"; close(CLIENT) or die "Couldn't close: $!\n"; + unlink($socketFile); }