X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fvsys_conctest.c;fp=tests%2Fvsys_conctest.c;h=5bbb73cbb411b935ea47e07ceb9eafb05148bf7e;hb=78befac2ed9d506d569f0f7fb6123e4a6831c522;hp=c155f800be9a70e82f1342ebe848b8a82ddbac8a;hpb=d3ee8357efd54e74b4f6456c0a3a9d58ed39d58d;p=vsys.git diff --git a/tests/vsys_conctest.c b/tests/vsys_conctest.c index c155f80..5bbb73c 100644 --- a/tests/vsys_conctest.c +++ b/tests/vsys_conctest.c @@ -5,13 +5,14 @@ #include #include #include +#include int main() { FILE *fp = NULL, *fp_in = NULL; FILE *out_fp = NULL, *diff_fp = NULL; - const char* topcmd = "/vservers/pl_netflow/vsys/test.out"; - const char* top_in_file = "/vservers/pl_netflow/vsys/test.in"; + const char* topcmd = "feg/test.out"; + const char* top_in_file = "feg/test.in"; char buf[4096]; int fd_in = -1, fd_out; int res; @@ -19,17 +20,18 @@ int main() int count = 1; struct timeval tv={.tv_sec=5,.tv_usec=0}; - while (count < 100) { + while (count < 10000) { fd_set readSet; int res; int nlines=0; - printf("(.)", count); + printf("(%d)", count); if ((fd_out = open(topcmd, O_RDONLY | O_NONBLOCK)) < 0) { fprintf(stderr, "error executing top\n"); exit(-1); } + if ((fd_in = open(top_in_file, O_WRONLY)) < 0) { fprintf(stderr, "error opening %s\n", top_in_file); exit(-1); @@ -45,7 +47,7 @@ int main() res = select(fd_out + 1, &readSet, NULL, NULL, &tv); if (res < 1) { - printf("select failed\n"); + printf("select failed: %d,%s\n",fd_out,strerror(errno)); exit(-1); } @@ -98,6 +100,7 @@ int main() pclose (diff_fp); fclose(fp); close(fd_in); + close(fd_out); count++; } printf("test successful.\n");