stage: compile
$(MAKE) install PREFIX=${stagedir} DOSTAGE=yes
-check:
- -echo "No unit tests so far."
+check: example
+ LOG4C_RCPATH=${PREFIX}${sysconfdir}/glite-lb ${top_srcdir}/examples/run_test.sh
example: srv_example cnt_example
-srv_example: srv_example.o
+srv_example: srv_example.o ${LTLIB}
${LINK} -o $@ ${LTLIB} srv_example.o
-cnt_example: cnt_example.o
+cnt_example: cnt_example.o ${LTLIB}
${LINK} -o $@ cnt_example.o
doc:
rm -rvf *.o *.lo .libs lib* srv_example cnt_example
rm -rvf log.xml rpmbuild/ RPMS/ tgz/ debian/
-%.o: %.c
+%.o %.lo: %.c
${COMPILE} -c $<
*me;
int opt,
sock = -1,
+ fd,
n;
int repeat = 1;
}
n = strlen(msg? msg: DEF_MSG);
+ fd = fileno(stdout);
for (;repeat; repeat--) {
if ( writen(sock, msg? msg: DEF_MSG, n) != n )
{
if ( n < 0 )
{
perror("read() reply error");
+ free(msg);
return 1;
}
- writen(0, buff, n);
+ writen(fd, buff, n);
}
close(sock);
+ free(msg);
return 0;
}
--- /dev/null
+#! /bin/bash
+
+./srv_example > /tmp/log.$$ &
+SRV_PID=$!
+disown $SRV_PID
+
+sleep 1
+
+a=`./cnt_example -p 9999 -m "Applejack
+"`
+ret1=$?
+
+b=`./cnt_example -p 9998 -m "Applejack
+"`
+ret2=$?
+
+kill -SIGTERM $SRV_PID
+
+n=`grep 'disconnect handler' /tmp/log.$$ | wc -l`
+rm -f /tmp/log.$$
+
+if [ $ret1 -ne 0 -o $ret2 -ne 0 ]; then
+ echo "$0: error launching cnt_example"
+ exit 1
+fi
+
+if [ "$a" != "reply: Applejack" -o "$b" != "reply: APPLEJACK" ]; then
+ echo "$0: error in reply"
+ exit 2
+fi
+
+if [ "$n" != "2" ]; then
+ echo "$0: error running server"
+ exit 3
+fi
+
+exit 0
exit(1);
}
+ setpgid(0, getpid());
+
glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, 1);
glite_srvbones_run(NULL, service_table, sizofa(service_table), 1);
static char *buffer_end = buffer;
int n;
-
dprintf(("reading line\n"));
while ( 1 ) {
if ( buffer_end - buffer ) {