From d576d9f0ae1a45fef6fe3281cac1a24999fc8106 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 14 Jun 2004 23:43:32 +0000 Subject: [PATCH] Prepare for srcdir != dstdir in tests. --- test/api/t1.c | 14 ++++++++++++-- test/api/t2.c | 14 ++++++++++++-- test/api/t3.c | 13 +++++++++++-- test/api/t4.c | 15 ++++++++++++--- test/api/t5.c | 13 +++++++++++-- test/api/zebra.cfg | 6 +++--- 6 files changed, 61 insertions(+), 14 deletions(-) diff --git a/test/api/t1.c b/test/api/t1.c index 26c8ac4..2b06fa9 100644 --- a/test/api/t1.c +++ b/test/api/t1.c @@ -1,4 +1,4 @@ -/* $Id: t1.c,v 1.5 2004-06-14 21:43:44 adam Exp $ +/* $Id: t1.c,v 1.6 2004-06-14 23:43:32 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -20,9 +20,19 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include +/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ +static ZebraService start_service() +{ + char cfg[256]; + char *srcdir = getenv("srcdir"); + sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg, 0, 0); +} + int main(int argc, char **argv) { ZebraService zs; @@ -30,7 +40,7 @@ int main(int argc, char **argv) yaz_log_init_file("t1.log"); nmem_init(); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_close (zh); diff --git a/test/api/t2.c b/test/api/t2.c index c911a31..beb66d6 100644 --- a/test/api/t2.c +++ b/test/api/t2.c @@ -1,4 +1,4 @@ -/* $Id: t2.c,v 1.9 2004-06-14 21:43:44 adam Exp $ +/* $Id: t2.c,v 1.10 2004-06-14 23:43:32 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -20,9 +20,19 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include +/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ +static ZebraService start_service() +{ + char cfg[256]; + char *srcdir = getenv("srcdir"); + sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg, 0, 0); +} + int main(int argc, char **argv) { int exit_code = 0; @@ -38,7 +48,7 @@ int main(int argc, char **argv) nmem_init (); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default"); zebra_init(zh); diff --git a/test/api/t3.c b/test/api/t3.c index b5b2c8d..1239654 100644 --- a/test/api/t3.c +++ b/test/api/t3.c @@ -1,4 +1,4 @@ -/* $Id: t3.c,v 1.6 2004-06-14 21:43:44 adam Exp $ +/* $Id: t3.c,v 1.7 2004-06-14 23:43:32 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,6 +24,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ +static ZebraService start_service() +{ + char cfg[256]; + char *srcdir = getenv("srcdir"); + sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg, 0, 0); +} + int main(int argc, char **argv) { int i; @@ -38,7 +47,7 @@ int main(int argc, char **argv) nmem_init (); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default"); zebra_init(zh); diff --git a/test/api/t4.c b/test/api/t4.c index 54a0053..4d3da92 100644 --- a/test/api/t4.c +++ b/test/api/t4.c @@ -1,4 +1,4 @@ -/* $Id: t4.c,v 1.6 2004-06-14 21:43:44 adam Exp $ +/* $Id: t4.c,v 1.7 2004-06-14 23:43:32 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,6 +24,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ +static ZebraService start_service() +{ + char cfg[256]; + char *srcdir = getenv("srcdir"); + sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg, 0, 0); +} + int main(int argc, char **argv) { int i; @@ -38,7 +47,7 @@ int main(int argc, char **argv) nmem_init (); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_init(zh); zebra_select_database(zh, "Default"); @@ -50,7 +59,7 @@ int main(int argc, char **argv) zebra_close(zh); zebra_stop(zs); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default"); diff --git a/test/api/t5.c b/test/api/t5.c index a19de00..5313f87 100644 --- a/test/api/t5.c +++ b/test/api/t5.c @@ -1,4 +1,4 @@ -/* $Id: t5.c,v 1.1 2004-06-14 21:43:44 adam Exp $ +/* $Id: t5.c,v 1.2 2004-06-14 23:43:32 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -24,6 +24,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include +/* read zebra.cfg from env var srcdir if it exists; otherwise current dir */ +static ZebraService start_service() +{ + char cfg[256]; + char *srcdir = getenv("srcdir"); + sprintf(cfg, "%.200s%szebra.cfg", srcdir ? srcdir : "", srcdir ? "/" : ""); + return zebra_start(cfg, 0, 0); +} + static void expect(ZebraHandle zh, const char *pqf, int hits_expect, int *exit_code) { @@ -58,7 +67,7 @@ int main(int argc, char **argv) nmem_init (); - zs = zebra_start("zebra.cfg", 0, 0); + zs = start_service(); zh = zebra_open (zs); zebra_select_database(zh, "Default"); zebra_init(zh); diff --git a/test/api/zebra.cfg b/test/api/zebra.cfg index d4aca09..070f077 100644 --- a/test/api/zebra.cfg +++ b/test/api/zebra.cfg @@ -1,9 +1,9 @@ -# $Id: zebra.cfg,v 1.1 2004-06-14 21:43:44 adam Exp $ -profilepath: ../../tab +# $Id: zebra.cfg,v 1.2 2004-06-14 23:43:32 adam Exp $ +profilepath: ../../tab:${srcdir}/../../tab attset: bib1.att recordType: grs.sgml -isam: b +isam: b -- 1.7.10.4