Minor changes to selftest, updated TESTING readme, removed old test personality conf files
This commit is contained in:
56
TESTING.md
56
TESTING.md
@@ -1,17 +1,61 @@
|
||||
## Testing via [selftest.cpp](test/selftest.cpp)
|
||||
|
||||
### Enabling debug output
|
||||
### Step 1. Enabling debug output
|
||||
|
||||
- `SDK_DEBUG=1`: For debugging libzt
|
||||
- `ZT_DEBUG=1`: For debugging the ZeroTier core protocol
|
||||
- `make static_lib SDK_DEBUG=1`: For debugging libzt
|
||||
- `make static_lib ZT_DEBUG=1`: For debugging the ZeroTier core protocol (you usually won't need this)
|
||||
|
||||
After building the static library, you can run:
|
||||
### Step 2. Build the test programs:
|
||||
|
||||
- `make tests`
|
||||
|
||||
This will output `selftest` to `build/$PLATFORM/`. Using this, you can run the tests below. Note, the following examples assume your testing environment is `linux`, you'll see this in the build output path. If this is not true, change it to `darwin`, `freebsd`, or `win` depending on what you're running.
|
||||
This will output `selftest` and `echotest` to `build/$PLATFORM/`
|
||||
|
||||
*Note, the following examples assume your testing environment is `linux`, you'll see this in the build output path. If this is not true, change it to `darwin`, `freebsd`, or `win` depending on what you're running.*
|
||||
|
||||
|
||||
### Step 3. Define your test configuration in `test/selftest.conf`:
|
||||
|
||||
This is essentially just a listing of libzt-based app identities and host machine identities. We will be conducting `library-to-remote-library`, `library-to-remote-host`, and `remote-host-to-library` tests over the network. For this reason we need to define who should be talking to who.
|
||||
|
||||
A simple test configutation might look like the following. This will create an `alice` and `bob` test personality, that is, we will run one instance of the library as a server (alice), and one instance of the `echotest` on the same host machine. `echotest` is merely a program to record timings for transmitted data and also generate data for the library to receive). Additionally we will be running a library as a client `bob` on another remote host as well as another instance of `echotest` on that same machine. In this configuration the following will happen:
|
||||
|
||||
- `alice` libzt will tx/rx to/from `bob` libzt
|
||||
- `alice` libzt will send X bytes to `bob`'s `echotest` to test maximum TX rate
|
||||
- `alice` libzt will request X bytes from `bob`'s `echotest` to test maximum RX rate
|
||||
- `bob` libzt will send X bytes to `alice`'s `echotest` to test maximum TX rate
|
||||
- `bob` libzt will request X bytes from `alice`'s `echotest` to test maximum RX rate
|
||||
|
||||
```
|
||||
# Tests will use ports starting from 'port' to 'port+n' where 'n' is the number of tests
|
||||
|
||||
|
||||
# Alice
|
||||
name alice
|
||||
mode server
|
||||
nwid 17d7094b2c2c7319
|
||||
test comprehensive
|
||||
port 7000
|
||||
path test/alice
|
||||
ipv4 172.30.30.10
|
||||
ipv6 fd12:d719:4b6c:6c53:f799:13c4:07e0:abb8
|
||||
echo_ipv4 172.30.30.1
|
||||
echo_ipv6 fd11:d759:136e:2b53:6791:9328:31ce:618a
|
||||
;
|
||||
|
||||
# Bob
|
||||
name bob
|
||||
mode client
|
||||
nwid 17d7094b2c2c7319
|
||||
test comprehensive
|
||||
port 7000
|
||||
path test/bob
|
||||
ipv4 172.30.30.20
|
||||
ipv6 fd11:d759:136e:2b53:6791:9328:31ce:618a
|
||||
echo_ipv4 172.30.30.2
|
||||
echo_ipv6 fd12:d719:4b6c:6c53:f799:13c4:07e0:abb8
|
||||
```
|
||||
|
||||
Simply add your `host-1` and `host-2` address, port, and network information to `test/alice.conf` and `test/bob.conf`, this way you can use the selftest shorthand shown below. The file contain examples of what you should do.
|
||||
|
||||
Build outputs are as follows:
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
* of your own application.
|
||||
*/
|
||||
|
||||
#ifndef ZT_ZEROTIERSDK_H
|
||||
#define ZT_ZEROTIERSDK_H
|
||||
#ifndef ZT_LIBZT_H
|
||||
#define ZT_LIBZT_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -34,23 +34,30 @@
|
||||
/****************************************************************************/
|
||||
|
||||
#define ZT_SDK_MTU ZT_MAX_MTU
|
||||
#define ZT_PHY_POLL_INTERVAL 10 // ms
|
||||
#define ZT_PHY_POLL_INTERVAL 2 // ms
|
||||
#define ZT_ACCEPT_RECHECK_DELAY 100 // ms (for blocking zts_accept() calls)
|
||||
#define ZT_CONNECT_RECHECK_DELAY 100 // ms (for blocking zts_connect() calls)
|
||||
#define ZT_API_CHECK_INTERVAL 100 // ms
|
||||
#define ZT_API_CHECK_INTERVAL 500 // ms
|
||||
|
||||
#define MAX_PICO_FRAME_RX_BUF_SZ ZT_MAX_MTU * 128
|
||||
|
||||
#define ZT_TCP_TX_BUF_SZ 1024 * 1024 * 5
|
||||
#define ZT_TCP_RX_BUF_SZ 1024 * 1024 * 5
|
||||
#define ZT_TCP_TX_BUF_SZ 1024 * 1024 * 128
|
||||
#define ZT_TCP_RX_BUF_SZ 1024 * 1024 * 128
|
||||
#define ZT_UDP_TX_BUF_SZ ZT_MAX_MTU
|
||||
#define ZT_UDP_RX_BUF_SZ ZT_MAX_MTU * 10
|
||||
|
||||
#define ZT_STACK_TCP_SOCKET_TX_SZ 2048
|
||||
#define ZT_STACK_TCP_SOCKET_RX_SZ 2048
|
||||
// Send and Receive buffer sizes for the network stack
|
||||
// By default picoTCP sets them to 16834, this is good for embedded-scale
|
||||
// stuff but you might want to consider higher values for desktop and mobile
|
||||
// applications.
|
||||
#define ZT_STACK_TCP_SOCKET_TX_SZ ZT_TCP_TX_BUF_SZ
|
||||
#define ZT_STACK_TCP_SOCKET_RX_SZ ZT_TCP_RX_BUF_SZ
|
||||
|
||||
#define ZT_STACK_SOCKET_RD_MAX 2048
|
||||
#define ZT_STACK_SOCKET_WR_MAX 2048
|
||||
// Maximum size we're allowed to read or write from a stack socket
|
||||
// This is put in place because picoTCP seems to fail at higher values.
|
||||
// If you use another stack you can probably bump this up a bit.
|
||||
#define ZT_STACK_SOCKET_WR_MAX 4096
|
||||
#define ZT_STACK_SOCKET_RD_MAX 4096*4
|
||||
|
||||
#define ZT_CORE_VERSION_MAJOR 1
|
||||
#define ZT_CORE_VERSION_MINOR 2
|
||||
@@ -79,7 +86,7 @@
|
||||
// a short period of time by default as a precaution.
|
||||
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER true
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER_TIME 10000 // ms
|
||||
#define ZT_SOCK_BEHAVIOR_LINGER_TIME 3 // s
|
||||
|
||||
// Wait time for socket closure if data is still present in the write queue
|
||||
#define ZT_SDK_CLTIME 60
|
||||
@@ -94,6 +101,9 @@
|
||||
// Interval for performing cleanup tasks on Tap/Stack objects
|
||||
#define ZT_HOUSEKEEPING_INTERVAL 10 // s
|
||||
|
||||
// Whether or not we want libzt to shit its pants
|
||||
#define ZT_EXIT_ON_GENERAL_FAIL false
|
||||
|
||||
/****************************************************************************/
|
||||
/* Socket API Signatures */
|
||||
/****************************************************************************/
|
||||
@@ -385,7 +395,7 @@ int zts_read(ZT_READ_SIG);
|
||||
int zts_write(ZT_WRITE_SIG);
|
||||
|
||||
/*
|
||||
* Sends a FIN segment
|
||||
* Sends a FIN segment
|
||||
*/
|
||||
int zts_shutdown(ZT_SHUTDOWN_SIG);
|
||||
|
||||
|
||||
@@ -401,7 +401,6 @@ int zts_socket(ZT_SOCKET_SIG) {
|
||||
int value = 1;
|
||||
pico_socket_setoption(psock, PICO_TCP_NODELAY, &value);
|
||||
|
||||
|
||||
if((t_err = pico_socket_setoption(psock, PICO_SOCKET_OPT_SNDBUF, &tx_buf_sz)) < 0)
|
||||
DEBUG_ERROR("unable to set SNDBUF size, err = %d, pico_err = %d", t_err, pico_err);
|
||||
if((t_err = pico_socket_setoption(psock, PICO_SOCKET_OPT_RCVBUF, &rx_buf_sz)) < 0)
|
||||
@@ -962,8 +961,6 @@ Linux / Darwin:
|
||||
[ ] [EIO] A previously-uncommitted write(2) encountered an input/output error.
|
||||
*/
|
||||
|
||||
// FIXME: See pico_socket_setoption's LINGER functionality
|
||||
|
||||
int zts_close(ZT_CLOSE_SIG)
|
||||
{
|
||||
DEBUG_EXTRA("fd = %d", fd);
|
||||
@@ -1067,16 +1064,15 @@ int zts_close(ZT_CLOSE_SIG)
|
||||
return err;
|
||||
}
|
||||
|
||||
//#define ZT_POLL_SIG struct pollfd *fds, nfds_t nfds, int timeout
|
||||
//#define ZT_SELECT_SIG int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout
|
||||
|
||||
int zts_poll(ZT_POLL_SIG)
|
||||
{
|
||||
// struct pollfd *fds, nfds_t nfds, int timeout
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zts_select(ZT_SELECT_SIG)
|
||||
{
|
||||
// int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,12 +158,12 @@ namespace ZeroTier
|
||||
int pico_Close(Connection *conn);
|
||||
|
||||
/*
|
||||
* Converts error code to pretty string
|
||||
* Converts picoTCP error codes to pretty string
|
||||
*/
|
||||
static char *beautify_pico_error(int err);
|
||||
|
||||
/*
|
||||
*
|
||||
* Converts picoTCP socket states into pretty string
|
||||
*/
|
||||
static char *beautify_pico_state(int state);
|
||||
};
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
nwid e5cd7a9e1c0fd272
|
||||
mode server
|
||||
test comprehensive
|
||||
|
||||
local_path zt2
|
||||
local_port 4444
|
||||
local_port6 5555
|
||||
local_ipv4 10.9.9.51
|
||||
local_ipv6 fde5:cd7a:9e1c:0fd2:7299:93e1:b555:8c83
|
||||
|
||||
remote_path zt1
|
||||
remote_port 4444
|
||||
remote_port6 5555
|
||||
remote_ipv4 10.9.9.50
|
||||
remote_ipv6 fde5:cd7a:9e1c:fd2:7299:93c4:fe0:4bb8
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
OSTYPE=$(uname -s | tr '[A-Z]' '[a-z]')
|
||||
|
||||
./build/$OSTYPE/selftest test/alice.conf &
|
||||
echo $! >> "test/selftest.alice"
|
||||
./build/$OSTYPE/echotest test/alice.conf &
|
||||
echo $! >> "test/echotest.alice"
|
||||
@@ -1,15 +0,0 @@
|
||||
nwid e5cd7a9e1c0fd272
|
||||
mode client
|
||||
test comprehensive
|
||||
|
||||
local_path zt1
|
||||
local_port 4444
|
||||
local_port6 5555
|
||||
local_ipv4 10.9.9.50
|
||||
local_ipv6 fde5:cd7a:9e1c:fd2:7299:93c4:fe0:4bb8
|
||||
|
||||
remote_path zt2
|
||||
remote_port 4444
|
||||
remote_port6 5555
|
||||
remote_ipv4 10.9.9.51
|
||||
remote_ipv6 fde5:cd7a:9e1c:0fd2:7299:93e1:b555:8c83
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
OSTYPE=$(uname -s | tr '[A-Z]' '[a-z]')
|
||||
|
||||
./build/$OSTYPE/selftest test/bob.conf &
|
||||
echo $! >> "test/selftest.bob"
|
||||
./build/$OSTYPE/echotest test/bob.conf &
|
||||
echo $! >> "test/selftest.bob"
|
||||
@@ -1124,37 +1124,6 @@ int random_api_test()
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* test driver, called from main() */
|
||||
/****************************************************************************/
|
||||
/*
|
||||
path = place where ZT keys, and config files will be stored
|
||||
nwid = network for app to join
|
||||
type = simple, sustained
|
||||
ipv = 4, 6
|
||||
mode = client, server
|
||||
addr = ip address string
|
||||
port = integer
|
||||
operation = n_times, n_seconds, n_bytes, etc
|
||||
count = number of operations of type
|
||||
delay = delay between each operation
|
||||
*/
|
||||
int test_driver(std::string name, std::string path, std::string nwid,
|
||||
int type,
|
||||
int ipv,
|
||||
int mode,
|
||||
std::string ipstr,
|
||||
int port,
|
||||
int operation,
|
||||
int count,
|
||||
int delay,
|
||||
std::vector<std::string> *results)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
For each API call, test the following:
|
||||
- All possible combinations of plausible system-defined arguments
|
||||
@@ -1334,7 +1303,6 @@ int main(int argc , char *argv[])
|
||||
fprintf(stderr, "\tpath = %s\n", path.c_str());
|
||||
fprintf(stderr, "\tnwid = %s\n", nwid.c_str());
|
||||
fprintf(stderr, "\ttype = %s\n\n", stype.c_str());
|
||||
|
||||
fprintf(stderr, "DESTINATION:\n\n");
|
||||
fprintf(stderr, "\tremote_ipstr = %s\n", remote_ipstr.c_str());
|
||||
fprintf(stderr, "\tremote_ipstr6 = %s\n", remote_ipstr6.c_str());
|
||||
@@ -1351,200 +1319,182 @@ int main(int argc , char *argv[])
|
||||
DEBUG_TEST("Ready. Contacting selftest program on first host.\n\n");
|
||||
|
||||
// What follows is a long-form of zts_simple_start():
|
||||
// zts_start(path.c_str());
|
||||
// printf("waiting for service to start...\n");
|
||||
// while(!zts_running())
|
||||
// sleep(1);
|
||||
// printf("joining network...\n");
|
||||
// zts_join(nwid.c_str());
|
||||
// printf("waiting for address assignment...\n");
|
||||
// while(!zts_has_address(nwid.c_str()))
|
||||
// sleep(1);
|
||||
|
||||
// SLAM
|
||||
// Perform thsouands of repetitions of the same plausible API sequences to detect faults
|
||||
if(stype == "slam")
|
||||
{
|
||||
slam_api_test();
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
zts_start(path.c_str());
|
||||
printf("waiting for service to start...\n");
|
||||
while(!zts_running())
|
||||
sleep(1);
|
||||
printf("joining network...\n");
|
||||
zts_join(nwid.c_str());
|
||||
printf("waiting for address assignment...\n");
|
||||
while(!zts_has_address(nwid.c_str()))
|
||||
sleep(1);
|
||||
*/
|
||||
|
||||
/****************************************************************************/
|
||||
/* COMPREHENSIVE */
|
||||
/****************************************************************************/
|
||||
|
||||
// More info can be found in TESTING.md
|
||||
|
||||
// test purpposefully bad arguments
|
||||
|
||||
//test_bad_args();
|
||||
//exit(0);
|
||||
|
||||
|
||||
int test_number = 0;
|
||||
int ipv;
|
||||
int test_number = 0, ipv;
|
||||
struct sockaddr addr;
|
||||
char details[128];
|
||||
memset(&details, 0, sizeof details);
|
||||
bool passed = 0;
|
||||
|
||||
// Tests ALL API calls
|
||||
if(stype == "comprehensive")
|
||||
{
|
||||
|
||||
port = start_port;
|
||||
delay = 0;
|
||||
count = 1024*128;
|
||||
operation = TEST_OP_N_BYTES;
|
||||
port = start_port;
|
||||
delay = 0;
|
||||
count = 1024*128;
|
||||
operation = TEST_OP_N_BYTES;
|
||||
|
||||
|
||||
// ipv4 client/server
|
||||
ipv = 4;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++; // move up one port
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
ipv = 4;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++; // move up one port
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
|
||||
|
||||
// ipv4 sustained transfer
|
||||
ipv = 4;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results); // swtich roles
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
ipv = 4;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results); // swtich roles
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
|
||||
|
||||
// ipv6 client/server
|
||||
ipv = 6;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_6
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
DEBUG_TEST("waiting (15s) for other selftest to complete before continuing...");
|
||||
sleep(WAIT_FOR_TEST_TO_CONCLUDE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_6
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++; // move up one port
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_6
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_6
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
ipv = 6;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_6
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
DEBUG_TEST("waiting (15s) for other selftest to complete before continuing...");
|
||||
sleep(WAIT_FOR_TEST_TO_CONCLUDE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_6
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++; // move up one port
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_6
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_6
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
|
||||
|
||||
// ipv6 sustained transfer
|
||||
ipv = 6;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results); // swtich roles
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
ipv = 6;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results); // swtich roles
|
||||
mode = mode == TEST_MODE_SERVER ? TEST_MODE_CLIENT : TEST_MODE_SERVER; // switch roles
|
||||
port++;
|
||||
if(mode == TEST_MODE_SERVER) {
|
||||
create_addr(local_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_server_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_server_sustained_4
|
||||
}
|
||||
else if(mode == TEST_MODE_CLIENT) {
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
create_addr(remote_ipstr6, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_client_sustained_6((struct sockaddr_in6 *)&addr, operation, count, delay, details, &passed); // tcp_client_sustained_4
|
||||
}
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
port++;
|
||||
|
||||
// PERFORMANCE (between this library instance and a native non library instance (echo) )
|
||||
// Client/Server mode isn't being tested here, so it isn't important, we'll just set it to client
|
||||
|
||||
// ipv4 echo test
|
||||
ipv = 4;
|
||||
if(me == "alice" || me == "ted") {
|
||||
port=start_port+100; // e.g. 7100
|
||||
create_addr(remote_echo_ipv4, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_perf_tx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_tx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
tcp_perf_rx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_rx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
}
|
||||
if(me == "bob" || me == "carol") {
|
||||
DEBUG_TEST("waiting (15s) for other selftest to complete before continuing...");
|
||||
sleep(WAIT_FOR_TEST_TO_CONCLUDE);
|
||||
port=start_port+101; // e.g. 7101
|
||||
create_addr(remote_echo_ipv4, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_perf_rx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_tx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
tcp_perf_tx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_rx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
}
|
||||
ipv = 4;
|
||||
if(me == "alice" || me == "ted") {
|
||||
port=start_port+100; // e.g. 7100
|
||||
create_addr(remote_echo_ipv4, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_perf_tx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_tx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
tcp_perf_rx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_rx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
}
|
||||
if(me == "bob" || me == "carol") {
|
||||
DEBUG_TEST("waiting (15s) for other selftest to complete before continuing...");
|
||||
sleep(WAIT_FOR_TEST_TO_CONCLUDE);
|
||||
port=start_port+101; // e.g. 7101
|
||||
create_addr(remote_echo_ipv4, port, ipv, (struct sockaddr *)&addr);
|
||||
tcp_perf_rx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_tx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
sleep(WAIT_FOR_SERVER_TO_COME_ONLINE);
|
||||
tcp_perf_tx_echo_4((struct sockaddr_in *)&addr, operation, count, delay, details, &passed); // tcp_perf_rx_echo_4
|
||||
RECORD_RESULTS(&test_number, passed, details, &results);
|
||||
}
|
||||
|
||||
// RANDOM API TEST
|
||||
//random_api_test();
|
||||
|
||||
/****************************************************************************/
|
||||
/* RANDOM */
|
||||
/****************************************************************************/
|
||||
// SLAM API TEST
|
||||
//slam_api_test();
|
||||
|
||||
// RANDOM
|
||||
// performs random API calls with plausible (and random) arguments/data
|
||||
if(stype == "random")
|
||||
{
|
||||
random_api_test();
|
||||
}
|
||||
// BAD ARGS API TEST
|
||||
//test_bad_args();
|
||||
|
||||
// OBSCURE API TEST
|
||||
//obscure_api_test();
|
||||
|
||||
|
||||
// Print results of all tests
|
||||
printf("--------------------------------------------------------------------------------\n");
|
||||
for(int i=0;i<results.size(); i++) {
|
||||
fprintf(stderr, "%s\n", results[i].c_str());
|
||||
|
||||
Reference in New Issue
Block a user