X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=test%2Fapi%2Ftestlib.c;h=8301cb6f2d188bfd6d617ed1d9b44df923b24ffe;hb=aa7cc3c1655c632a7b3a7053fb5b46b8ce0d3aeb;hp=e960d0d0d7a2708740e6c1aa99edee25531b4495;hpb=0ad2ccc469f9a06aa330f27f6810140ae33e76ec;p=idzebra-moved-to-github.git diff --git a/test/api/testlib.c b/test/api/testlib.c index e960d0d..8301cb6 100644 --- a/test/api/testlib.c +++ b/test/api/testlib.c @@ -1,4 +1,4 @@ -/* $Id: testlib.c,v 1.19 2005-05-09 12:03:59 adam Exp $ +/* $Id: testlib.c,v 1.24 2005-08-09 09:35:26 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -22,6 +22,16 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA /** testlib - utilities for the api tests */ +#if HAVE_SYS_TIME_H +#include +#endif +#if HAVE_SYS_RESOURCE_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif + #include #include #include @@ -34,6 +44,7 @@ int log_level=0; /* not static, t*.c may use it */ void start_log(int argc, char **argv) { + int cmd_level = 0; char logname[2048]; if (!argv) return; @@ -41,9 +52,11 @@ void start_log(int argc, char **argv) return; sprintf(logname, "%s.log", argv[0]); yaz_log_init_file(logname); - log_level = yaz_log_mask_str_x(argv[0],0); - yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level); - yaz_log(log_level,"starting %s",argv[0]); + log_level = yaz_log_mask_str_x(argv[0], 0); + if (argc >= 2) + cmd_level |= yaz_log_mask_str_x(argv[1], 0); + yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level | cmd_level); + yaz_log(log_level, "starting %s", argv[0]); } /** @@ -56,6 +69,14 @@ void start_log(int argc, char **argv) */ ZebraService start_up(char *cfgname, int argc, char **argv) { +#if HAVE_SYS_RESOURCE_H +#if HAVE_SYS_TIME_H + struct rlimit rlim; + rlim.rlim_cur = 20; + rlim.rlim_max = 20; + setrlimit(RLIMIT_CPU, &rlim); +#endif +#endif nmem_init(); start_log(argc, argv); return start_service(cfgname); @@ -217,7 +238,8 @@ void do_scan(int lineno, ZebraHandle zh, const char *query, yaz_log(log_level, "======================================"); yaz_log(log_level, "scan[%d]: pos=%d num=%d %s", lineno, pos, num, query); - res = zebra_scan_PQF(zh, odr, query, &pos, &num, &entries, &partial); + res = zebra_scan_PQF(zh, odr, query, &pos, &num, &entries, &partial, + 0 /* setname */); if (res != ZEBRA_OK) { printf("Error: scan returned %d (FAIL), but no error was expected\n"