X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=test%2Fapi%2Ft15.c;h=b0e93ad5f2335b51f25bc99cb6c0c78a114ef1f6;hp=ebc190994b245e7df535595fc4565d7ecd3a4a38;hb=1922579d92e1a9559d4c3ab4f1cf461f56c83c3b;hpb=ecb3935e78cd9bcfdebafdee0834cfb1060d7b5e diff --git a/test/api/t15.c b/test/api/t15.c index ebc1909..b0e93ad 100644 --- a/test/api/t15.c +++ b/test/api/t15.c @@ -1,8 +1,5 @@ -/* $Id: t15.c,v 1.4 2006-05-10 08:13:35 adam Exp $ - Copyright (C) 2004-2005 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 Index Data 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 @@ -15,9 +12,9 @@ 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. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #if HAVE_SYS_STAT_H @@ -32,6 +29,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #if HAVE_SYS_WAIT_H #include #endif +#if HAVE_SYS_UTSNAME_H +#include +#endif + +#include #include "testlib.h" @@ -42,7 +44,6 @@ static void update_process(ZebraService zs, int iter) { const char *rec = "some"; ZebraHandle zh = zebra_open(zs, 0); - // printf("update_record i=%d\n", i); zebra_add_record(zh, rec, strlen(rec)); if ((i % 30) == 0 || i == iter-1) zebra_commit(zh); @@ -64,8 +65,8 @@ static void search_process(ZebraService zs, int iter) YAZ_CHECK(hits >= hits_max); if (hits < hits_max) - printf("hits=%lld hits_max=%lld\n", hits, hits_max); - hits_max = hits; + printf("i=%d hits=%lld hits_max=%lld\n", i, hits, hits_max); + hits_max = hits; zebra_close(zh); } } @@ -109,24 +110,37 @@ static void tst(int argc, char **argv) #if HAVE_SYS_WAIT_H #if HAVE_UNISTD_H +#if HAVE_SYS_UTSNAME_H + if (1) { + int tst_with_fork = 1; int status[3]; pid_t pids[3]; - - pids[0] = fork_service(zs, 200, search_process); - pids[1] = fork_service(zs, 20, update_process); - pids[2] = fork_service(zs, 20, update_process); - waitpid(pids[0], &status[0], 0); - YAZ_CHECK(status[0] == 0); - waitpid(pids[1], &status[1], 0); - YAZ_CHECK(status[1] == 0); - waitpid(pids[2], &status[2], 0); - YAZ_CHECK(status[2] == 0); + struct utsname s; + uname(&s); + if (!strcmp(s.sysname, "FreeBSD")) + tst_with_fork = 0; + + yaz_log(YLOG_LOG, "s.sysname=%s tst_with_fork=%d", s.sysname, + tst_with_fork); + if (tst_with_fork) + { + pids[0] = fork_service(zs, 200, search_process); + pids[1] = fork_service(zs, 20, update_process); + pids[2] = fork_service(zs, 20, update_process); + waitpid(pids[0], &status[0], 0); + YAZ_CHECK(status[0] == 0); + waitpid(pids[1], &status[1], 0); + YAZ_CHECK(status[1] == 0); + waitpid(pids[2], &status[2], 0); + YAZ_CHECK(status[2] == 0); + } } #endif #endif - +#endif + YAZ_CHECK(tl_close_down(0, zs)); } TL_MAIN