Skip to content
Snippets Groups Projects
Commit 061146b7 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Restored some of the output to reduce confusion...

Rev: src/modules/files/socktest.pike:1.47
parent 43e30240
No related branches found
No related tags found
No related merge requests found
#!/usr/local/bin/pike #!/usr/local/bin/pike
/* $Id: socktest.pike,v 1.46 2008/06/28 00:09:25 nilsson Exp $ */ /* $Id: socktest.pike,v 1.47 2008/07/09 16:24:05 grubba Exp $ */
// #define OOB_DEBUG // #define OOB_DEBUG
...@@ -232,7 +232,7 @@ void got_callback() ...@@ -232,7 +232,7 @@ void got_callback()
#ifdef OOB_DEBUG #ifdef OOB_DEBUG
predef::write(sprintf("%c\b","|/-\\" [ counter & 3 ])); predef::write(sprintf("%c\b","|/-\\" [ counter & 3 ]));
#else /* !OOB_DEBUG */ #else /* !OOB_DEBUG */
if(!verbose && !(counter & 0xf)) if(verbose && !(counter & 0xf))
predef::write(sprintf("%c\b","|/-\\" [ (counter>>4) & 3 ])); predef::write(sprintf("%c\b","|/-\\" [ (counter>>4) & 3 ]));
#endif /* OOB_DEBUG */ #endif /* OOB_DEBUG */
#ifdef BACKEND #ifdef BACKEND
...@@ -277,7 +277,7 @@ void got_oob1(mixed ignored, string got) ...@@ -277,7 +277,7 @@ void got_oob1(mixed ignored, string got)
#endif #endif
got_callback(); got_callback();
if (got != expected) { if (got != expected) {
write(sprintf("loopback: Received unexpected oob data " write(sprintf("\nloopback: Received unexpected oob data "
"(0x%02x != 0x%02x)\n", "(0x%02x != 0x%02x)\n",
got[0], expected[0])); got[0], expected[0]));
exit(1); exit(1);
...@@ -303,7 +303,7 @@ void got_oob0(mixed ignored, string got) ...@@ -303,7 +303,7 @@ void got_oob0(mixed ignored, string got)
#endif #endif
got_callback(); got_callback();
if (got != expected) { if (got != expected) {
write(sprintf("loopback: Received unexpected oob data " write(sprintf("\nloopback: Received unexpected oob data "
"(0x%02x != 0x%02x)\n", "(0x%02x != 0x%02x)\n",
got[0], expected[0])); got[0], expected[0]));
exit(1); exit(1);
...@@ -422,13 +422,14 @@ array(object) spair(int type) ...@@ -422,13 +422,14 @@ array(object) spair(int type)
mixed keeper; mixed keeper;
int testno = 0;
void test_write(string str) void test_write(string str)
{ {
if( verbose ) if( verbose )
write(str); write("\n" + str);
else
write("\r \r" + str);
// else // else
// write("Test %d\r", ++testno); // write("Test %d\r", _tests);
} }
void finish() void finish()
...@@ -437,14 +438,16 @@ void finish() ...@@ -437,14 +438,16 @@ void finish()
num_running--; num_running--;
if(!num_running) if(!num_running)
{ {
if( verbose )
write("\n");
object sock1, sock2; object sock1, sock2;
array(object) socks; array(object) socks;
int tests; int tests;
_tests++; _tests++;
#ifdef IPV6
// Linux 2.6.x seems to hang when running out of IPV6 ports
// on the loopback. Give it some time to clean up its act...
sleep(!(_tests&3));
#endif
switch(_tests) switch(_tests)
{ {
case 1: case 1:
...@@ -573,6 +576,7 @@ void finish() ...@@ -573,6 +576,7 @@ void finish()
#endif /* constant(Stdio.__OOB__) */ #endif /* constant(Stdio.__OOB__) */
default: default:
write("\n");
exit(delayed_failure); exit(delayed_failure);
break; break;
} }
...@@ -594,12 +598,11 @@ void accept_callback() ...@@ -594,12 +598,11 @@ void accept_callback()
o->expected_data = "foobar" * 4711; o->expected_data = "foobar" * 4711;
} }
int main() int main(int argc, array(string) argv)
{ {
string testargs=getenv()->TESTARGS; string testargs=getenv()->TESTARGS;
if(testargs && argv += testargs?(testargs/" "):({});
(has_value(testargs/" ", "-v") || if(has_value(argv[1..], "-v") || has_value(argv[1..], "--verbose"))
has_value(testargs/" ", "--verbose") ) )
verbose=1; verbose=1;
write("\nSocket test"); write("\nSocket test");
...@@ -696,7 +699,7 @@ int main() ...@@ -696,7 +699,7 @@ int main()
_tests=49; _tests=49;
finish(); finish();
#else /* !OOB_DEBUG */ #else /* !OOB_DEBUG */
write("\nDoing simple tests. "); test_write("\nDoing simple tests. ");
stdtest(); stdtest();
#endif /* OOB_DEBUG */ #endif /* OOB_DEBUG */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment