diff --git a/test/alice/README.md b/test/alice/README.md deleted file mode 100644 index f8b6c65..0000000 --- a/test/alice/README.md +++ /dev/null @@ -1 +0,0 @@ -**alice's** identity files and keys go here \ No newline at end of file diff --git a/test/bob/README.md b/test/bob/README.md deleted file mode 100644 index 4b32d98..0000000 --- a/test/bob/README.md +++ /dev/null @@ -1 +0,0 @@ -**bob's** identity files and keys go here \ No newline at end of file diff --git a/test/carol/README.md b/test/carol/README.md deleted file mode 100644 index e742c6a..0000000 --- a/test/carol/README.md +++ /dev/null @@ -1 +0,0 @@ -**carol's** identity files and keys go here \ No newline at end of file diff --git a/test/create_test_identities.sh b/test/create_test_identities.sh new file mode 100755 index 0000000..a87af3c --- /dev/null +++ b/test/create_test_identities.sh @@ -0,0 +1,10 @@ +# !/bin/bash + +NWID="" + +mkdir -p test/alice test/bob test/carol test/ted + +./build/darwin/selftest generate_id ${NWID} test/alice +./build/darwin/selftest generate_id ${NWID} test/bob +./build/darwin/selftest generate_id ${NWID} test/carol +./build/darwin/selftest generate_id ${NWID} test/ted diff --git a/test/selftest.cpp b/test/selftest.cpp index b644c22..e5c3808 100644 --- a/test/selftest.cpp +++ b/test/selftest.cpp @@ -1984,8 +1984,8 @@ int ZT_control_semantics_test(bool *passed) sleep(1); */ zts_start(path, false); - zts_join(strtoll(nwid,NULL,16)); - zts_leave(strtoll(nwid,NULL,16)); + zts_join(strtoull(nwid,NULL,16)); + zts_leave(strtoull(nwid,NULL,16)); zts_stop(); DEBUG_TEST("---\n"); @@ -2683,13 +2683,24 @@ int trigger_address_sanitizer() int main(int argc , char *argv[]) { #if defined(__SELFTEST__) - if (argc == 3) { + if (argc == 4) { + DEBUG_TEST("generating id..."); if (!strcmp(argv[1],"generate_id")) { DEBUG_TEST("generating ZeroTier identity for testing purposes..."); - if (strlen(argv[2]) > 0) { - zts_start(argv[2], true); // blocking call + if (strlen(argv[2]) <= 0) { + DEBUG_ERROR("invalid was given"); + exit(-1); } + if (strlen(argv[3]) <= 0) { + DEBUG_ERROR("invalid pathname was given"); + exit(-1); + } + uint64_t nwid = strtoull(argv[2],NULL,16); + zts_start(argv[3], true); + zts_join(nwid); + uint64_t nodeId = zts_get_node_id(); + DEBUG_TEST("generated id: %llx", nodeId); exit(0); } } @@ -2697,7 +2708,7 @@ int main(int argc , char *argv[]) if (argc < 6) { fprintf(stderr, "usage: selftest to \n"); - fprintf(stderr, "usage: selftest generate_id \n"); + fprintf(stderr, "usage: selftest generate_id \n"); fprintf(stderr, "e.g. : selftest 3 test/test.conf alice to bob\n"); return 1; } @@ -2770,7 +2781,7 @@ int main(int argc , char *argv[]) if (me != "dummy") { // used for testing ZT service wrapper API (before, during, and after coming online) // set start time here since we need to wait for both libzt instances to be online DEBUG_TEST("app-thread, waiting for libzt to come online...\n"); - uint64_t nwid = strtoll(nwidstr.c_str(),NULL,16); + uint64_t nwid = strtoull(nwidstr.c_str(),NULL,16); zts_startjoin(path.c_str(), nwid); uint64_t nodeId = zts_get_node_id(); DEBUG_TEST("I am %x, %s", nodeId, me.c_str()); diff --git a/test/ted/README.md b/test/ted/README.md deleted file mode 100644 index bd1bfdb..0000000 --- a/test/ted/README.md +++ /dev/null @@ -1 +0,0 @@ -**ted's** identity files and keys go here \ No newline at end of file