Convert tests to programs
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Dec 2004 12:04:49 +0000 (12:04 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Dec 2004 12:04:49 +0000 (12:04 +0000)
test/marcxml/.cvsignore
test/marcxml/Makefile.am
test/marcxml/record.abs
test/marcxml/t1.c [new file with mode: 0644]
test/marcxml/t2.c [new file with mode: 0644]
test/marcxml/test1.sh [deleted file]
test/marcxml/test2.sh [deleted file]

index f865cda..c6927d5 100644 (file)
@@ -7,3 +7,7 @@ log
 shadow
 reg
 socket
+t1
+t2
+.libs
+.deps
index b6d8b9a..f5f28ec 100644 (file)
@@ -1,9 +1,29 @@
-# $Id: Makefile.am,v 1.2 2003-10-20 18:56:00 adam Exp $
+# $Id: Makefile.am,v 1.3 2004-12-02 12:04:49 adam Exp $
 
-check_SCRIPTS = test1.sh test2.sh
+check_PROGRAMS = t1 t2
 
-TESTS = $(check_SCRIPTS)
+TESTS = $(check_PROGRAMS)
+
+EXTRA_DIST = zebra.cfg record.abs m1.xml m2.xml m3.xml sample-marc
+
+t1_SOURCES = t1.c
+t2_SOURCES = t2.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)
 
-EXTRA_DIST = zebra.cfg record.abs m1.xml m2.xml m3.xml sample-marc \
- $(check_SCRIPTS)
 
index 5524a11..ac9546e 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: record.abs,v 1.4 2004-08-24 14:29:09 adam Exp $
+# $Id: record.abs,v 1.5 2004-12-02 12:04:49 adam Exp $
 
 name marcxml
 attset bib1.att
@@ -13,4 +13,5 @@ xpath disable
 xelm /record/controlfield[@tag="008"]          Code-Language:w
 xelm /record/datafield[@tag="100"]/subfield[@code="a"] author:w,author:s
 xelm /record/datafield[@tag="245"]/subfield            title:w
+xelm /record/datafield[@tag="650"]             subject-heading:w,subject-heading:p
 
diff --git a/test/marcxml/t1.c b/test/marcxml/t1.c
new file mode 100644 (file)
index 0000000..75c7205
--- /dev/null
@@ -0,0 +1,44 @@
+/* $Id: t1.c,v 1.1 2004-12-02 12:04:49 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);
+
+    zebra_select_database(zh, "Default");
+
+    zebra_init(zh);
+
+    zebra_begin_trans(zh, 1);
+    zebra_repository_update(zh, "m1.xml");
+    zebra_repository_update(zh, "m2.xml");
+    zebra_repository_update(zh, "m3.xml");
+    zebra_end_trans(zh);
+    zebra_commit(zh);
+
+    do_query(__LINE__,zh, "@and @attr 1=54 eng @and @attr 1=1003 jack @attr 1=4 computer", 2);
+
+    return close_down(zh, zs, 0);
+}
diff --git a/test/marcxml/t2.c b/test/marcxml/t2.c
new file mode 100644 (file)
index 0000000..b282708
--- /dev/null
@@ -0,0 +1,44 @@
+/* $Id: t2.c,v 1.1 2004-12-02 12:04:49 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);
+
+    zebra_select_database(zh, "Default");
+
+    zebra_init(zh);
+
+    zebra_set_resource(zh, "recordType", "grs.marcxml.record");
+    
+    zebra_begin_trans(zh, 1);
+    zebra_repository_update(zh, "sample-marc");
+    zebra_end_trans(zh);
+    zebra_commit(zh);
+
+    do_query(__LINE__,zh, "@and @attr 1=1003 jack @attr 1=4 computer", 2);
+
+    return close_down(zh, zs, 0);
+}
diff --git a/test/marcxml/test1.sh b/test/marcxml/test1.sh
deleted file mode 100755 (executable)
index 1490d8e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# $Id: test1.sh,v 1.6 2004-09-27 10:44:51 adam Exp $
-
-pp=${srcdir:-"."}
-
-LOG=test1.log
-DBG="-v 1647"
-
-rm -f $LOG
-if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.xml >/dev/null; then
-       ../../index/zebraidx -c $pp/zebra.cfg -l $LOG $DBG init
-else
-       exit 0
-fi
-../../index/zebraidx -c $pp/zebra.cfg -l $LOG $DBG update $pp/m*.xml
-../../index/zebrasrv -c $pp/zebra.cfg -l $LOG $DBG unix:socket &
-sleep 1
-../api/testclient unix:socket '@and @attr 1=54 eng @and @attr 1=1003 jack @attr 1=4 computer' >tmp1
-echo 'Result count: 2' >tmp2
-kill `cat zebrasrv.pid` || exit 1
-diff tmp1 tmp2 || exit 2
-rm -f tmp1 tmp2
diff --git a/test/marcxml/test2.sh b/test/marcxml/test2.sh
deleted file mode 100755 (executable)
index 6ef8acd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# $Id: test2.sh,v 1.4 2004-09-27 10:44:51 adam Exp $
-
-pp=${srcdir:-"."}
-
-LOG=test2.log
-rm -f $LOG
-
-if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.marcxml >/dev/null ; then
-       ../../index/zebraidx -c $pp/zebra.cfg -l $LOG $DBG init
-else
-        exit 0
-fi
-
-../../index/zebraidx -c $pp/zebra.cfg -l$LOG -t grs.marcxml.record update $pp/sample-marc
-../../index/zebrasrv -c $pp/zebra.cfg -l$LOG unix:socket &
-sleep 1
-../api/testclient unix:socket '@and @attr 1=1003 jack @attr 1=4 computer' >tmp1
-echo 'Result count: 2' >tmp2
-kill `cat zebrasrv.pid` || exit 1
-diff tmp1 tmp2 || exit 2
-rm -f tmp1 tmp2