00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #include "config.h"
00025
00026 #include <unistd.h>
00027
00028 #include <scalestack/kernel/test.h>
00029
00030 class test_suite: public scalestack::kernel::test_suite<test_suite>
00031 {
00032 public:
00033
00034 void setup(void)
00035 {
00036 unlink(".echo.server.stream.test");
00037 add_default_threading_service();
00038 add_default_event_service();
00039 core->add_module_option_value("echo::server::local_stream", "addresses",
00040 ".echo.server.stream.test");
00041 core->add_module_option_value("echo::flood::local_stream", "addresses",
00042 ".echo.server.stream.test");
00043 core->set_signal_handlers();
00044 }
00045
00046 void test_default(void)
00047 {
00048 core->run();
00049 }
00050
00051 void test_iterations(void)
00052 {
00053 core->add_module_option_value("echo::flood::local_stream", "iterations",
00054 "5");
00055 core->run();
00056 }
00057
00058 void test_reconnect(void)
00059 {
00060 core->add_module_option_value("echo::flood::local_stream", "iterations",
00061 "5");
00062 core->add_module_option_value("echo::flood::local_stream", "reconnect",
00063 "True");
00064 core->run();
00065 }
00066
00067 void test_count(void)
00068 {
00069 core->add_module_option_value("echo::flood::local_stream", "count", "5");
00070 core->run();
00071 }
00072
00073 void test_write_size(void)
00074 {
00075 core->add_module_option_value("echo::flood::local_stream", "write_size",
00076 "128");
00077 core->run();
00078 }
00079
00080 void test_buffered_write_size(void)
00081 {
00082 core->add_module_option_value("echo::flood::local_stream", "write_size",
00083 "128");
00084 core->add_module_option_value("echo::flood::local_stream", "flush",
00085 "False");
00086 core->run();
00087 }
00088
00089 void test_large_buffer(void)
00090 {
00091 core->add_module_option_value("echo::flood", "random_buffer_size",
00092 "1048576");
00093 core->run();
00094 }
00095
00096 test_suite(int argc, const char** argv):
00097 scalestack::kernel::test_suite<test_suite>(argc, argv)
00098 {
00099 test_case(test_suite::test_default);
00100 test_case(test_suite::test_iterations);
00101 test_case(test_suite::test_reconnect);
00102 test_case(test_suite::test_count);
00103 test_case(test_suite::test_write_size);
00104 test_case(test_suite::test_buffered_write_size);
00105 test_case(test_suite::test_large_buffer);
00106 }
00107 };
00108
00109 int main(int argc, const char* argv[])
00110 {
00111 test_suite test_suite(argc - 1, argv + 1);
00112 test_suite.run();
00113 return 0;
00114 }