Changeset 1093:44f3e48dfe27 in freeDiameter for tests
- Timestamp:
- May 6, 2013, 5:33:22 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/testdict.c
r1088 r1093 204 204 } 205 205 206 LOG_D( "Dictionary at the end of %s: %s", __FILE__, fd_dict_dump(FD_DUMP_TEST_PARAMS, fd_g_config->cnf_dict) ?: "error"); 207 206 208 /* That's all for the tests yet */ 207 209 PASSTEST(); -
tests/testmesg_stress.c
r1090 r1093 374 374 CHECK( 0, fd_msg_bufferize( msg, &buf, NULL ) ); 375 375 376 LOG_D( "Test message: %s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, NULL, 0, 1)); 377 376 378 /* Now free the message, we keep only the buffer. */ 377 379 CHECK( 0, fd_msg_free( msg ) ); … … 390 392 struct timespec start, end; 391 393 392 unsigned char * buf_cpy = NULL;393 394 struct msg * msg; 394 395 395 #define CPYBUF() { \396 buf_cpy = malloc(344); \397 CHECK( buf_cpy ? 1 : 0, 1); \398 memcpy(buf_cpy, buf, 344); \399 }400 396 401 397 /* Create the copies of the message buffer */ … … 404 400 405 401 for (i=0; i < test_parameter; i++) { 406 CPYBUF(); 407 stress_array[i].b = buf_cpy; 408 } 402 stress_array[i].b = malloc(344); 403 if (!stress_array[i].b) 404 break; 405 memcpy(stress_array[i].b, buf, 344); 406 } 407 CHECK( test_parameter, i ); /* if false, a malloc failed */ 409 408 410 409 /* fd_msg_parse_buffer */ … … 414 413 /* Test the msg_parse_buffer function */ 415 414 for (i=0; i < test_parameter; i++) { 416 CHECK( 0, fd_msg_parse_buffer( &stress_array[i].b, 344, &stress_array[i].m) ); 417 } 415 if (0 != fd_msg_parse_buffer( &stress_array[i].b, 344, &stress_array[i].m) ) 416 break; 417 } 418 CHECK( test_parameter, i ); /* if false, a call failed */ 418 419 419 420 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) ); … … 426 427 /* Test the fd_msg_parse_dict function */ 427 428 for (i=0; i < test_parameter; i++) { 428 CHECK( 0, fd_msg_parse_dict( stress_array[i].m, fd_g_config->cnf_dict, NULL ) ); 429 } 429 if (0 != fd_msg_parse_dict( stress_array[i].m, fd_g_config->cnf_dict, NULL ) ) 430 break; 431 } 432 CHECK( test_parameter, i ); /* if false, a call failed */ 430 433 431 434 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) ); … … 439 442 /* Test the fd_msg_parse_rules function */ 440 443 for (i=0; i < test_parameter; i++) { 441 CHECK( 0, fd_msg_parse_rules( stress_array[i].m, fd_g_config->cnf_dict, NULL ) ); 442 } 444 if (0 != fd_msg_parse_rules( stress_array[i].m, fd_g_config->cnf_dict, NULL ) ) 445 break; 446 } 447 CHECK( test_parameter, i ); /* if false, a call failed */ 443 448 444 449 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) ); … … 452 457 /* Test the fd_msg_new_answer_from_req function */ 453 458 for (i=0; i < test_parameter; i++) { 454 CHECK( 0, fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, 0 ) ); 455 } 459 if (0 != fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, 0 ) ) 460 break; 461 } 462 CHECK( test_parameter, i ); /* if false, a call failed */ 456 463 457 464 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) ); … … 461 468 for (i=0; i < test_parameter; i++) { 462 469 struct msg * ans = stress_array[i].m; 463 CHECK( 0, fd_msg_answ_getq( ans, &stress_array[i].m ) ); 464 CHECK( 0, fd_msg_answ_detach( ans ) ); 470 if (0 != fd_msg_answ_getq( ans, &stress_array[i].m ) ) 471 break; 472 if (0 != fd_msg_answ_detach( ans ) ) 473 break; 465 474 fd_msg_free( ans ); 466 475 } 476 CHECK( test_parameter, i ); /* if false, a call failed */ 467 477 468 478 … … 473 483 /* Test the fd_msg_new_answer_from_req function */ 474 484 for (i=0; i < test_parameter; i++) { 475 CHECK( 0, fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, MSGFL_ANSW_ERROR ) ); 476 } 485 if ( 0 != fd_msg_new_answer_from_req( fd_g_config->cnf_dict, &stress_array[i].m, MSGFL_ANSW_ERROR ) ) 486 break; 487 } 488 CHECK( test_parameter, i ); /* if false, a call failed */ 477 489 478 490 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) ); … … 482 494 for (i=0; i < test_parameter; i++) { 483 495 struct msg * ans = stress_array[i].m; 484 CHECK( 0, fd_msg_answ_getq( ans, &stress_array[i].m ) ); 485 CHECK( 0, fd_msg_answ_detach( ans ) ); 496 if (0 != fd_msg_answ_getq( ans, &stress_array[i].m ) ) 497 break; 498 if (0 != fd_msg_answ_detach( ans ) ) 499 break; 486 500 fd_msg_free( ans ); 487 501 } … … 496 510 for (i=0; i < test_parameter; i++) { 497 511 size_t len = 0; 498 CHECK( 0, fd_msg_bufferize( stress_array[i].m, &stress_array[i].b, &len ) ); 499 } 512 if (0 != fd_msg_bufferize( stress_array[i].m, &stress_array[i].b, &len ) ) 513 break; 514 } 515 CHECK( test_parameter, i ); /* if false, a call failed */ 500 516 501 517 CHECK( 0, clock_gettime(CLOCK_REALTIME, &end) );
Note: See TracChangeset
for help on using the changeset viewer.