void check_http_method_test(){
- int count = 1;
+ int count = 1;
char buffer_ok[CHECK_METHOD_OK_STRING_NUM][256]
= {
}
-void check_http_method_test_thread( int thread_no ){
+void check_http_method_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
- int count = 1;
+ int count = 1;
char buffer[5][256]
= {
CHECK_INPOSSIBLE,
};
+ l7vs::http_protocol_module_base::CHECK_RESULT_TAG check_result;
+
size_t buffer_len = 0;
std::cout << "[Thread_" << thread_no << "] ";
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [30] - [34]
- BOOST_CHECK( check_http_method( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
+ check_result = check_http_method( (const char*)buffer[thread_no-1], buffer_len );
+ if( check_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( check_http_method( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
std::cout << "[Thread_" << thread_no << "] " << "StartTime = [" << start_time.nsec << "]" << std::endl;
std::cout << "[Thread_" << thread_no << "] " << "EndTime = [" << end_time.nsec << "]" << std::endl;
void check_http_version_test(){
- int count = 1;
+ int count = 1;
char buffer_ok[CHECK_VERSION_OK_STRING_NUM][256]
= {
}
-void check_http_version_test_thread( int thread_no ){
+void check_http_version_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
- int count = 1;
+ int count = 1;
char buffer[5][256]
= {
CHECK_INPOSSIBLE,
};
+ l7vs::http_protocol_module_base::CHECK_RESULT_TAG check_result;
+
size_t buffer_len = 0;
std::cout << "[Thread_" << thread_no << "] ";
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [33] - [37]
- BOOST_CHECK( check_http_version( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
+ check_result = check_http_version( (const char*)buffer[thread_no-1], buffer_len );
+ if( check_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( check_http_version( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
std::cout << "[Thread_" << thread_no << "] " << "StartTime = [" << start_time.nsec << "]" << std::endl;
std::cout << "[Thread_" << thread_no << "] " << "EndTime = [" << end_time.nsec << "]" << std::endl;
void check_status_code_test(){
- int count = 1;
+ int count = 1;
char buffer_ok[CHECK_STATUS_CODE_OK_STRING_NUM][256]
= {
}
-void check_status_code_test_thread( int thread_no ){
+void check_status_code_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
- int count = 1;
+ int count = 1;
char buffer[5][256]
= {
CHECK_INPOSSIBLE,
};
+ l7vs::http_protocol_module_base::CHECK_RESULT_TAG check_result;
+
size_t buffer_len = 0;
std::cout << "[Thread_" << thread_no << "] ";
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [20] - [24]
- BOOST_CHECK( check_status_code( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
+ check_result = check_status_code( (const char*)buffer[thread_no-1], buffer_len );
+ if( check_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( check_status_code( (const char*)buffer[thread_no-1], buffer_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
std::cout << "[Thread_" << thread_no << "] " << "StartTime = [" << start_time.nsec << "]" << std::endl;
std::cout << "[Thread_" << thread_no << "] " << "EndTime = [" << end_time.nsec << "]" << std::endl;
}
-void find_uri_test_thread( int thread_no ){
+void find_uri_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
- int count = 1;
+ int count = 1;
char disp_uri[256];
false,
};
+ bool find_result;
+
size_t buffer_len = 0;
size_t uri_offset = 0;
size_t uri_len = 0;
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [11] - [15]
- BOOST_CHECK( find_uri( (const char*)buffer[thread_no-1], buffer_len, uri_offset, uri_len ) == result[thread_no-1] );
+ find_result = find_uri( (const char*)buffer[thread_no-1], buffer_len, uri_offset, uri_len );
+ if( find_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( find_uri( (const char*)buffer[thread_no-1], buffer_len, uri_offset, uri_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
memcpy( disp_uri, buffer[thread_no-1] + uri_offset, uri_len );
std::cout << "[Thread_" << thread_no << "] " << "URI Offset = [" << uri_offset << "]" << std::endl;
}
-void find_status_code_test_thread( int thread_no ){
+void find_status_code_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
- int count = 1;
+ int count = 1;
char disp_status_code[256];
false,
};
+ bool find_result;
+
size_t buffer_len = 0;
size_t status_code_offset = 0;
size_t status_code_len = 0;
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [09] - [13]
- BOOST_CHECK( find_status_code( (const char*)buffer[thread_no-1], buffer_len, status_code_offset, status_code_len ) == result[thread_no-1] );
+ find_result = find_status_code( (const char*)buffer[thread_no-1], buffer_len, status_code_offset, status_code_len );
+ if( find_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( find_status_code( (const char*)buffer[thread_no-1], buffer_len, status_code_offset, status_code_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
memcpy( disp_status_code, buffer[thread_no-1] + status_code_offset, status_code_len );
std::cout << "[Thread_" << thread_no << "] " << "STATUS CODE Offset = [" << status_code_offset << "]" << std::endl;
}
-void find_http_header_test_thread( int thread_no ){
+void find_http_header_test_thread( int thread_no, bool* ret ){
boost::xtime start_time;
boost::xtime end_time;
"X-Forwarded-For2: 40.40.40.40",
};
+ bool find_result;
+
size_t buffer_len = 0;
size_t http_header_offset = 0;
size_t http_header_len = 0;
}
boost::xtime_get(&start_time, boost::TIME_UTC);
// [63] - [67]
- BOOST_CHECK( find_http_header( (const char*)buffer_all, buffer_len, http_header_name[thread_no-1], http_header_offset, http_header_len ) == result[thread_no-1] );
+ find_result = find_http_header( (const char*)buffer_all, buffer_len, http_header_name[thread_no-1], http_header_offset, http_header_len );
+ if( find_result == result[thread_no-1] ){
+ *ret = true;
+ }
+ else{
+ *ret = false;
+ }
+// BOOST_CHECK( find_http_header( (const char*)buffer_all, buffer_len, http_header_name[thread_no-1], http_header_offset, http_header_len ) == result[thread_no-1] );
boost::xtime_get(&end_time, boost::TIME_UTC);
memcpy( disp_http_header, buffer_all + http_header_offset, http_header_len );
};
//--test functions--
-void check_http_method_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void check_http_method_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->check_http_method_test_thread(thread_no);
+ http_protocol_module_base_test_1->check_http_method_test_thread( thread_no, ret );
}
}
void check_http_method_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- check_http_method test start -----" );
BOOST_MESSAGE( "----- check_http_method test multi thread start -----" );
boost::thread t1( boost::bind( &check_http_method_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &check_http_method_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &check_http_method_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &check_http_method_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &check_http_method_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- check_http_method test multi thread end -----" );
}
//-------------------------------------------------------------------
-void check_http_version_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void check_http_version_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->check_http_version_test_thread(thread_no);
+ http_protocol_module_base_test_1->check_http_version_test_thread( thread_no, ret );
}
}
void check_http_version_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- check_http_version test start -----" );
BOOST_MESSAGE( "----- check_http_version test multi thread start -----" );
boost::thread t1( boost::bind( &check_http_version_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &check_http_version_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &check_http_version_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &check_http_version_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &check_http_version_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- check_http_version test multi thread end -----" );
}
//-------------------------------------------------------------------
-void check_status_code_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void check_status_code_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->check_status_code_test_thread(thread_no);
+ http_protocol_module_base_test_1->check_status_code_test_thread( thread_no, ret );
}
}
void check_status_code_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- check_status_code test start -----" );
BOOST_MESSAGE( "----- check_status_code test multi thread start -----" );
boost::thread t1( boost::bind( &check_status_code_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &check_status_code_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &check_status_code_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &check_status_code_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &check_status_code_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- check_status_code test multi thread end -----" );
}
//-------------------------------------------------------------------
-void find_uri_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void find_uri_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->find_uri_test_thread(thread_no);
+ http_protocol_module_base_test_1->find_uri_test_thread( thread_no, ret );
}
}
void find_uri_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- find_uri test start -----" );
BOOST_MESSAGE( "----- find_uri test multi thread start -----" );
boost::thread t1( boost::bind( &find_uri_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &find_uri_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &find_uri_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &find_uri_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &find_uri_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- find_uri test multi thread end -----" );
}
//-------------------------------------------------------------------
-void find_status_code_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void find_status_code_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->find_status_code_test_thread(thread_no);
+ http_protocol_module_base_test_1->find_status_code_test_thread( thread_no, ret );
}
}
void find_status_code_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- find_status_code test start -----" );
BOOST_MESSAGE( "----- find_status_code test multi thread start -----" );
boost::thread t1( boost::bind( &find_status_code_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &find_status_code_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &find_status_code_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &find_status_code_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &find_status_code_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- find_status_code test multi thread end -----" );
}
//-------------------------------------------------------------------
-void find_http_header_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no ){
+void find_http_header_test_thread( http_protocol_module_base_test* http_protocol_module_base_test_1, int thread_no, bool* ret ){
for( int i = 0; i < THREAD_LOOP_NUM; i++ ){
- http_protocol_module_base_test_1->find_http_header_test_thread(thread_no);
+ http_protocol_module_base_test_1->find_http_header_test_thread( thread_no, ret );
}
}
void find_http_header_test(){
+ bool thread_1;
+ bool thread_2;
+ bool thread_3;
+ bool thread_4;
+ bool thread_5;
+
http_protocol_module_base_test http_protocol_module_base_test_1( "cinsert" );
BOOST_MESSAGE( "----- find_http_header test start -----" );
BOOST_MESSAGE( "----- find_http_header test multi thread start -----" );
boost::thread t1( boost::bind( &find_http_header_test_thread,
- &http_protocol_module_base_test_1, 1));
+ &http_protocol_module_base_test_1, 1, &thread_1));
boost::thread t2( boost::bind( &find_http_header_test_thread,
- &http_protocol_module_base_test_1, 2));
+ &http_protocol_module_base_test_1, 2, &thread_2));
boost::thread t3( boost::bind( &find_http_header_test_thread,
- &http_protocol_module_base_test_1, 3));
+ &http_protocol_module_base_test_1, 3, &thread_3));
boost::thread t4( boost::bind( &find_http_header_test_thread,
- &http_protocol_module_base_test_1, 4));
+ &http_protocol_module_base_test_1, 4, &thread_4));
boost::thread t5( boost::bind( &find_http_header_test_thread,
- &http_protocol_module_base_test_1, 5));
+ &http_protocol_module_base_test_1, 5, &thread_5));
sleep(1);
t3.join();
t4.join();
t5.join();
+
+ BOOST_CHECK( thread_1 == true );
+ BOOST_CHECK( thread_2 == true );
+ BOOST_CHECK( thread_3 == true );
+ BOOST_CHECK( thread_4 == true );
+ BOOST_CHECK( thread_5 == true );
+
BOOST_MESSAGE( "----- find_http_header test multi thread end -----" );
}
//-------------------------------------------------------------------