X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=octopi%2Flibrary%2Ftests_sockets%2Ftest_spocket.cpp;fp=octopi%2Flibrary%2Ftests_sockets%2Ftest_spocket.cpp;h=506566bb75fc8ac0bfece10d017456b10d05ff1f;hb=ee7596ce4d372d632f1d1555de9afd30b622bf29;hp=25881724d7908960b4e64b52179c2455347d9657;hpb=567f3ce3668cc050498387b5e221b7ea4bf1badd;p=feisty_meow.git diff --git a/octopi/library/tests_sockets/test_spocket.cpp b/octopi/library/tests_sockets/test_spocket.cpp index 25881724..506566bb 100644 --- a/octopi/library/tests_sockets/test_spocket.cpp +++ b/octopi/library/tests_sockets/test_spocket.cpp @@ -100,6 +100,7 @@ bool test_spocket::parse_address(const astring &input, ip_address_holder &ip_add int test_spocket::execute() { FUNCDEF("execute"); +LOG("OY POINT A"); ip_address_holder ip_address; // accumulates the source address. int rcv_port = 0; bool is_client = false; @@ -107,10 +108,12 @@ int test_spocket::execute() int send_count = 0; const char *DEFAULT_HOST = "127.0.0.1"; - const int DEFAULT_PORT = 12342; + const int DEFAULT_PORT = 12348; const int DEFAULT_SEND_SIZE = 1008; const int DEFAULT_SEND_COUNT = 10; +LOG("OY POINT B"); + if (_global_argc < 6) { if (_global_argc > 1) { LOG("\ @@ -134,15 +137,19 @@ expected during a cycle."); } } +LOG("OY POINT C"); + // only parse the parameters if we got enough from the user; otherwise we accept our // defaults to do a simple test run. if (_global_argc >= 6) { +LOG("OY POINT D"); if (!parse_address(_global_argv[1], ip_address)) { LOG("failed to parse source address."); return 9283; } +LOG("OY POINT E"); LOG(a_sprintf("\tParsed a source of: \"%d.%d.%d.%d\".", (int)ip_address[0], (int)ip_address[1], (int)ip_address[2], (int)ip_address[3])); @@ -181,23 +188,31 @@ expected during a cycle."); LOG(a_sprintf("\tGot a send count of %d.", send_count)); } +LOG("OY POINT Q"); + // package our parameters in a form the tester likes. internet_address to_pass(byte_array(4, ip_address), "", rcv_port); // now, construct our tester object. - spocket_tester tester(to_pass); + spocket_tester *tester = new spocket_tester(to_pass); // choose the appropriate action based on our role. bool outcome; - if (is_client) - outcome = tester.connect(); - else - outcome = tester.accept(_global_argc != 1); + if (is_client) { +LOG("client side is connecting"); + outcome = tester->connect(); + } else { +LOG("server side is accepting"); + outcome = tester->accept(_global_argc != 1); + } if (!outcome) { const char *action = is_client? "connect" : "accept"; LOG(astring("Failed to ") + action + " on the tester."); return 10; } +LOG("success after conn/accept"); + +LOG("OY POINT T"); if (_global_argc == 1) { // launch a paired duplicate of our test so we can chat. @@ -208,30 +223,40 @@ expected during a cycle."); + a_sprintf("%d", DEFAULT_SEND_SIZE) + " " + a_sprintf("%d", DEFAULT_SEND_COUNT), launch_process::RETURN_IMMEDIATELY, kidnum); ASSERT_EQUAL(result, 0, "launching paired process should start successfully"); +LOG("OY POINT U.1"); - // now we try again accepting from our client. - outcome = tester.accept(); + // now we try again accepting from our client side. + outcome = tester->accept(); //hmmm: redundant below. +LOG("OY POINT U.2"); if (!outcome) { const char *action = is_client? "connect" : "accept"; +LOG("OY POINT U.3"); LOG(astring("Failed to ") + action + " on the tester."); return 10; } } +LOG("OY POINT V"); // so, we're connected. try sending the test packages out. testing_statistics stats; // to be filled by the tester. - outcome = tester.perform_test(send_size, send_count * 2, stats); +LOG("OY POINT V.1"); + outcome = tester->perform_test(send_size, send_count * 2, stats); // multiply send_count since we count each side as one. +LOG("OY POINT V.2"); if (!outcome) { LOG("Failed out of send_data; maybe other side terminated."); } +LOG("OY POINT V.3"); stats.total_runs /= 2; // cut down to the real number of tests. +LOG("OY POINT V.4"); if (!stats.total_runs) stats.total_runs = 1; +LOG("OY POINT W"); + // now report on the stats that we get from the data sending. LOG(a_sprintf("Report for %d completed test cycles.", stats.total_runs)); LOG("");