aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-10-11 14:48:02 +0200
committerJulius Bünger <buenger@mytum.de>2018-10-11 14:48:02 +0200
commit2408ee6b254b5f67a6b50280dec6c66536abd1c1 (patch)
tree9af518049544dd4825f3490b0c29fff8e45248dc /src
parent261dd70aa12d986e6f7b38c38f843621bcc47763 (diff)
downloadgnunet-2408ee6b254b5f67a6b50280dec6c66536abd1c1.tar.gz
gnunet-2408ee6b254b5f67a6b50280dec6c66536abd1c1.zip
RPS Tests: Test Subs
Diffstat (limited to 'src')
-rw-r--r--src/rps/.gitignore9
-rw-r--r--src/rps/Makefile.am32
-rw-r--r--src/rps/test_rps.c42
-rw-r--r--src/rps/test_rps.conf2
4 files changed, 65 insertions, 20 deletions
diff --git a/src/rps/.gitignore b/src/rps/.gitignore
index cb14f5b09..9e78e2ca0 100644
--- a/src/rps/.gitignore
+++ b/src/rps/.gitignore
@@ -1,15 +1,16 @@
1gnunet-service-rps 1gnunet-service-rps
2gnunet-rps 2gnunet-rps
3gnunet-rps-profiler 3gnunet-rps-profiler
4test_rps_malicious_1 4test_rps_single_req
5test_rps_malicious_2
6test_rps_malicious_3
7test_rps_req_cancel 5test_rps_req_cancel
6test_rps_sub
8test_rps_seed_big 7test_rps_seed_big
9test_rps_seed_request 8test_rps_seed_request
10test_rps_single_req
11test_service_rps_custommap 9test_service_rps_custommap
12test_service_rps_sampler_elem 10test_service_rps_sampler_elem
13test_service_rps_view 11test_service_rps_view
14test_rps_churn 12test_rps_churn
15test_service_rps_peers 13test_service_rps_peers
14test_rps_malicious_1
15test_rps_malicious_2
16test_rps_malicious_3
diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am
index e973bb7ca..8d2ddf7d7 100644
--- a/src/rps/Makefile.am
+++ b/src/rps/Makefile.am
@@ -79,14 +79,15 @@ check_PROGRAMS = \
79 test_service_rps_view \ 79 test_service_rps_view \
80 test_service_rps_custommap \ 80 test_service_rps_custommap \
81 test_service_rps_sampler_elem \ 81 test_service_rps_sampler_elem \
82 test_rps_malicious_1 \
83 test_rps_malicious_2 \
84 test_rps_malicious_3 \
85 test_rps_seed_request \
86 test_rps_single_req \ 82 test_rps_single_req \
87 test_rps_req_cancel \ 83 test_rps_req_cancel \
84 test_rps_sub \
85 test_rps_seed_request \
88 test_rps_seed_big \ 86 test_rps_seed_big \
89 test_rps_churn 87 test_rps_churn \
88 test_rps_malicious_1 \
89 test_rps_malicious_2 \
90 test_rps_malicious_3
90endif 91endif
91 92
92rps_test_src = \ 93rps_test_src = \
@@ -125,15 +126,6 @@ test_service_rps_sampler_elem_SOURCES = \
125 test_service_rps_sampler_elem.c 126 test_service_rps_sampler_elem.c
126test_service_rps_sampler_elem_LDADD = $(top_builddir)/src/util/libgnunetutil.la 127test_service_rps_sampler_elem_LDADD = $(top_builddir)/src/util/libgnunetutil.la
127 128
128test_rps_malicious_1_SOURCES = $(rps_test_src)
129test_rps_malicious_1_LDADD = $(ld_rps_test_lib)
130
131test_rps_malicious_2_SOURCES = $(rps_test_src)
132test_rps_malicious_2_LDADD = $(ld_rps_test_lib)
133
134test_rps_malicious_3_SOURCES = $(rps_test_src)
135test_rps_malicious_3_LDADD = $(ld_rps_test_lib)
136
137test_rps_single_req_SOURCES = $(rps_test_src) 129test_rps_single_req_SOURCES = $(rps_test_src)
138test_rps_single_req_LDADD = $(ld_rps_test_lib) 130test_rps_single_req_LDADD = $(ld_rps_test_lib)
139 131
@@ -143,12 +135,24 @@ test_rps_seed_request_LDADD = $(ld_rps_test_lib)
143test_rps_req_cancel_SOURCES = $(rps_test_src) 135test_rps_req_cancel_SOURCES = $(rps_test_src)
144test_rps_req_cancel_LDADD = $(ld_rps_test_lib) 136test_rps_req_cancel_LDADD = $(ld_rps_test_lib)
145 137
138test_rps_sub_SOURCES = $(rps_test_src)
139test_rps_sub_LDADD = $(ld_rps_test_lib)
140
146test_rps_seed_big_SOURCES = $(rps_test_src) 141test_rps_seed_big_SOURCES = $(rps_test_src)
147test_rps_seed_big_LDADD = $(ld_rps_test_lib) 142test_rps_seed_big_LDADD = $(ld_rps_test_lib)
148 143
149test_rps_churn_SOURCES = $(rps_test_src) 144test_rps_churn_SOURCES = $(rps_test_src)
150test_rps_churn_LDADD = $(ld_rps_test_lib) 145test_rps_churn_LDADD = $(ld_rps_test_lib)
151 146
147test_rps_malicious_1_SOURCES = $(rps_test_src)
148test_rps_malicious_1_LDADD = $(ld_rps_test_lib)
149
150test_rps_malicious_2_SOURCES = $(rps_test_src)
151test_rps_malicious_2_LDADD = $(ld_rps_test_lib)
152
153test_rps_malicious_3_SOURCES = $(rps_test_src)
154test_rps_malicious_3_LDADD = $(ld_rps_test_lib)
155
152gnunet_rps_profiler_SOURCES = \ 156gnunet_rps_profiler_SOURCES = \
153 gnunet-service-rps_sampler_elem.h gnunet-service-rps_sampler_elem.c \ 157 gnunet-service-rps_sampler_elem.h gnunet-service-rps_sampler_elem.c \
154 rps-sampler_common.h rps-sampler_common.c \ 158 rps-sampler_common.h rps-sampler_common.c \
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index ba0371f38..cbd3ba845 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1544,6 +1544,31 @@ churn_test_cb (struct RPSPeer *rps_peer)
1544} 1544}
1545 1545
1546/*********************************** 1546/***********************************
1547 * SUB
1548***********************************/
1549
1550void sub_post (struct RPSPeer *rps_peer)
1551{
1552 GNUNET_RPS_sub_stop (rps_peer->rps_handle, "test");
1553}
1554
1555static void
1556sub_stop_op (void *cls)
1557{
1558 struct GNUNET_RPS_Handle *h = cls;
1559
1560 GNUNET_RPS_sub_stop (h, "test");
1561}
1562
1563static void
1564sub_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
1565{
1566 (void) rps_peer;
1567
1568 GNUNET_RPS_sub_start (h, "test");
1569}
1570
1571/***********************************
1547 * PROFILER 1572 * PROFILER
1548***********************************/ 1573***********************************/
1549 1574
@@ -2873,7 +2898,22 @@ main (int argc, char *argv[])
2873 cur_test_run.eval_cb = default_eval_cb; 2898 cur_test_run.eval_cb = default_eval_cb;
2874 cur_test_run.have_churn = HAVE_NO_CHURN; 2899 cur_test_run.have_churn = HAVE_NO_CHURN;
2875 cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; 2900 cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT;
2876 timeout_s = 10; 2901 timeout_s = 40;
2902 }
2903
2904 else if (strstr (argv[0], "_sub") != NULL)
2905 {
2906 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test subs\n");
2907 cur_test_run.name = "test-rps-sub";
2908 num_peers = 5;
2909 //cur_test_run.init_peer = &default_init_peer;
2910 cur_test_run.pre_test = &sub_pre;
2911 cur_test_run.main_test = &single_req_cb;
2912 //cur_test_run.reply_handle = default_reply_handle;
2913 cur_test_run.post_test = &sub_post;
2914 //cur_test_run.eval_cb = default_eval_cb;
2915 cur_test_run.have_churn = HAVE_NO_CHURN;
2916 cur_test_run.have_quick_quit = HAVE_QUICK_QUIT;
2877 } 2917 }
2878 2918
2879 else if (strstr (argv[0], "profiler") != NULL) 2919 else if (strstr (argv[0], "profiler") != NULL)
diff --git a/src/rps/test_rps.conf b/src/rps/test_rps.conf
index 84e0e5049..c55930649 100644
--- a/src/rps/test_rps.conf
+++ b/src/rps/test_rps.conf
@@ -12,7 +12,7 @@ NOARMBIND = YES
12#OPTIONS=-l /tmp/rps_profiler_logs/rps-[]-%Y-%m-%d.log 12#OPTIONS=-l /tmp/rps_profiler_logs/rps-[]-%Y-%m-%d.log
13 13
14# This is the timeinterval between the rounds 14# This is the timeinterval between the rounds
15ROUNDINTERVAL = 2 s 15ROUNDINTERVAL = 1 s
16FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt 16FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
17 17
18# This is the 'estimate' in the beginning. 18# This is the 'estimate' in the beginning.