X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=test%2Fcomm.cpp;fp=test%2Fcomm.cpp;h=688cbf010d51c9a46c84a947afdb2b34852ddc60;hp=5bba916297461a5d437473453f882398f78d85c4;hb=d40453e855e244478c2c39e1459834f474a0ee30;hpb=517d1214577af263bb4d6821e4e7ad9ba8c94901 diff --git a/test/comm.cpp b/test/comm.cpp index 5bba916..688cbf0 100644 --- a/test/comm.cpp +++ b/test/comm.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -76,8 +77,10 @@ class test_comm : public TestFixture { socket_server ss("./socket"); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -106,8 +109,10 @@ class test_comm : public TestFixture socket_server ss("./socket"); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -176,8 +181,10 @@ class test_comm : public TestFixture socket_server ss("./socket"); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -194,6 +201,7 @@ class test_comm : public TestFixture con->write(string().insert(0,100*1024,'y')); } } + std::cerr << "child: OVER" << std::endl; // don't call atexit and stuff _exit(0); } @@ -247,8 +255,10 @@ class test_comm : public TestFixture { socket_server ss(6666); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -277,8 +287,10 @@ class test_comm : public TestFixture socket_server ss(6666); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000); @@ -347,8 +359,10 @@ class test_comm : public TestFixture socket_server ss(6666); ss.set_logging(&cerr,debug); + time_t t0 = time(NULL); + // max 10 sec - for (int i=0; i < 10; i++) + while (time(NULL) < t0 + 10 ) { ss.fill_buffer(1000000);