removed StartLibCitadel()
[citadel.git] / libcitadel / tests / stringbuf_IO_test.c
index fcaf24ef468e7502205fc5eabe763413ab722998..984b5beb4c608537068e60868f25bfcf8e0d16bf 100644 (file)
@@ -1,9 +1,8 @@
-
 /*
  *  CUnit - A Unit testing framework library for C.
  *  Copyright (C) 2001  Anil Kumar
  *  
- *  This library is free software; you can redistribute it and/or
+ *  This library is open source software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
  *  License as published by the Free Software Foundation; either
  *  version 2 of the License, or (at your option) any later version.
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *  Library General Public License for more details.
- *
- *  You should have received a copy of the GNU Library General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include <stdio.h>
@@ -142,7 +137,6 @@ static void worker_entry(testfunc F)
 {
        int ssock;
        int i = 0;
-       int fail_this_transaction = 0;
        int ret;
        struct timeval tv;
        fd_set readset, tempset;
@@ -155,7 +149,6 @@ static void worker_entry(testfunc F)
 
        do {
                /* Only one thread can accept at a time */
-               fail_this_transaction = 0;
                ssock = -1; 
                errno = EAGAIN;
                do {
@@ -304,7 +297,7 @@ static void SimpleHttpPostTestFunc(int sock)
        Blob = NewStrBuf();
        Line = NewStrBuf();
 
-       for (i = 0; (i == 0) || (StrLength(Line) != 0); i++) {
+       for (i = 0; 1; i++) {
                StrBufTCP_read_buffered_line_fast(Line, 
                                                  ReadBuffer, 
                                                  &Pos,
@@ -326,6 +319,8 @@ static void SimpleHttpPostTestFunc(int sock)
                                        sizeof("Content-Length:"));
 
                }
+               if (StrLength(Line) == 0)
+                       break;
                FlushStrBuf(Line);
        }
 
@@ -340,6 +335,7 @@ static void SimpleHttpPostTestFunc(int sock)
        TestRevalidateStrBuf(Blob);
        if (err != NULL)
                printf("%s", err);
+       printf("Blob said/read: %d / %d\n", blobsize, StrLength(Blob));
        CU_ASSERT(blobsize != 0);
        CU_ASSERT(blobsize == StrLength(Blob));
        CU_ASSERT_PTR_NULL(err);
@@ -450,16 +446,17 @@ int main(int argc, char* argv[])
                        // else run the simple http test
                        break;
                case 't':
-                       timeout = atoi(optarg);
+                       if (optarg != NULL)
+                               timeout = atoi(optarg);
                        break;
                case 's':
-                       selres = atoi(optarg);
+                       if (optarg != NULL)
+                               selres = atoi(optarg);
                        break;
                }
        }
 
 
-       StartLibCitadel(8);
        CU_BOOL Run = CU_FALSE ;
        
        CU_set_output_filename("TestAutomated");