Changeset 1088:1d1a20a0779d in freeDiameter for tests
- Timestamp:
- May 5, 2013, 4:25:27 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- tests
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/testcnx.c
r974 r1088 715 715 /* For debug: dump the object */ 716 716 fd_log_debug("Dumping CER"); 717 fd_ msg_dump_walk(0, cer);717 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, cer, fd_g_config->cnf_dict, 0, 1)); 718 718 #endif 719 719 -
tests/testdict.c
r788 r1088 192 192 CHECK(1, obj ? 1 : 0 ); 193 193 #if 1 194 fd_ dict_dump_object(obj);194 fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, obj)); 195 195 #endif 196 196 CHECK( 0, fd_dict_delete(obj) ); -
tests/testdisp.c
r1018 r1088 699 699 700 700 #if 0 701 fd_ conf_dump();701 fd_log_debug("%s", fd_conf_dump(FD_DUMP_TEST_PARAMS)); 702 702 #endif 703 703 } -
tests/testfifo.c
r1071 r1088 559 559 CHECK( 14, iter ); 560 560 561 /* fd_fifo_dump(0, "test", queue, NULL); */562 563 561 for (; i < td.nbr; i++) { 564 562 CHECK( 0, fd_fifo_tryget(queue, &item) ); -
tests/testmesg.c
r1047 r1088 61 61 #if 0 62 62 /* For debug: dump the object */ 63 fd_log_debug("Dumping Accounting-Request empty message ");64 fd_ msg_dump_walk( 0, acr);63 fd_log_debug("Dumping Accounting-Request empty message:"); 64 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, acr, fd_g_config->cnf_dict, 0, 1)); 65 65 #endif 66 66 } … … 79 79 /* For debug: dump the object */ 80 80 fd_log_debug("Dumping Proxy-Info AVP"); 81 fd_ msg_dump_walk(0, pi);81 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, pi, fd_g_config->cnf_dict, 0, 1)); 82 82 fd_log_debug("Dumping dictionary model"); 83 fd_ dict_dump_object(pi_model);83 fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, pi_model)); 84 84 #endif 85 85 … … 107 107 /* For debug: dump the object */ 108 108 fd_log_debug("Dumping Accounting-Request with Proxy-Info AVP at the end"); 109 fd_ msg_dump_walk(0, acr);109 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, acr, fd_g_config->cnf_dict, 0, 1)); 110 110 #endif 111 111 } … … 306 306 */ 307 307 #if 0 308 fd_ dict_dump_object ( gavp);308 fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, gavp)); 309 309 #endif 310 310 } 311 311 #if 0 312 312 { 313 fd_ dict_dump_object ( vendor);313 fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, vendor)); 314 314 } 315 315 #endif … … 365 365 #if 0 366 366 fd_log_debug("AVP no vendor, value 3.1415:"); 367 fd_ msg_dump_one(0, avpi);367 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 368 368 #endif 369 369 CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) ); … … 382 382 #if 0 383 383 fd_log_debug("AVP vendor, value 0x123456789abcdeL:"); 384 fd_ msg_dump_one(0, avpi);384 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 385 385 #endif 386 386 CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) ); … … 408 408 #if 0 409 409 fd_log_debug("AVP enum i32, value 2 (from const):"); 410 fd_ msg_dump_one(0, avpi);410 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 411 411 #endif 412 412 } … … 429 429 #if 0 430 430 fd_log_debug("AVP enum i32, value -5 (from const):"); 431 fd_ msg_dump_one(0, avpi);431 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 432 432 #endif 433 433 /* Check the size is correct ( 12 for header + 4 for value ) */ … … 444 444 #if 0 445 445 fd_log_debug("AVP vendor enum i32, value -10 (not const):"); 446 fd_ msg_dump_one(0, avpi);446 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 447 447 #endif 448 448 … … 459 459 #if 0 460 460 fd_log_debug("AVP octet string, 'This\\0 is a b...'"); 461 fd_ msg_dump_one(0, avpi);461 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 462 462 #endif 463 463 CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) ); … … 488 488 #if 0 489 489 fd_log_debug("AVP Enumuerated OctetString (from const):"); 490 fd_ msg_dump_one(0, avpi);490 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 491 491 #endif 492 492 /* Check the size is correct ( 12 for header + 5 for value ) */ … … 513 513 #if 0 514 514 fd_log_debug("AVP Enumuerated OctetString (from const):"); 515 fd_ msg_dump_one(0, avpi);515 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0)); 516 516 #endif 517 517 /* Check the size is correct ( 12 for header + 3 for value ) */ … … 535 535 #if 0 536 536 fd_log_debug("AVP octet string, '1234678'"); 537 fd_ msg_dump_one(0, avpch);537 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpch, fd_g_config->cnf_dict, 0, 0)); 538 538 #endif 539 539 CHECK( 0, fd_msg_update_length ( avpch ) ); … … 548 548 #if 0 549 549 fd_log_debug("AVP octet string, '12346789'"); 550 fd_ msg_dump_one(0, avpch);550 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpch, fd_g_config->cnf_dict, 0, 0)); 551 551 #endif 552 552 } … … 580 580 CHECK( 0, fd_msg_update_length ( msg ) ); 581 581 #if 0 582 fd_ msg_dump_walk(0, msg);582 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 583 583 #endif 584 584 CHECK( 344, msgdata->msg_length ); … … 660 660 CHECK( 0, fd_msg_parse_buffer( &buf_cpy, 344, &msg) ); 661 661 #if 0 662 fd_ msg_dump_walk(0, msg);662 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 663 663 #endif 664 664 … … 733 733 734 734 #if 0 735 fd_ msg_dump_walk(0, msg);735 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 736 736 #endif 737 737 … … 769 769 CHECK( 0, fd_msg_bufferize( msg, &buftmp, NULL ) ); 770 770 771 fd_ msg_dump_walk(0, msg);771 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 772 772 773 773 TODO("Check the Failed-AVP is as expected"); … … 783 783 CHECK( 0, fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ) ); 784 784 #if 0 785 fd_ msg_dump_walk(0, msg);785 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 786 786 #endif 787 787 } … … 1336 1336 /* Okay, now delete the message and parse the buffer, then check we obtain the same values back */ 1337 1337 #if 0 1338 fd_ msg_dump_walk(0, msg);1338 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 1339 1339 #endif 1340 1340 CHECK( 0, fd_msg_free( msg ) ); … … 1343 1343 CHECK( 0, fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ) ); 1344 1344 #if 0 1345 fd_ msg_dump_walk(0, msg);1345 fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1)); 1346 1346 #endif 1347 1347 -
tests/testmesg_stress.c
r1076 r1088 197 197 < grouped > 198 198 */ 199 #if 0 200 fd_dict_dump_object ( gavp ); 201 #endif 202 } 203 #if 0 204 { 205 fd_dict_dump_object ( vendor ); 206 } 207 #endif 199 } 208 200 } 209 201 -
tests/testpeers.c
r748 r1088 57 57 } 58 58 } 59 fd_ peer_dump_list(0);59 fd_log_debug("%s", fd_peer_dump_list(FD_DUMP_TEST_PARAMS, 0)); 60 60 /* Check we are able to find again any of these */ 61 61 { -
tests/tests.h
r1078 r1088 68 68 /* Define the macro to fail a test with a message */ 69 69 #define FAILTEST( message... ){ \ 70 TRACE_ERROR(message); \ 71 TRACE_ERROR("FAILED: %s ", __STRIPPED_FILE__); \ 70 LOG_F(message); \ 71 LOG_F("FAILED: %s ", __STRIPPED_FILE__); \ 72 free(tbuf); \ 72 73 exit(FAIL); \ 73 74 } … … 75 76 /* Define the macro to pass a test */ 76 77 #define PASSTEST( ){ \ 77 TRACE_NOTICE("PASS: %s", __STRIPPED_FILE__);\78 LOG_N("PASS: %s", __STRIPPED_FILE__); \ 78 79 (void)fd_core_shutdown(); \ 79 80 (void)fd_core_wait_shutdown_complete(); \ 80 81 (void)fd_thr_term(&signal_thr); \ 82 free(tbuf); \ 81 83 exit(PASS); \ 82 84 } 83 85 84 static int test_verbo = 0;85 86 static struct fd_config conf; 86 87 extern struct fd_config * fd_g_config; 87 88 89 /* for dumps */ 90 static char * tbuf = NULL; size_t tbuflen = 0; 91 #define FD_DUMP_TEST_PARAMS &tbuf, &tbuflen, NULL 92 93 88 94 /* Define the standard check routines */ 89 95 #define CHECK( _val, _assert ){ \ 90 if (test_verbo > 0) { \ 91 TRACE_NOTICE("CHECK( %s == %s )", \ 96 LOG_D("CHECK( %s == %s )", \ 92 97 #_assert, \ 93 98 #_val); \ 94 }{ \99 { \ 95 100 __typeof__ (_val) __ret = (_assert); \ 96 101 if (__ret != (_val)) { \ … … 143 148 switch (c) { 144 149 case 'd': /* Increase verbosity of debug messages. */ 145 test_verbo++;150 fd_g_debug_lvl--; 146 151 break; 147 152 148 153 case 'q': /* Decrease verbosity. */ 149 test_verbo--;154 fd_g_debug_lvl++; 150 155 break; 151 156 … … 178 183 } 179 184 } 180 fd_g_debug_lvl = (test_verbo > 0) ? (test_verbo - 1) : 0;181 185 if (!no_timeout) { 182 186 alarm(TEST_TIMEOUT); -
tests/testsess.c
r888 r1088 43 43 44 44 #define TEST_EYEC 0x7e57e1ec 45 struct mystate {45 struct sess_state { 46 46 int eyec; /* TEST_EYEC */ 47 47 os0_t sid; /* the session with which the data was registered */ … … 50 50 }; 51 51 52 static void mycleanup( struct mystate * data, os0_t sid, void * opaque )52 static void mycleanup( struct sess_state * data, os0_t sid, void * opaque ) 53 53 { 54 54 /* sanity */ … … 67 67 } 68 68 69 static __inline__ struct mystate * new_state(os0_t sid, int *freed)69 static __inline__ struct sess_state * new_state(os0_t sid, int *freed) 70 70 { 71 struct mystate *new;72 new = malloc(sizeof(struct mystate));71 struct sess_state *new; 72 new = malloc(sizeof(struct sess_state)); 73 73 CHECK( 1, new ? 1 : 0 ); 74 memset(new, 0, sizeof(struct mystate));74 memset(new, 0, sizeof(struct sess_state)); 75 75 new->eyec = TEST_EYEC; 76 76 new->sid = os0dup(sid, strlen((char *)sid)); … … 106 106 { 107 107 void * testptr = NULL; 108 CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup, NULL ) );109 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL ) );108 CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup, NULL, NULL ) ); 109 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL, NULL ) ); 110 110 CHECK( 0, fd_sess_handler_destroy( &hdl2, &testptr ) ); 111 111 CHECK( 1, testptr == NULL ? 1 : 0 ); 112 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, g_opaque ) );113 #if 0 114 fd_ sess_dump_hdl(0, hdl1);115 fd_ sess_dump_hdl(0, hdl2);112 CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL, g_opaque ) ); 113 #if 0 114 fd_log_debug("%s\n", fd_sess_dump_hdl(FD_DUMP_TEST_PARAMS, hdl1)); 115 fd_log_debug("%s\n", fd_sess_dump_hdl(FD_DUMP_TEST_PARAMS, hdl2)); 116 116 #endif 117 117 } … … 123 123 CHECK( 0, fd_sess_new( &sess2, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), NULL, 0 ) ); 124 124 #if 0 125 fd_ sess_dump(0, sess1);126 fd_ sess_dump(0, sess2);125 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 126 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 127 127 #endif 128 128 … … 141 141 CHECK( 0, fd_sess_new( &sess2, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), TEST_OPT, CONSTSTRLEN(TEST_OPT_IN) - 1 ) ); 142 142 #if 0 143 fd_ sess_dump(0, sess1);144 fd_ sess_dump(0, sess2);143 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 144 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 145 145 #endif 146 146 … … 165 165 CHECK( 0, fd_sess_new( &sess2, NULL, 0, TEST_SID, CONSTSTRLEN(TEST_SID_IN) - 1 ) ); 166 166 #if 0 167 fd_ sess_dump(0, sess1);168 fd_ sess_dump(0, sess2);167 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 168 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 169 169 #endif 170 170 CHECK( 0, fd_sess_getsid(sess1, &str1, &str1len) ); … … 211 211 /* Test fd_sess_reclaim */ 212 212 { 213 struct mystate *tms;213 struct sess_state *tms; 214 214 215 215 CHECK( 0, fd_sess_fromsid( TEST_SID, CONSTSTRLEN(TEST_SID_IN), &sess1, &new ) ); … … 271 271 /* Test states operations */ 272 272 { 273 struct mystate * ms[6], *tms;273 struct sess_state * ms[6], *tms; 274 274 int freed[6]; 275 275 struct timespec timeout; … … 295 295 296 296 #if 0 297 fd_ sess_dump(0, sess1);297 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 298 298 #endif 299 299 … … 332 332 333 333 #if 0 334 fd_ sess_dump(0, sess1);335 fd_ sess_dump(0, sess2);336 fd_ sess_dump(0, sess3);334 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 335 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 336 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess3, 1)); 337 337 #endif 338 338 … … 357 357 358 358 #if 1 359 fd_ sess_dump(0, sess1);360 fd_ sess_dump(0, sess2);359 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 360 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 361 361 #endif 362 362 … … 373 373 CHECK( 0, fd_sess_settimeout( sess2, &timeout) ); 374 374 #if 1 375 fd_ sess_dump(0, sess1);376 fd_ sess_dump(0, sess2);375 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1)); 376 fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1)); 377 377 #endif 378 378 timeout.tv_sec = 0;
Note: See TracChangeset
for help on using the changeset viewer.