diff --git a/TESTING.md b/TESTING.md index 1d20c31..c7478d6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -30,6 +30,12 @@ Slam tests will test the library's ability to handle many repeated API calls or A comprehensive test will test each aspect of the library one time. +On `host-1`, run: + - `./build/test/linux/selftest test/bob.conf` + +On `host-2`, run: + - `./build/test/linux/selftest test/alice.conf` + ### Random Tests Makes random API calls with random (or plausible arguments/data) to test for proper error handling diff --git a/test/tcpclient4.cpp b/attic/old_tests/tcpclient4.cpp similarity index 100% rename from test/tcpclient4.cpp rename to attic/old_tests/tcpclient4.cpp diff --git a/test/tcpclient6.cpp b/attic/old_tests/tcpclient6.cpp similarity index 100% rename from test/tcpclient6.cpp rename to attic/old_tests/tcpclient6.cpp diff --git a/test/tcpserver4.cpp b/attic/old_tests/tcpserver4.cpp similarity index 100% rename from test/tcpserver4.cpp rename to attic/old_tests/tcpserver4.cpp diff --git a/test/tcpserver6.cpp b/attic/old_tests/tcpserver6.cpp similarity index 100% rename from test/tcpserver6.cpp rename to attic/old_tests/tcpserver6.cpp diff --git a/test/udpclient4.cpp b/attic/old_tests/udpclient4.cpp similarity index 100% rename from test/udpclient4.cpp rename to attic/old_tests/udpclient4.cpp diff --git a/test/udpclient6.cpp b/attic/old_tests/udpclient6.cpp similarity index 100% rename from test/udpclient6.cpp rename to attic/old_tests/udpclient6.cpp diff --git a/test/udpserver4.cpp b/attic/old_tests/udpserver4.cpp similarity index 100% rename from test/udpserver4.cpp rename to attic/old_tests/udpserver4.cpp diff --git a/test/udpserver6.cpp b/attic/old_tests/udpserver6.cpp similarity index 100% rename from test/udpserver6.cpp rename to attic/old_tests/udpserver6.cpp diff --git a/test/testhost2.conf b/test/alice.conf similarity index 56% rename from test/testhost2.conf rename to test/alice.conf index ce3443e..9d04aad 100644 --- a/test/testhost2.conf +++ b/test/alice.conf @@ -1,12 +1,14 @@ nwid c7cd7c9e1b0f52a2 -mode server +mode client -local_path zt2 +local_path zt1 local_port 4545 -local_ipv4 10.9.9.41 +local_port6 4646 +local_ipv4 10.9.9.50 local_ipv6 fde5:cd7a:9edc:0f12:7399:98b2:5722:9143 -remote_path zt1 +remote_path zt2 remote_port 4545 -remote_ipv4 10.9.9.40 +remote_port6 4646 +remote_ipv4 10.9.9.51 remote_ipv6 fde5:cd72:9e17:0fdb:7e99:1369:4d5b:fe3f \ No newline at end of file diff --git a/test/testhost1.conf b/test/bob.conf similarity index 56% rename from test/testhost1.conf rename to test/bob.conf index 41eb0f8..1c0bc73 100644 --- a/test/testhost1.conf +++ b/test/bob.conf @@ -1,12 +1,14 @@ nwid c7cd7c9e1b0f52a2 -mode client +mode server -local_path zt1 +local_path zt2 local_port 4545 -local_ipv4 10.9.9.40 +local_port6 4646 +local_ipv4 10.9.9.51 local_ipv6 fde5:cd72:9e17:0fdb:7e99:1369:4d5b:fe3f -remote_path zt2 +remote_path zt1 remote_port 4545 -remote_ipv4 10.9.9.41 +remote_port6 4646 +remote_ipv4 10.9.9.50 remote_ipv6 fde5:cd7a:9edc:0f12:7399:98b2:5722:9143 \ No newline at end of file diff --git a/test/selftest.cpp b/test/selftest.cpp index ee802e6..215f439 100644 --- a/test/selftest.cpp +++ b/test/selftest.cpp @@ -883,16 +883,18 @@ int main(int argc , char *argv[]) return 1; } - int err = 0; - int type = 0; - int protocol = 0; - int mode = 0; - int port = 0; - int local_port = 0; - int remote_port = 0; - int operation = 0; - int n_count = 0; - int delay = 0; + int err = 0; + int type = 0; + int protocol = 0; + int mode = 0; + int port = 0; + int local_port = 0; + int remote_port = 0; + int local_port6 = 0; + int remote_port6 = 0; + int operation = 0; + int n_count = 0; + int delay = 0; std::string nwid, stype, path = argv[1]; std::string ipstr, ipstr6, local_ipstr, local_ipstr6, remote_ipstr, remote_ipstr6; @@ -921,13 +923,18 @@ int main(int argc , char *argv[]) local_port = atoi(testConf["local_port"].c_str()); remote_port = atoi(testConf["remote_port"].c_str()); + local_port6 = atoi(testConf["local_port6"].c_str()); + remote_port6 = atoi(testConf["remote_port6"].c_str()); + fprintf(stderr, "local_ipstr = %s\n", local_ipstr.c_str()); fprintf(stderr, "local_ipstr6 = %s\n", local_ipstr6.c_str()); fprintf(stderr, "remote_ipstr = %s\n", remote_ipstr.c_str()); fprintf(stderr, "remote_ipstr6 = %s\n", remote_ipstr6.c_str()); fprintf(stderr, "remote_port = %d\n", remote_port); + fprintf(stderr, "remote_port6 = %d\n", remote_port6); fprintf(stderr, "local_port = %d\n", local_port); + fprintf(stderr, "local_port6 = %d\n", local_port6); } else { @@ -1077,16 +1084,14 @@ int main(int argc , char *argv[]) do_test(path, nwid, type, protocol, mode, ipstr, port, operation, n_count, delay); sleep(3); - // IPV6 - printf("performing COMPREHENSIVE ipv6 test\n"); /* Each host must operate as the counterpart to the other, thus, each mode * will call the same test helper functions in different orders * Additionally, the test will use the preset paremeters below for the test: */ -/* + delay = 0; n_count = 10; type = TEST_TYPE_SIMPLE; @@ -1095,13 +1100,13 @@ int main(int argc , char *argv[]) if(mode == TEST_MODE_SERVER) { printf("starting comprehensive test as SERVER\n"); - port = local_port; + port = local_port6; ipstr6 = local_ipstr6; } else if(mode == TEST_MODE_CLIENT) { printf("starting comprehensive test as CLIENT (waiting, giving server time to start)\n"); sleep(10); // give the server some time to come online before beginning test - port = remote_port; + port = remote_port6; ipstr6 = remote_ipstr6; } @@ -1112,13 +1117,13 @@ int main(int argc , char *argv[]) // swtich modes (client/server) if(mode == TEST_MODE_SERVER) { printf("\nswitching from SERVER to CLIENT mode\n"); - port = remote_port; + port = remote_port6; ipstr6 = remote_ipstr6; mode = TEST_MODE_CLIENT; } else if(mode == TEST_MODE_CLIENT) { printf("switching from CLIENT to SERVER mode\n"); - port = local_port; + port = local_port6; ipstr6 = local_ipstr6; mode = TEST_MODE_SERVER; } @@ -1126,7 +1131,6 @@ int main(int argc , char *argv[]) // IPV4 (second test) do_test(path, nwid, type, protocol, mode, ipstr6, port, operation, n_count, delay); sleep(3); - */ }