diff options
author | Julius Bünger <buenger@mytum.de> | 2015-05-19 22:41:48 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-05-19 22:41:48 +0000 |
commit | 4afbc04aa4560830d88e98a440ea61756c1854e6 (patch) | |
tree | cf2cbc39d6dfcace076e6bebe7cb4be22db07ff2 /src/rps/test_rps.c | |
parent | c8a94577fe87d86aa1537e85e5e294e80c64f356 (diff) | |
download | gnunet-4afbc04aa4560830d88e98a440ea61756c1854e6.tar.gz gnunet-4afbc04aa4560830d88e98a440ea61756c1854e6.zip |
-restructured testing
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r-- | src/rps/test_rps.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 32bce4098..9bf963a8a 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -908,10 +908,14 @@ run (void *cls, | |||
908 | int | 908 | int |
909 | main (int argc, char *argv[]) | 909 | main (int argc, char *argv[]) |
910 | { | 910 | { |
911 | cur_test_run.name = "test-rps-default"; | ||
911 | cur_test_run.pre_test = NULL; | 912 | cur_test_run.pre_test = NULL; |
912 | cur_test_run.eval_cb = default_eval_cb; | 913 | cur_test_run.eval_cb = default_eval_cb; |
913 | churn_task = NULL; | 914 | churn_task = NULL; |
914 | 915 | ||
916 | num_peers = 5; | ||
917 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30); | ||
918 | |||
915 | if (strstr (argv[0], "malicious") != NULL) | 919 | if (strstr (argv[0], "malicious") != NULL) |
916 | { | 920 | { |
917 | cur_test_run.pre_test = mal_pre; | 921 | cur_test_run.pre_test = mal_pre; |
@@ -921,16 +925,19 @@ main (int argc, char *argv[]) | |||
921 | if (strstr (argv[0], "_1") != NULL) | 925 | if (strstr (argv[0], "_1") != NULL) |
922 | { | 926 | { |
923 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 1\n"); | 927 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 1\n"); |
928 | cur_test_run.name = "test-rps-malicious_1"; | ||
924 | mal_type = 1; | 929 | mal_type = 1; |
925 | } | 930 | } |
926 | else if (strstr (argv[0], "_2") != NULL) | 931 | else if (strstr (argv[0], "_2") != NULL) |
927 | { | 932 | { |
928 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 2\n"); | 933 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 2\n"); |
934 | cur_test_run.name = "test-rps-malicious_2"; | ||
929 | mal_type = 2; | 935 | mal_type = 2; |
930 | } | 936 | } |
931 | else if (strstr (argv[0], "_3") != NULL) | 937 | else if (strstr (argv[0], "_3") != NULL) |
932 | { | 938 | { |
933 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 3\n"); | 939 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test malicious peer type 3\n"); |
940 | cur_test_run.name = "test-rps-malicious_3"; | ||
934 | mal_type = 3; | 941 | mal_type = 3; |
935 | } | 942 | } |
936 | } | 943 | } |
@@ -938,60 +945,77 @@ main (int argc, char *argv[]) | |||
938 | else if (strstr (argv[0], "_single_req") != NULL) | 945 | else if (strstr (argv[0], "_single_req") != NULL) |
939 | { | 946 | { |
940 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test single request\n"); | 947 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test single request\n"); |
948 | cur_test_run.name = "test-rps-single-req"; | ||
941 | cur_test_run.main_test = single_req_cb; | 949 | cur_test_run.main_test = single_req_cb; |
942 | } | 950 | } |
951 | |||
943 | else if (strstr (argv[0], "_delayed_reqs") != NULL) | 952 | else if (strstr (argv[0], "_delayed_reqs") != NULL) |
944 | { | 953 | { |
945 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test delayed requests\n"); | 954 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test delayed requests\n"); |
955 | cur_test_run.name = "test-rps-delayed-reqs"; | ||
946 | cur_test_run.main_test = delay_req_cb; | 956 | cur_test_run.main_test = delay_req_cb; |
947 | } | 957 | } |
958 | |||
948 | else if (strstr (argv[0], "_seed_big") != NULL) | 959 | else if (strstr (argv[0], "_seed_big") != NULL) |
949 | { | 960 | { |
950 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding (num_peers > GNUNET_SERVER_MAX_MESSAGE_SIZE)\n"); | 961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding (num_peers > GNUNET_SERVER_MAX_MESSAGE_SIZE)\n"); |
962 | cur_test_run.name = "test-rps-seed-big"; | ||
951 | cur_test_run.main_test = seed_big_cb; | 963 | cur_test_run.main_test = seed_big_cb; |
952 | } | 964 | } |
965 | |||
953 | else if (strstr (argv[0], "_single_peer_seed") != NULL) | 966 | else if (strstr (argv[0], "_single_peer_seed") != NULL) |
954 | { | 967 | { |
955 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding and requesting on a single peer\n"); | 968 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding and requesting on a single peer\n"); |
969 | cur_test_run.name = "test-rps-single-peer-seed"; | ||
956 | cur_test_run.main_test = single_peer_seed_cb; | 970 | cur_test_run.main_test = single_peer_seed_cb; |
957 | } | 971 | } |
972 | |||
958 | else if (strstr (argv[0], "_seed_request") != NULL) | 973 | else if (strstr (argv[0], "_seed_request") != NULL) |
959 | { | 974 | { |
960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding and requesting on multiple peers\n"); | 975 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding and requesting on multiple peers\n"); |
976 | cur_test_run.name = "test-rps-seed-request"; | ||
961 | cur_test_run.main_test = seed_req_cb; | 977 | cur_test_run.main_test = seed_req_cb; |
962 | } | 978 | } |
979 | |||
963 | else if (strstr (argv[0], "_seed") != NULL) | 980 | else if (strstr (argv[0], "_seed") != NULL) |
964 | { | 981 | { |
965 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding\n"); | 982 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test seeding\n"); |
983 | cur_test_run.name = "test-rps-seed"; | ||
966 | cur_test_run.main_test = seed_cb; | 984 | cur_test_run.main_test = seed_cb; |
967 | cur_test_run.eval_cb = seed_eval; | 985 | cur_test_run.eval_cb = no_eval; |
968 | } | 986 | } |
987 | |||
969 | else if (strstr (argv[0], "_req_cancel") != NULL) | 988 | else if (strstr (argv[0], "_req_cancel") != NULL) |
970 | { | 989 | { |
971 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test cancelling a request\n"); | 990 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test cancelling a request\n"); |
991 | cur_test_run.name = "test-rps-req-cancel"; | ||
972 | cur_test_run.main_test = req_cancel_cb; | 992 | cur_test_run.main_test = req_cancel_cb; |
973 | } | 993 | } |
994 | |||
974 | else if (strstr (argv[0], "profiler") != NULL) | 995 | else if (strstr (argv[0], "profiler") != NULL) |
975 | { | 996 | { |
976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); | 997 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); |
998 | cur_test_run.name = "test-rps-profiler"; | ||
977 | mal_type = 3; | 999 | mal_type = 3; |
978 | cur_test_run.pre_test = profiler_pre; | 1000 | cur_test_run.pre_test = profiler_pre; |
979 | cur_test_run.main_test = profiler_cb; | 1001 | cur_test_run.main_test = profiler_cb; |
980 | churn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 1002 | cur_test_run.eval_cb = no_eval; |
981 | 10), | 1003 | |
982 | churn, NULL); | 1004 | num_peers = 5; |
1005 | //timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90); | ||
983 | } | 1006 | } |
984 | 1007 | ||
1008 | rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); | ||
1009 | rps_peer_ids = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity); | ||
1010 | |||
985 | ok = 1; | 1011 | ok = 1; |
986 | (void) GNUNET_TESTBED_test_run ("test-rps-multipeer", | 1012 | //(void) GNUNET_TESTBED_test_run ("test-rps-multipeer", |
1013 | (void) GNUNET_TESTBED_test_run (cur_test_run.name, | ||
987 | "test_rps.conf", | 1014 | "test_rps.conf", |
988 | NUM_PEERS, | 1015 | num_peers, |
989 | 0, NULL, NULL, | 1016 | 0, NULL, NULL, |
990 | &run, NULL); | 1017 | &run, NULL); |
991 | 1018 | ||
992 | if (NULL != churn_task) | ||
993 | GNUNET_SCHEDULER_cancel (churn_task); | ||
994 | |||
995 | return cur_test_run.eval_cb(); | 1019 | return cur_test_run.eval_cb(); |
996 | } | 1020 | } |
997 | 1021 | ||