[prev in list] [next in list] [prev in thread] [next in thread] 

List:       curl-commits
Subject:    cvs: curl /tests/data test506  /tests/libtest lib506.c
From:       "Daniel Stenberg" <bagder () php ! net>
Date:       2003-12-16 9:49:36
[Download RAW message or body]

bagder		Tue Dec 16 04:49:36 2003 EDT

  Modified files:              
    /curl/tests/data	test506 
    /curl/tests/libtest	lib506.c 
  Log:
  modified and corrected test 506
  
  
Index: curl/tests/data/test506
diff -u curl/tests/data/test506:1.2 curl/tests/data/test506:1.3
--- curl/tests/data/test506:1.2	Sun Oct 12 09:57:41 2003
+++ curl/tests/data/test506	Tue Dec 16 04:49:36 2003
@@ -63,73 +63,79 @@
 CURL_LOCK_DATA_DNS
 *** run 1
 CURLOPT_SHARE
-lock:   share   <Pigs in space>
-unlock: share   <Pigs in space>
+lock:   share  <Pigs in space>: 0
+unlock: share  <Pigs in space>: 1
 PERFORM
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   dns    <Pigs in space>: 2
+unlock: dns    <Pigs in space>: 3
+lock:   dns    <Pigs in space>: 4
+unlock: dns    <Pigs in space>: 5
+lock:   cookie <Pigs in space>: 6
+unlock: cookie <Pigs in space>: 7
+lock:   cookie <Pigs in space>: 8
+unlock: cookie <Pigs in space>: 9
+lock:   cookie <Pigs in space>: 10
+unlock: cookie <Pigs in space>: 11
+lock:   cookie <Pigs in space>: 12
+unlock: cookie <Pigs in space>: 13
 run 1: set cookie 1, 2 and 3
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
+lock:   dns    <Pigs in space>: 14
+unlock: dns    <Pigs in space>: 15
+lock:   dns    <Pigs in space>: 16
+unlock: dns    <Pigs in space>: 17
 CLEANUP
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   cookie <Pigs in space>: 18
+unlock: cookie <Pigs in space>: 19
 *** run 2
 CURLOPT_SHARE
-lock:   share   <Pigs in space>
-unlock: share   <Pigs in space>
+lock:   share  <Pigs in space>: 20
+unlock: share  <Pigs in space>: 21
 PERFORM
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   dns    <Pigs in space>: 22
+unlock: dns    <Pigs in space>: 23
+lock:   cookie <Pigs in space>: 24
+unlock: cookie <Pigs in space>: 25
+lock:   cookie <Pigs in space>: 26
+unlock: cookie <Pigs in space>: 27
+lock:   cookie <Pigs in space>: 28
+unlock: cookie <Pigs in space>: 29
 run 2: set cookie 4 and 5
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
+lock:   dns    <Pigs in space>: 30
+unlock: dns    <Pigs in space>: 31
+lock:   dns    <Pigs in space>: 32
+unlock: dns    <Pigs in space>: 33
 CLEANUP
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   cookie <Pigs in space>: 34
+unlock: cookie <Pigs in space>: 35
 *** run 3
 CURLOPT_SHARE
-lock:   share   <Pigs in space>
-unlock: share   <Pigs in space>
+lock:   share  <Pigs in space>: 36
+unlock: share  <Pigs in space>: 37
 CURLOPT_COOKIEJAR
 PERFORM
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   dns    <Pigs in space>: 38
+unlock: dns    <Pigs in space>: 39
+lock:   cookie <Pigs in space>: 40
+unlock: cookie <Pigs in space>: 41
+lock:   cookie <Pigs in space>: 42
+unlock: cookie <Pigs in space>: 43
+lock:   cookie <Pigs in space>: 44
+unlock: cookie <Pigs in space>: 45
 run 3: overwrite cookie 1 and 4
-lock:   dns     <Pigs in space>
-unlock: dns     <Pigs in space>
+lock:   dns    <Pigs in space>: 46
+unlock: dns    <Pigs in space>: 47
+lock:   dns    <Pigs in space>: 48
+unlock: dns    <Pigs in space>: 49
 try SHARE_CLEANUP...
-lock:   share   <Pigs in space>
-unlock: share   <Pigs in space>
+lock:   share  <Pigs in space>: 50
+unlock: share  <Pigs in space>: 51
 SHARE_CLEANUP failed, correct
 CLEANUP
-lock:   cookie  <Pigs in space>
-unlock: cookie  <Pigs in space>
+lock:   cookie <Pigs in space>: 52
+unlock: cookie <Pigs in space>: 53
 SHARE_CLEANUP
-lock:   share   <Pigs in space>
-unlock: share   <Pigs in space>
+lock:   share  <Pigs in space>: 54
+unlock: share  <Pigs in space>: 55
 GLOBAL_CLEANUP
 </stdout>
 <stderr>
Index: curl/tests/libtest/lib506.c
diff -u curl/tests/libtest/lib506.c:1.1 curl/tests/libtest/lib506.c:1.2
--- curl/tests/libtest/lib506.c:1.1	Mon Aug 11 02:44:46 2003
+++ curl/tests/libtest/lib506.c	Tue Dec 16 04:49:36 2003
@@ -14,20 +14,27 @@
   char *url;
 };
 
+struct userdata {
+  char *text;
+  int counter;
+};
 
 /* lock callback */
 void lock(CURL *handle, curl_lock_data data, curl_lock_access access,
           void *useptr )
 {
   const char *what;
+  struct userdata *user = (struct userdata *)useptr;
+
   (void)handle;
   (void)access;
+
   switch ( data ) {
     case CURL_LOCK_DATA_SHARE:
-      what = "share ";  
+      what = "share";  
       break;
     case CURL_LOCK_DATA_DNS:
-      what = "dns   ";  
+      what = "dns";  
       break;
     case CURL_LOCK_DATA_COOKIE:
       what = "cookie";  
@@ -36,20 +43,22 @@
       fprintf(stderr, "lock: no such data: %d\n",data);
       return;
   }
-  printf("lock:   %s  <%s>\n", what, (char *)useptr); 
+  printf("lock:   %-6s <%s>: %d\n", what, user->text, user->counter);
+  user->counter++;
 }
 
 /* unlock callback */
 void unlock(CURL *handle, curl_lock_data data, void *useptr )
 {
   const char *what;
+  struct userdata *user = (struct userdata *)useptr;
   (void)handle;
   switch ( data ) {
     case CURL_LOCK_DATA_SHARE:
-      what = "share ";  
+      what = "share";  
       break;
     case CURL_LOCK_DATA_DNS:
-      what = "dns   ";  
+      what = "dns";  
       break;
     case CURL_LOCK_DATA_COOKIE:
       what = "cookie";  
@@ -58,7 +67,8 @@
       fprintf(stderr, "unlock: no such data: %d\n",data);
       return;
   }
-  printf("unlock: %s  <%s>\n", what, (char *)useptr); 
+  printf("unlock: %-6s <%s>: %d\n", what, user->text, user->counter);
+  user->counter++;
 }
 
 
@@ -127,6 +137,10 @@
   CURLSH *share;
   struct curl_slist *headers;
   int i;
+  struct userdata user;
+
+  user.text = (char *)"Pigs in space";
+  user.counter = 0;
   
   printf( "GLOBAL_INIT\n" );
   curl_global_init( CURL_GLOBAL_ALL );
@@ -136,7 +150,7 @@
   share = curl_share_init();
   curl_share_setopt( share, CURLSHOPT_LOCKFUNC,   lock);
   curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, unlock);
-  curl_share_setopt( share, CURLSHOPT_USERDATA,   "Pigs in space");
+  curl_share_setopt( share, CURLSHOPT_USERDATA,   &user);
   printf( "CURL_LOCK_DATA_COOKIE\n" );
   curl_share_setopt( share, CURLSHOPT_SHARE,      CURL_LOCK_DATA_COOKIE);
   printf( "CURL_LOCK_DATA_DNS\n" );




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic