Makefile updates for Automake 1.5+. Test script updates
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 21 May 2003 14:39:21 +0000 (14:39 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 21 May 2003 14:39:21 +0000 (14:39 +0000)
28 files changed:
configure.in
test/Makefile.am
test/api/Makefile.am
test/api/testclient.c [new file with mode: 0644]
test/cddb/Makefile.am
test/dmoz/Makefile.am
test/gils/Makefile.am
test/gils/stop01.sh
test/gils/stop02.sh
test/gils/stop03.sh
test/gils/stop04.sh
test/gils/test1.sh
test/gils/test2.sh
test/gils/timing1.sh
test/gils/timing2.sh
test/sort/Makefile.am
test/sort/test1.sh
test/testclient.c [deleted file]
test/xelm/Makefile.am
test/xpath/Makefile.am
test/xpath/rec [deleted file]
test/xpath/rec.xml [new file with mode: 0644]
test/xpath/simple1.rec [deleted file]
test/xpath/simple1.sh
test/xpath/simple1.xml [new file with mode: 0644]
test/xpath/test1.sh
test/xpath/test2.sh
test/xpath/test3.sh

index a109e0f..6e3dacf 100644 (file)
@@ -1,5 +1,5 @@
 dnl Zebra, Index Data Aps, 1995-2003
-dnl $Id: configure.in,v 1.77 2003-04-24 20:10:24 adam Exp $
+dnl $Id: configure.in,v 1.78 2003-05-21 14:39:21 adam Exp $
 dnl
 AC_INIT(include/zebraver.h)
 AM_INIT_AUTOMAKE(idzebra,1.3.11)
@@ -71,8 +71,10 @@ AC_ARG_WITH(dsssl,[  --with-dsssl[=DIR]      Use DSSSL in DIR/{html,print}/docbo
 dnl
 AC_ARG_ENABLE(threads, [  --disable-threads       disable threads],[enable_threads=$enableval],[enable_threads=yes])
 if test "$enable_threads" = "yes"; then
+       AM_CONDITIONAL(ISTHR,true)
        yazflag=threads
 else
+       AM_CONDITIONAL(ISTHR,false)
        yazflag=""
 fi
 YAZ_INIT($yazflag)
@@ -393,7 +395,11 @@ AC_OUTPUT([
   examples/Makefile examples/gils/Makefile examples/zthes/Makefile
   idzebra.spec
 ])
-
 if test -x "$perlbin"; then
-  res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
+       res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
+fi
+if test  -z "$YAZLIB"; then
+       echo "YAZ was not found. Use --with-yazconfig=DIR to specify location."
+       test -f /etc/debian_version && echo "Debian package libyaz-dev is required."
 fi
+
index 4566855..71221c3 100644 (file)
@@ -1,10 +1,3 @@
 
-SUBDIRS=gils usmarc api dmoz xpath sort xelm cddb rusmarc 
+SUBDIRS=api gils usmarc dmoz xpath sort xelm cddb rusmarc 
 
-testclient_SOURCES = testclient.c
-
-noinst_PROGRAMS = testclient
-
-AM_CPPFLAGS = $(YAZINC) 
-
-LDADD = $(YAZLIB) 
index d5f773e..5269641 100644 (file)
@@ -1,7 +1,11 @@
-# $Id: Makefile.am,v 1.9 2003-05-20 13:52:41 adam Exp $
+# $Id: Makefile.am,v 1.10 2003-05-21 14:39:22 adam Exp $
 
 TESTS = t1 t2 t3
 
+testclient_SOURCES = testclient.c
+
+noinst_PROGRAMS = testclient
+
 EXTRA_PROGRAMS = t1 t2 t3
 
 EXTRA_DIST=t1.cfg t2.cfg
diff --git a/test/api/testclient.c b/test/api/testclient.c
new file mode 100644 (file)
index 0000000..e1a17ab
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * $Id: testclient.c,v 1.1 2003-05-21 14:39:22 adam Exp $
+ *
+ * Z39.50 client specifically for Zebra testing.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef WIN32
+#else
+#include <unistd.h>
+#endif
+
+#include <yaz/xmalloc.h>
+#include <yaz/options.h>
+#include <yaz/zoom.h>
+
+char *prog = "testclient";
+
+int main(int argc, char **argv)
+{
+    ZOOM_connection z;
+    ZOOM_resultset r;
+    int error;
+    const char *errmsg, *addinfo;
+    char *query = 0;
+    char *target = 0;
+    char *arg;
+    int delay_sec = 0;
+    int expected_hits=-1;
+    int ret;
+    int retrieve_number = 0;
+    int retrieve_offset = 0;
+    char *format = 0;
+    int pos;
+    int check_count = -1;
+    int exit_code = 0;
+
+    while ((ret = options("d:n:o:f:c:", argv, argc, &arg)) != -2)
+    {
+        switch (ret)
+        {
+        case 0:
+            if (!target)
+                target = xstrdup(arg);
+            else if (!query)
+                query = xstrdup(arg);
+            break;
+        case 'd':
+            delay_sec = atoi(arg);
+            break;
+        case 'n':
+            retrieve_number = atoi(arg);
+            break;
+        case 'o':
+            retrieve_offset = atoi(arg);
+            break;
+        case 'f':
+            format = xstrdup(arg);
+            break;
+        case 'c':
+           check_count = atoi(arg);
+           break;
+        default:
+            printf ("%s: unknown option %s\n", prog, arg);
+            printf ("usage:\n%s [options] target query \n", prog);
+            printf (" eg.  indexdata.dk/gils computer\n");
+            exit (1);
+        }
+    }
+
+    if (!target || !target)
+    {
+        printf ("%s: missing target/query\n", prog);
+        printf ("usage:\n%s [options] target query \n", prog);
+        printf (" eg.  bagel.indexdata.dk/gils computer\n");
+        printf ("Options:\n");
+        printf (" -n num       number of records to fetch. Default: 0.\n");
+        printf (" -o off       offset for records - counting from 0.\n");
+        printf (" -f format    set record syntax. Default: none\n");
+        printf (" -d sec       delay a number of seconds before exit.\n");
+        exit (3);
+    }
+    z = ZOOM_connection_new (target, 0);
+    
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
+    {
+       printf ("Error: %s (%d) %s\n", errmsg, error, addinfo);
+       exit (2);
+    }
+
+    r = ZOOM_connection_search_pqf (z, query);
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
+    {
+       printf ("Error: %s (%d) %s\n", errmsg, error, addinfo);
+       if (check_count != -1)
+            exit_code = 10;
+    }
+    else
+    {
+       printf ("Result count: %d\n", ZOOM_resultset_size(r));
+       if (check_count != -1 && check_count != ZOOM_resultset_size(r))
+       {
+           printf("Wrong number of hits, expected %d, got %d\n",
+                           expected_hits, ZOOM_resultset_size(r) );
+           exit(3);
+       }
+    }
+    if (format)
+        ZOOM_resultset_option_set(r, "preferredRecordSyntax", format);
+    for (pos = 0; pos < retrieve_number; pos++)
+    {
+        int len;
+        const char *rec =
+            ZOOM_record_get(
+                ZOOM_resultset_record(r, pos + retrieve_offset),
+                "render", &len);
+        
+        if (rec)
+            fwrite (rec, 1, len, stdout);
+    }
+    if (delay_sec > 0)
+       sleep(delay_sec);
+    ZOOM_resultset_destroy (r);
+    ZOOM_connection_destroy (z);
+    exit (exit_code);
+}
index cdd7354..14e4f40 100644 (file)
@@ -1,3 +1,4 @@
+# $Id: Makefile.am,v 1.2 2003-05-21 14:39:22 adam Exp $
 
 EXTRA_DIST = zebra.cfg cddb.abs cddb.flt cddb.tag b00b520d
 
index 4a1c698..b5154a3 100644 (file)
@@ -1,3 +1,4 @@
+# $Id: Makefile.am,v 1.2 2003-05-21 14:39:22 adam Exp $
 
 EXTRA_DIST = zebra-b.cfg zebra-c.cfg update.sh all.sh con1.pl con2.pl
 
index c6dcd41..296e2ce 100644 (file)
@@ -1,11 +1,20 @@
-# $Id: Makefile.am,v 1.14 2003-05-20 13:52:41 adam Exp $
+# $Id: Makefile.am,v 1.15 2003-05-21 14:39:22 adam Exp $
 
 dist-hook:
        -mkdir $(distdir)/records
        cp $(srcdir)/records/*.grs $(distdir)/records
 
-TESTS = stop01.sh stop02.sh stop03.sh stop04.sh \
-        test1.sh test2.sh \
-       timing1.sh timing2.sh
+# stop03.sh only works when Zebra is using threads.
+if ISTHR
+testscripts_thread = stop03.sh
+else
+testscripts_thread = 
+endif
 
-EXTRA_DIST = $(TESTS) zebra1.cfg zebra2.cfg
+check_SCRIPTS = stop01.sh stop02.sh stop03.sh stop04.sh \
+        test1.sh test2.sh timing1.sh timing2.sh
+
+TESTS = stop01.sh stop02.sh $(testscripts_thread) stop04.sh \
+        test1.sh test2.sh timing1.sh timing2.sh
+
+EXTRA_DIST = zebra1.cfg zebra2.cfg $(check_SCRIPTS)
index 41681a6..69013aa 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: stop01.sh,v 1.3 2003-05-06 20:09:28 adam Exp $
+# $Id: stop01.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
 # test start and stop of the server with -1
 
 echo "initializing"
@@ -25,7 +25,7 @@ PID=`cat zebrasrv.pid`
 ps -p $PID |grep $PID >/dev/null || exit 1
 
 echo "  connecting to it..."
-../testclient localhost:9901 utah > log || exit 1
+../api/testclient localhost:9901 utah > log || exit 1
 sleep 1
 
 echo "  checking that server does not run any more"
index 4a60a66..93609a7 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: stop02.sh,v 1.3 2003-05-06 20:09:28 adam Exp $
+# $Id: stop02.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
 # test start and stop of the server with -S
 #
 # FIXME - this test does not currently pass  (H 22-oct-2002)
@@ -28,14 +28,14 @@ PID=`cat zebrasrv.pid`
 ps -p $PID |grep $PID >/dev/null || exit 1
 
 echo "  connecting to it..."
-../testclient localhost:9901 utah > log || exit 1
+../api/testclient localhost:9901 utah > log || exit 1
 sleep 1
 
 echo "  checking that it still runs..."
 ps -p $PID | grep $PID >/dev/null || exit 1
 
 echo "  connecting again, with a delay..."
-../testclient -d 5 localhost:9901 utah > log &
+../api/testclient -d 5 localhost:9901 utah > log &
 sleep 1 # let the client connect 
 
 echo "  killing it..."
index 19a01f7..c60f225 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: stop03.sh,v 1.3 2003-05-06 20:09:28 adam Exp $
+# $Id: stop03.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
 # test start and stop of the threaded server (-T)
 #
 # FIXME - this test does not currently pass  (H 22-oct-2002)
@@ -31,14 +31,14 @@ PID=`cat zebrasrv.pid`
 ps -p $PID | grep $PID >/dev/null || exit 1
 
 echo "  connecting to it..."
-../testclient localhost:9901 utah > log || exit 1
+../api/testclient localhost:9901 utah > log || exit 1
 sleep 1
 
 echo "  checking that it still runs..."
 ps -p $PID >/dev/null || exit 1
 
 echo "  connecting again, with a delay..."
-../testclient localhost:9901 utah 5 > log &
+../api/testclient localhost:9901 utah 5 > log &
 sleep 1 # let the client connect 
 
 echo "  killing it..."
index bce26c3..716a786 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: stop04.sh,v 1.3 2003-05-06 20:09:28 adam Exp $
+# $Id: stop04.sh,v 1.4 2003-05-21 14:39:22 adam Exp $
 # test start and stop of the forked server 
 #
 
@@ -26,14 +26,14 @@ PID=`cat zebrasrv.pid`
 ps -p $PID | grep $PID >/dev/null || exit 1
 
 echo "  connecting to it..."
-../testclient localhost:9901 utah > log || exit 1
+../api/testclient localhost:9901 utah > log || exit 1
 sleep 1
 
 echo "  checking that it still runs..."
 ps -p $PID | grep $PID >/dev/null || exit 1
 
 echo "  connecting again, with a delay..."
-../testclient localhost:9901 utah 5 > log &
+../api/testclient localhost:9901 utah 5 > log &
 sleep 1 # let the client connect 
 
 echo "  killing it..."
index 71bbbde..e1eb5ab 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: test1.sh,v 1.5 2003-05-06 20:09:28 adam Exp $
+# $Id: test1.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
 echo "testing without stored keys (zebra1.cfg)"
 
 sleep 1
@@ -26,26 +26,26 @@ echo "checking it runs..."
 test -f zebrasrv.pid || exit 1
 
 echo "search 1..."
-../testclient localhost:9901 utah > log || exit 1
+../api/testclient localhost:9901 utah > log || exit 1
 grep "^Result count: 17$" log || exit 1
 
 echo "search 2..."
-../testclient localhost:9901 "@or utah the" > log || exit 1
+../api/testclient localhost:9901 "@or utah the" > log || exit 1
 grep "^Result count: 40$" log || exit 1
 
 echo "search 3..."
-../testclient localhost:9901 "@attr 1=4 the" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 the" > log || exit 1
 grep "^Result count: 1$" log || exit 1
 
 echo "search 4..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 
 echo "reindexing..."
 ../../index/zebraidx -l idx.log -c  zebra1.cfg update records || exit 1
 
 echo "search 5..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 18$" log || exit 1
 
 echo "stopping server..."
index 92c59cf..9371cfe 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: test2.sh,v 1.5 2003-05-06 20:09:28 adam Exp $
+# $Id: test2.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
 echo "Testing with storekeys (zebra2.cfg)"
 echo "init..."
 rm -f idx.log log
@@ -23,14 +23,14 @@ sleep 1
 test -f zebrasrv.pid || exit 1
 
 echo "search 1..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 
 echo "update 3..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "search 2..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 
 echo "making test records..."
@@ -40,7 +40,7 @@ echo "indexing them..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "search 3..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 10$" log || exit 1
 touch records/esdd0001.grs
 
@@ -48,7 +48,7 @@ echo "indexing again..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "search 4..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 10$" log || exit 1
 
 echo "making another test record..."
@@ -58,7 +58,7 @@ echo "indexing it too..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "search 5..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 10$" log || exit 1
 
 sleep 1
@@ -71,11 +71,11 @@ echo "indexing it..."
 sleep 1
 
 echo "search 6..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 
 echo "search 7..."
-../testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 xyz" > log || exit 1
 grep "^Result count: 1$" log || exit 1
 
 echo "stopping server..."
index d1038f2..cfa8496 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: timing1.sh,v 1.5 2003-05-06 20:09:28 adam Exp $
+# $Id: timing1.sh,v 1.6 2003-05-21 14:39:22 adam Exp $
 # tests that updates are reflected immediately # in the registers.
 # Repeatedly modifies a record and counts hits.
 # Test 1: with good sleeps in every between - should pass always
@@ -26,7 +26,7 @@ echo "  update 1..."
 sleep 2
 
 echo "  search 1..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 sleep 2
 
@@ -38,7 +38,7 @@ echo "  indexing it..."
 sleep 2
 
 echo "  search 2..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 10$" log || exit 1
 
 sleep 2
@@ -51,7 +51,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 3..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 9$" log || exit 1
 
@@ -65,7 +65,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 4..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 10$" log || exit 1
 
@@ -79,7 +79,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 5..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 9$" log || exit 1
 
@@ -94,7 +94,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 6..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 10$" log || exit 1
 
@@ -110,7 +110,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 7..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 9$" log || exit 1
 
@@ -124,7 +124,7 @@ echo "    indexing it..."
 
 sleep 2
 echo "    search 8..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 10$" log || exit 1
 
index a9a692c..097454c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: timing2.sh,v 1.5 2003-05-06 20:09:28 adam Exp $ 
+# $Id: timing2.sh,v 1.6 2003-05-21 14:39:22 adam Exp $ 
 # Demonstrated that updates depend on file timestamps
 
 echo "Testing timings of updates"
@@ -24,7 +24,7 @@ echo "  update 1..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "  search 1..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 9$" log || exit 1
 
 echo "making a test record..."
@@ -35,7 +35,7 @@ echo "  indexing it..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "  search 2..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 grep "^Result count: 10$" log || exit 1
 
 echo "  modifying a test record (xyz)..."
@@ -47,7 +47,7 @@ echo "    not indexing it..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "    search 3..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 10$" log || exit 1
 
@@ -58,7 +58,7 @@ echo "    indexing it..."
 ../../index/zebraidx -l idx.log -c zebra2.cfg update records || exit 1
 
 echo "    search 4..."
-../testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
+../api/testclient localhost:9901 "@attr 1=4 utah" > log || exit 1
 echo "    checking..."
 grep "^Result count: 9$" log || exit 1
 
index b00e9b4..4d6b90f 100644 (file)
@@ -1,4 +1,9 @@
-TESTS = test1.sh
+# $Id: Makefile.am,v 1.2 2003-05-21 14:39:22 adam Exp $
 
-EXTRA_DIST = $(TESTS) zebra.cfg rec1.xml rec2.xml rec3.xml zebra.cfg my.abs
+check_SCRIPTS = test1.sh
+
+TESTS = $(check_SCRIPTS)
+
+EXTRA_DIST = zebra.cfg rec1.xml rec2.xml rec3.xml zebra.cfg my.abs \
+ $(check_SCRIPTS)
 
index 2e98061..8fcc2cc 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: test1.sh,v 1.2 2003-05-06 17:39:01 adam Exp $
+# $Id: test1.sh,v 1.3 2003-05-21 14:39:22 adam Exp $
 LOG=test1.log
 rm -fr lock
 mkdir lock
@@ -12,7 +12,7 @@ cp rec*.xml recs
 ../../index/zebrasrv -l $LOG unix:socket &
 sleep 1
 test -f zebrasrv.pid || exit 2
-../testclient -n3 unix:socket '@or computer @attr 7=1 @attr 1=30 0' >tmp1
+../api/testclient -n3 unix:socket '@or computer @attr 7=1 @attr 1=30 0' >tmp1
 echo 'Result count: 3
 my:
   title: third computer
diff --git a/test/testclient.c b/test/testclient.c
deleted file mode 100644 (file)
index 7fddccd..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * $Id: testclient.c,v 1.10 2003-02-28 15:34:21 adam Exp $
- *
- * Z39.50 client specifically for Zebra testing.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef WIN32
-#else
-#include <unistd.h>
-#endif
-
-#include <yaz/xmalloc.h>
-#include <yaz/options.h>
-#include <yaz/zoom.h>
-
-char *prog = "testclient";
-
-int main(int argc, char **argv)
-{
-    ZOOM_connection z;
-    ZOOM_resultset r;
-    int error;
-    const char *errmsg, *addinfo;
-    char *query = 0;
-    char *target = 0;
-    char *arg;
-    int delay_sec = 0;
-    int expected_hits=-1;
-    int ret;
-    int retrieve_number = 0;
-    int retrieve_offset = 0;
-    char *format = 0;
-    int pos;
-    int check_count = -1;
-    int exit_code = 0;
-
-    while ((ret = options("d:n:o:f:c:", argv, argc, &arg)) != -2)
-    {
-        switch (ret)
-        {
-        case 0:
-            if (!target)
-                target = xstrdup(arg);
-            else if (!query)
-                query = xstrdup(arg);
-            break;
-        case 'd':
-            delay_sec = atoi(arg);
-            break;
-        case 'n':
-            retrieve_number = atoi(arg);
-            break;
-        case 'o':
-            retrieve_offset = atoi(arg);
-            break;
-        case 'f':
-            format = xstrdup(arg);
-            break;
-        case 'c':
-           check_count = atoi(arg);
-           break;
-        default:
-            printf ("%s: unknown option %s\n", prog, arg);
-            printf ("usage:\n%s [options] target query \n", prog);
-            printf (" eg.  indexdata.dk/gils computer\n");
-            exit (1);
-        }
-    }
-
-    if (!target || !target)
-    {
-        printf ("%s: missing target/query\n", prog);
-        printf ("usage:\n%s [options] target query \n", prog);
-        printf (" eg.  bagel.indexdata.dk/gils computer\n");
-        printf ("Options:\n");
-        printf (" -n num       number of records to fetch. Default: 0.\n");
-        printf (" -o off       offset for records - counting from 0.\n");
-        printf (" -f format    set record syntax. Default: none\n");
-        printf (" -d sec       delay a number of seconds before exit.\n");
-        exit (3);
-    }
-    z = ZOOM_connection_new (target, 0);
-    
-    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
-    {
-       printf ("Error: %s (%d) %s\n", errmsg, error, addinfo);
-       exit (2);
-    }
-
-    r = ZOOM_connection_search_pqf (z, query);
-    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
-    {
-       printf ("Error: %s (%d) %s\n", errmsg, error, addinfo);
-       if (check_count != -1)
-            exit_code = 10;
-    }
-    else
-    {
-       printf ("Result count: %d\n", ZOOM_resultset_size(r));
-       if (check_count != -1 && check_count != ZOOM_resultset_size(r))
-       {
-           printf("Wrong number of hits, expected %d, got %d\n",
-                           expected_hits, ZOOM_resultset_size(r) );
-           exit(3);
-       }
-    }
-    if (format)
-        ZOOM_resultset_option_set(r, "preferredRecordSyntax", format);
-    for (pos = 0; pos < retrieve_number; pos++)
-    {
-        int len;
-        const char *rec =
-            ZOOM_record_get(
-                ZOOM_resultset_record(r, pos + retrieve_offset),
-                "render", &len);
-        
-        if (rec)
-            fwrite (rec, 1, len, stdout);
-    }
-    if (delay_sec > 0)
-       sleep(delay_sec);
-    ZOOM_resultset_destroy (r);
-    ZOOM_connection_destroy (z);
-    exit (exit_code);
-}
index 2a3e6e8..6fff3f4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.2 2003-05-20 13:52:41 adam Exp $
+# $Id: Makefile.am,v 1.3 2003-05-21 14:39:22 adam Exp $
 
 dist-hook:
        -mkdir $(distdir)/records
@@ -7,7 +7,9 @@ dist-hook:
        -mkdir $(distdir)/lock
        -mkdir $(distdir)/register
 
-TESTS = test.sh
+check_SCRIPTS = test.sh
 
-EXTRA_DIST = $(TESTS) zebra.cfg user.abs
+TESTS = $(check_SCRIPTS)
+
+EXTRA_DIST = zebra.cfg user.abs $(check_SCRIPTS)
 
index 7899503..cd36ae5 100644 (file)
@@ -1,7 +1,8 @@
-# $Id: Makefile.am,v 1.3 2003-05-20 13:52:41 adam Exp $
+# $Id: Makefile.am,v 1.4 2003-05-21 14:39:23 adam Exp $
 
-TESTS = test1.sh test2.sh test3.sh \
-        simple1.sh
+check_SCRIPTS = test1.sh test2.sh test3.sh simple1.sh
 
-EXTRA_DIST = $(TESTS) zebra.cfg rec
+TESTS = $(check_SCRIPTS)
+
+EXTRA_DIST = zebra.cfg rec.xml simple1.xml $(check_SCRIPTS)
 
diff --git a/test/xpath/rec b/test/xpath/rec
deleted file mode 100644 (file)
index 16afce8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<Zthes>
- <termId>10</termId>
- <termName>Sauropoda</termName>
- <termType>PT</termType>
- <relation>
-  <relationType>BT</relationType>
-  <termId>5</termId>
-  <termName>Brontosauria</termName>
-  <termType>PT</termType>
- </relation>
- <relation>
-  <relationType>NT</relationType>
-  <termId>11</termId>
-  <termName>Eusauropoda</termName>
-  <termType>PT</termType>
- </relation>
-</Zthes>
-<Zthes>
- <termId>5</termId>
- <termName>Brontosauria</termName>
- <termType>PT</termType>
- <relation>
-  <relationType>BT</relationType>
-  <termId>4</termId>
-  <termName>Sauropodomorpha</termName>
-  <termType>PT</termType>
- </relation>
- <relation>
-  <relationType>NT</relationType>
-  <termId>6</termId>
-  <termName>Plateosauria</termName>
-  <termType>PT</termType>
- </relation>
- <relation>
-  <relationType>NT</relationType>
-  <termId>10</termId>
-  <termName>Sauropoda</termName>
-  <termType>PT</termType>
- </relation>
-</Zthes>
diff --git a/test/xpath/rec.xml b/test/xpath/rec.xml
new file mode 100644 (file)
index 0000000..16afce8
--- /dev/null
@@ -0,0 +1,40 @@
+<Zthes>
+ <termId>10</termId>
+ <termName>Sauropoda</termName>
+ <termType>PT</termType>
+ <relation>
+  <relationType>BT</relationType>
+  <termId>5</termId>
+  <termName>Brontosauria</termName>
+  <termType>PT</termType>
+ </relation>
+ <relation>
+  <relationType>NT</relationType>
+  <termId>11</termId>
+  <termName>Eusauropoda</termName>
+  <termType>PT</termType>
+ </relation>
+</Zthes>
+<Zthes>
+ <termId>5</termId>
+ <termName>Brontosauria</termName>
+ <termType>PT</termType>
+ <relation>
+  <relationType>BT</relationType>
+  <termId>4</termId>
+  <termName>Sauropodomorpha</termName>
+  <termType>PT</termType>
+ </relation>
+ <relation>
+  <relationType>NT</relationType>
+  <termId>6</termId>
+  <termName>Plateosauria</termName>
+  <termType>PT</termType>
+ </relation>
+ <relation>
+  <relationType>NT</relationType>
+  <termId>10</termId>
+  <termName>Sauropoda</termName>
+  <termType>PT</termType>
+ </relation>
+</Zthes>
diff --git a/test/xpath/simple1.rec b/test/xpath/simple1.rec
deleted file mode 100644 (file)
index 7a46f7d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<sgml>
-  before
-  <tag>
-    inside
-  </tag>
-  after
-</sgml>
-
-
index 9c7dc55..239811c 100755 (executable)
@@ -1,25 +1,25 @@
 #!/bin/sh
-# $Id: simple1.sh,v 1.2 2003-05-06 17:39:01 adam Exp $
+# $Id: simple1.sh,v 1.3 2003-05-21 14:39:23 adam Exp $
 # test with one simple sgml record
 
 LOG=simple1.log
 ../../index/zebraidx -l $LOG init || exit 1
-../../index/zebraidx -l $LOG update simple1.rec || exit 1
+../../index/zebraidx -l $LOG update simple1.xml || exit 1
 
 echo "Starting server " >> $LOG
 ../../index/zebrasrv -l $LOG -S unix:socket &
 sleep 1
 test -f zebrasrv.pid || exit 2
 
-../testclient unix:socket -c 0 '@attr 1=/sgml/tag before' >> $LOG || exit 1
-../testclient unix:socket -c 1 '@attr 1=/sgml/tag inside' >> $LOG || exit 1
-../testclient unix:socket -c 0 '@attr 1=/sgml/tag after'  >> $LOG || exit 1
+../api/testclient unix:socket -c 0 '@attr 1=/sgml/tag before' >> $LOG || exit 1
+../api/testclient unix:socket -c 1 '@attr 1=/sgml/tag inside' >> $LOG || exit 1
+../api/testclient unix:socket -c 0 '@attr 1=/sgml/tag after'  >> $LOG || exit 1
 
-../testclient unix:socket -c 0 '@attr 1=/sgml/none after'  >> $LOG || exit 1
+../api/testclient unix:socket -c 0 '@attr 1=/sgml/none after'  >> $LOG || exit 1
 
-../testclient unix:socket -c 1 '@attr 1=/sgml before' >> $LOG || exit 1
-../testclient unix:socket -c 1 '@attr 1=/sgml inside' >> $LOG || exit 1
-../testclient unix:socket -c 1 '@attr 1=/sgml after'  >> $LOG || exit 1
+../api/testclient unix:socket -c 1 '@attr 1=/sgml before' >> $LOG || exit 1
+../api/testclient unix:socket -c 1 '@attr 1=/sgml inside' >> $LOG || exit 1
+../api/testclient unix:socket -c 1 '@attr 1=/sgml after'  >> $LOG || exit 1
 
 echo "killing server " >> $LOG
 kill `cat zebrasrv.pid` || exit 3
diff --git a/test/xpath/simple1.xml b/test/xpath/simple1.xml
new file mode 100644 (file)
index 0000000..7a46f7d
--- /dev/null
@@ -0,0 +1,9 @@
+<sgml>
+  before
+  <tag>
+    inside
+  </tag>
+  after
+</sgml>
+
+
index 9986e35..c3dbc14 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
-# $Id: test1.sh,v 1.2 2003-05-06 17:39:01 adam Exp $
+# $Id: test1.sh,v 1.3 2003-05-21 14:39:23 adam Exp $
 LOG=test1.log
 rm -f $LOG
 ../../index/zebraidx -l $LOG init || exit 1
-../../index/zebraidx -l $LOG -t grs.sgml update rec || exit 2
+../../index/zebraidx -l $LOG -t grs.sgml update rec.xml || exit 2
index 6b54af7..89cbfe2 100755 (executable)
@@ -1,16 +1,16 @@
 #!/bin/sh
-# $Id: test2.sh,v 1.2 2003-05-06 17:39:01 adam Exp $
+# $Id: test2.sh,v 1.3 2003-05-21 14:39:23 adam Exp $
 LOG=test2.log
 TMP=test2.tmp
 rm -f $LOG
 rm -f $TMP
 ../../index/zebraidx -l $LOG init || exit 1
-../../index/zebraidx -l $LOG -t grs.sgml update rec || exit 2
+../../index/zebraidx -l $LOG -t grs.sgml update rec.xml || exit 2
 test -f dict*.mf || exit 1
 ../../index/zebrasrv -l $LOG -S unix:socket & 
 sleep 1
 test -f zebrasrv.pid || exit 2
-../testclient unix:socket '@attr 1=/Zthes/termName Sauropoda' >$TMP
+../api/testclient unix:socket '@attr 1=/Zthes/termName Sauropoda' >$TMP
 echo 'Killing server' >>$LOG
 kill `cat zebrasrv.pid` || exit 3
 cat $TMP >>$LOG
index b37859e..25eb21b 100755 (executable)
@@ -1,16 +1,16 @@
 #!/bin/sh
-# $Id: test3.sh,v 1.2 2003-05-06 17:39:01 adam Exp $
+# $Id: test3.sh,v 1.3 2003-05-21 14:39:23 adam Exp $
 LOG=test3.log
 TMP=test3.tmp
 rm -f $LOG
 rm -f $TMP
 ../../index/zebraidx -l $LOG init || exit 1
-../../index/zebraidx -l $LOG -t grs.sgml update rec || exit 2
+../../index/zebraidx -l $LOG -t grs.sgml update rec.xml || exit 2
 test -f dict*.mf || exit 1
 ../../index/zebrasrv -l $LOG -S unix:socket & 
 sleep 1
 test -f zebrasrv.pid || exit 2
-../testclient unix:socket '@attr 1=/Zthes/relation/termName Sauropoda' >$TMP
+../api/testclient unix:socket '@attr 1=/Zthes/relation/termName Sauropoda' >$TMP
 echo 'Killing server' >>$LOG
 kill `cat zebrasrv.pid` || exit 3
 cat $TMP >>$LOG