Changeset 2014 for box/trunk/test
- Timestamp:
- 18/12/2007 00:21:38 (4 years ago)
- File:
-
- 1 edited
-
box/trunk/test/basicserver/testbasicserver.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/test/basicserver/testbasicserver.cpp
r2010 r2014 127 127 } 128 128 TEST_THAT(total == LARGE_DATA_SIZE); 129 if (total != LARGE_DATA_SIZE) 130 { 131 BOX_ERROR("Expected " << 132 LARGE_DATA_SIZE << " bytes " << 133 "but was " << total); 134 return; 135 } 136 } 137 { 138 // Send lots of data again 139 char data[LARGE_DATA_BLOCK_SIZE]; 140 for(unsigned int y = 0; y < sizeof(data); y++) 141 { 142 data[y] = y & 0xff; 143 } 144 for(int s = 0; s < (LARGE_DATA_SIZE / LARGE_DATA_BLOCK_SIZE); ++s) 145 { 146 rStream.Write(data, sizeof(data)); 147 } 129 148 } 130 149 … … 346 365 } 347 366 } 367 for(unsigned int c = 0; c < conns.size(); ++c) 368 { 369 // Receive lots of data again 370 char buf[1024]; 371 int total = 0; 372 int r = 0; 373 while(total < LARGE_DATA_SIZE && (r = conns[c]->Read(buf, sizeof(buf))) != 0) 374 { 375 total += r; 376 } 377 TEST_THAT(total == LARGE_DATA_SIZE); 378 } 348 379 349 380 for(unsigned int c = 0; c < conns.size(); ++c) … … 408 439 if(argc >= 2) 409 440 { 410 if(strcmp(argv[1], "srv1") == 0) 441 // this is a quick hack to allow passing some options 442 // to the daemon 443 444 const char* mode = argv[1]; 445 446 if (test_args.length() > 0) 447 { 448 argv[1] = test_args.c_str(); 449 } 450 else 451 { 452 argc--; 453 argv++; 454 } 455 456 if(strcmp(mode, "srv1") == 0) 411 457 { 412 458 // Run very basic daemon 413 459 basicdaemon daemon; 414 return daemon.Main("doesnotexist", argc - 1, argv + 1);415 } 416 else if(strcmp( argv[1], "srv2") == 0)460 return daemon.Main("doesnotexist", argc, argv); 461 } 462 else if(strcmp(mode, "srv2") == 0) 417 463 { 418 464 // Run daemon which accepts connections 419 465 testserver daemon; 420 return daemon.Main("doesnotexist", argc - 1, argv + 1);466 return daemon.Main("doesnotexist", argc, argv); 421 467 } 422 else if(strcmp( argv[1], "srv3") == 0)468 else if(strcmp(mode, "srv3") == 0) 423 469 { 424 470 testTLSserver daemon; 425 return daemon.Main("doesnotexist", argc - 1, argv + 1);426 } 427 else if(strcmp( argv[1], "srv4") == 0)471 return daemon.Main("doesnotexist", argc, argv); 472 } 473 else if(strcmp(mode, "srv4") == 0) 428 474 { 429 475 testProtocolServer daemon; 430 return daemon.Main("doesnotexist", argc - 1, argv + 1);476 return daemon.Main("doesnotexist", argc, argv); 431 477 } 432 478 } … … 437 483 // Launch a basic server 438 484 { 439 std::string cmd = "./test ";485 std::string cmd = "./test --test-daemon-args="; 440 486 cmd += test_args; 441 487 cmd += " srv1 testfiles/srv1.conf"; … … 483 529 // Launch a test forking server 484 530 { 485 std::string cmd = "./test ";531 std::string cmd = "./test --test-daemon-args="; 486 532 cmd += test_args; 487 533 cmd += " srv2 testfiles/srv2.conf"; … … 553 599 // Launch a test SSL server 554 600 { 555 std::string cmd = "./test ";601 std::string cmd = "./test --test-daemon-args="; 556 602 cmd += test_args; 557 603 cmd += " srv3 testfiles/srv3.conf"; … … 634 680 // Launch a test protocol handling server 635 681 { 636 std::string cmd = "./test ";682 std::string cmd = "./test --test-daemon-args="; 637 683 cmd += test_args; 638 684 cmd += " srv4 testfiles/srv4.conf";
Note: See TracChangeset
for help on using the changeset viewer.
