Added zebrash test
authorHeikki Levanto <heikki@indexdata.dk>
Fri, 4 Jul 2003 14:25:51 +0000 (14:25 +0000)
committerHeikki Levanto <heikki@indexdata.dk>
Fri, 4 Jul 2003 14:25:51 +0000 (14:25 +0000)
configure.in
index/zebrash.c
test/Makefile.am
test/zsh/Makefile.am [new file with mode: 0644]
test/zsh/testall.sh [new file with mode: 0755]

index 0c7ac56..abae2c7 100644 (file)
@@ -1,5 +1,5 @@
 dnl Zebra, Index Data Aps, 1995-2003
-dnl $Id: configure.in,v 1.80 2003-06-12 18:20:33 adam Exp $
+dnl $Id: configure.in,v 1.81 2003-07-04 14:25:51 heikki Exp $
 dnl
 AC_INIT(include/zebraver.h)
 AM_INIT_AUTOMAKE(idzebra,1.3.12)
@@ -393,7 +393,7 @@ AC_OUTPUT([
   test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
   test/rusmarc/Makefile test/cddb/Makefile
   perl/Makefile.PL test/xelm/Makefile
-  test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile
+  test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
   examples/Makefile examples/gils/Makefile examples/zthes/Makefile
   idzebra.spec
 ])
index f88ce45..84799bf 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebrash.c,v 1.17 2003-07-04 14:00:22 heikki Exp $
+/* $Id: zebrash.c,v 1.18 2003-07-04 14:25:51 heikki Exp $
    Copyright (C) 2002,2003
    Index Data Aps
 
@@ -133,6 +133,16 @@ int cmd_echo( char *args[], WRBUF outbuff)
  
 int cmd_quit( char *args[], WRBUF outbuff)
 {
+    if (zs)
+    {
+        onecommand("zebra_close",outbuff,"");
+        zs=0;
+    }
+    if (zh)
+    {
+        onecommand("zebra_stop",outbuff,"");
+        zh=0;
+    }
     wrbuf_puts(outbuff, "bye");
     return -99; /* special stop signal */
 }
@@ -438,6 +448,7 @@ static int cmd_show( char *args[], WRBUF outbuff)
         }
         nextrecno=start+nrecs+1;
     }
+    odr_destroy(odr);
     return rc;
 }
 /**************************************)
@@ -736,6 +747,7 @@ void shell()
            Zerrors(outbuff);
            printf("%s\n", wrbuf_buf(outbuff));
     } /* while */
+    wrbuf_free(outbuff,1);
 } /* shell() */
   
  
index 71221c3..4796200 100644 (file)
@@ -1,3 +1,3 @@
 
-SUBDIRS=api gils usmarc dmoz xpath sort xelm cddb rusmarc 
+SUBDIRS=api gils usmarc dmoz xpath sort xelm cddb rusmarc zsh
 
diff --git a/test/zsh/Makefile.am b/test/zsh/Makefile.am
new file mode 100644 (file)
index 0000000..ce41508
--- /dev/null
@@ -0,0 +1,13 @@
+# $Id: Makefile.am,v 1.1 2003-07-04 14:25:51 heikki Exp $
+
+#dist-hook:
+#      -mkdir $(distdir)/records
+#      cp $(srcdir)/records/*.grs $(distdir)/records
+
+
+check_SCRIPTS = testall.sh
+
+TESTS = testall.sh
+
+EXTRA_DIST = test1.zsh zebra.cfg
+
diff --git a/test/zsh/testall.sh b/test/zsh/testall.sh
new file mode 100755 (executable)
index 0000000..d5670d6
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# run all zebrash tests
+mkdir -p reg
+rm -f *.mf reg/*.mf *.out
+
+for F in *.zsh
+do
+  echo $F
+  ../../index/zebrash <$F >$F.out 
+  RC=$?
+  if [ "$RC" -gt "0" ]
+  then 
+    echo "$F failed with exit code $RC"
+    FINAL=$RC
+  fi
+done
+if [ "$FINAL" ]
+then
+    echo "Tests FAILED"
+    exit 9
+fi
+echo OK
+exit 0