Test uses api rather than server&client.
authorAdam Dickmeiss <adam@indexdata.dk>
Sat, 4 Dec 2004 00:51:39 +0000 (00:51 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Sat, 4 Dec 2004 00:51:39 +0000 (00:51 +0000)
test/rusmarc/.cvsignore
test/rusmarc/Makefile.am
test/rusmarc/t1.c [new file with mode: 0644]
test/rusmarc/test.sh
test/rusmarc/test1.sh [deleted file]
test/rusmarc/zebra.cfg

index 1327a1d..e5c2f0f 100644 (file)
@@ -6,3 +6,8 @@ tmp
 zebrasrv.pid
 socket
 *.log
+*.mf
+*.LCK
+.deps
+.libs
+t1
index 9c32826..9891389 100644 (file)
@@ -1,13 +1,33 @@
-# $Id: Makefile.am,v 1.4 2004-03-09 18:52:37 adam Exp $
+# $Id: Makefile.am,v 1.5 2004-12-04 00:51:39 adam Exp $
 
-check_SCRIPTS = test1.sh
+check_PROGRAMS = t1
 
-TESTS = $(check_SCRIPTS)
+TESTS = $(check_PROGRAMS)
 
-EXTRA_DIST = zebra.cfg test.sh $(check_SCRIPTS)
+EXTRA_DIST = zebra.cfg test.sh 
 
 dist-hook:
        mkdir -p $(distdir)/records
        mkdir -p $(distdir)/tab
        -cp -p $(srcdir)/records/* $(distdir)/records
        -cp -p $(srcdir)/tab/* $(distdir)/tab
+
+t1_SOURCES = t1.c
+
+AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC)
+
+zebralibs = \
+ ../../index/libidzebra-api.la \
+ ../../rset/libidzebra-rset.la \
+ ../../recctrl/libidzebra-recctrl.la \
+ ../../dict/libidzebra-dict.la  \
+ ../../isams/libidzebra-isams.la \
+ ../../isamc/libidzebra-isamc.la \
+ ../../isamb/libidzebra-isamb.la \
+ ../../data1/libidzebra-data1.la \
+ ../../bfile/libidzebra-bfile.la \
+ ../../dfa/libidzebra-dfa.la \
+ ../../util/libidzebra-util.la
+
+LDADD = ../api/libtestlib.a $(zebralibs) $(YAZLALIB)
+
diff --git a/test/rusmarc/t1.c b/test/rusmarc/t1.c
new file mode 100644 (file)
index 0000000..f1a9ec3
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id: t1.c,v 1.1 2004-12-04 00:51:39 adam Exp $
+   Copyright (C) 2003,2004
+   Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include "../api/testlib.h"
+
+int main(int argc, char **argv)
+{
+    ZebraService zs = start_up(0, argc, argv);
+    ZebraHandle  zh = zebra_open(zs);
+    char path[256];
+
+    /* TODO: if koi8-r is unsupported we must OK this test */
+
+    zebra_select_database(zh, "Default");
+
+    zebra_init(zh);
+
+    zebra_begin_trans(zh, 1);
+    sprintf(path, "%.200s/records/simple-rusmarc", get_srcdir());
+    zebra_repository_update(zh, path);
+    zebra_end_trans(zh);
+    zebra_commit(zh);
+
+    do_query(__LINE__, zh, "@attr 1=21 \xfa\xc1\xcd\xd1\xd4\xc9\xce", 1);
+
+    return close_down(zh, zs, 0);
+}
index 6003151..183eb7d 100755 (executable)
@@ -1,8 +1,5 @@
 #!/bin/sh
-# $Id: test.sh,v 1.4 2004-03-09 18:45:17 adam Exp $
-test -d tmp || mkdir tmp
-test -d lock || mkdir lock
-test -d register || mkdir register
+# $Id: test.sh,v 1.5 2004-12-04 00:51:39 adam Exp $
 
 echo Loading Records
 if [ -x ../../index/zebraidx ]; then
diff --git a/test/rusmarc/test1.sh b/test/rusmarc/test1.sh
deleted file mode 100755 (executable)
index 44f18ff..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-# $Id: test1.sh,v 1.6 2004-09-27 10:44:52 adam Exp $
-
-pp=${srcdir:-"."}
-
-LOG=test1.log
-rm -f $LOG
-test -d tmp || mkdir tmp
-test -d lock || mkdir lock
-test -d register || mkdir register
-
-if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.marc >/dev/null; then
-        ../../index/zebraidx -c $pp/zebra.cfg -l$LOG init
-else
-        exit 0
-fi
-
-if grep 'UTF-8 to koi8-r unsupported' $LOG >/dev/null; then
-       exit 0
-fi
-../../index/zebraidx -c $pp/zebra.cfg -l$LOG update $pp/records/*marc
-../../index/zebrasrv -c $pp/zebra.cfg -l$LOG unix:socket &
-sleep 1
-# search text located in first record 600 $a
-# term is koi8-r encoded
-../api/testclient unix:socket '@attr 1=21 úÁÍÑÔÉÎ' >tmp1
-echo 'Result count: 1' >tmp2
-kill `cat lock/zebrasrv.pid` || exit 1
-diff tmp1 tmp2 || exit 2
-rm -f tmp1 tmp2
index c5ea4c9..4114c8f 100644 (file)
@@ -1,6 +1,6 @@
 # Simple Zebra configuration file that defines
 # Database with RUSMARC records.
-# $Id: zebra.cfg,v 1.4 2004-09-27 10:44:52 adam Exp $
+# $Id: zebra.cfg,v 1.5 2004-12-04 00:51:39 adam Exp $
 #
 # Where are the config files located?
 profilePath: ${srcdir:-.}/tab:${srcdir:-.}/../../tab
@@ -12,21 +12,6 @@ attset: explain.att
 # Specify record type
 recordType: grs.marc.rusmarc
 
-# Lock File Area
-lockDir: lock
-
-# Temp File area for result sets
-setTmpDir: tmp
-
-# Temp File area for index program
-keyTmpDir: tmp
-
-# Approx. Memory usage during indexing
-memMax: 4
-
-# Specify register area
-register: register:100M
-
 # Default encoding
 encoding: koi8-r