From: Mike Taylor Date: Wed, 16 Mar 2011 16:53:06 +0000 (+0000) Subject: The SimpleServer test-script now uses a Unix-domain socket, with a X-Git-Tag: v1.13~4 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=0bd288ae9f8333f0bb558792c31aff49900605cb;p=simpleserver-moved-to-github.git The SimpleServer test-script now uses a Unix-domain socket, with a filename generated from the process-ID, rather than the default Inet-document socket on port 9999. Hopefully this should resolve the race-condition problems that have been affecting the "make test" part of the build cycle when building packages for four systems simultaneously under id-pbuild.sh --- diff --git a/test.pl b/test.pl index 7c28f91..022dcaf 100644 --- a/test.pl +++ b/test.pl @@ -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(1); - open(CLIENT, "| yaz-client tcp:localhost:9999 > /dev/null") + 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); }