Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.10 KB | None | 0 0
  1. diff --git a/src/feature/dirauth/clipboard.c b/src/feature/dirauth/clipboard.c
  2. new file mode 100644
  3. index 000000000..e69de29bb
  4. diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
  5. index 274c794e0..d7027cd43 100644
  6. --- a/src/feature/dirauth/dirvote.c
  7. +++ b/src/feature/dirauth/dirvote.c
  8. @@ -4158,7 +4158,7 @@ dirserv_get_bandwidth_for_router_kb(const routerinfo_t *ri)
  9.   * non-authority; a running router is more useful than a non-running router;
  10.   * and a router with more bandwidth is more useful than one with less.)
  11.   **/
  12. -static int
  13. +STATIC int
  14.  compare_routerinfo_by_ip_and_bw_(const void **a, const void **b)
  15.  {
  16.    routerinfo_t *first = *(routerinfo_t **)a, *second = *(routerinfo_t **)b;
  17. @@ -4166,7 +4166,6 @@ compare_routerinfo_by_ip_and_bw_(const void **a, const void **b)
  18.    uint32_t bw_kb_first, bw_kb_second;
  19.    const node_t *node_first, *node_second;
  20.    int first_is_running, second_is_running;
  21. -  printf("%d\n", 4);
  22.    tor_addr_t *first_ipv6 = &(first->ipv6_addr);
  23.    tor_addr_t *second_ipv6 = &(second->ipv6_addr);
  24.    sa_family_t first_family, second_family;
  25. diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h
  26. index f695e93ab..a333774b5 100644
  27. --- a/src/feature/dirauth/dirvote.h
  28. +++ b/src/feature/dirauth/dirvote.h
  29. @@ -230,6 +230,8 @@ char *networkstatus_get_detached_signatures(smartlist_t *consensuses);
  30.  STATIC microdesc_t *dirvote_create_microdescriptor(const routerinfo_t *ri,
  31.                                                     int consensus_method);
  32.  
  33. +STATIC int
  34. +compare_routerinfo_by_ip_and_bw_(const void **a, const void **b);
  35.  #endif /* defined(DIRVOTE_PRIVATE) */
  36.  
  37.  #endif /* !defined(TOR_DIRVOTE_H) */
  38. diff --git a/src/test/include.am b/src/test/include.am
  39. index 90e50752c..2faa5d324 100644
  40. --- a/src/test/include.am
  41. +++ b/src/test/include.am
  42. @@ -361,6 +361,7 @@ noinst_HEADERS+= \
  43.     src/test/ptr_helpers.h \
  44.     src/test/test_helpers.h \
  45.     src/test/test_dir_common.h \
  46. +   src/test/test_dirvote.c \
  47.     src/test/test_connection.h \
  48.     src/test/test_tortls.h \
  49.     src/test/test_descriptors.inc \
  50. diff --git a/src/test/test.c b/src/test/test.c
  51. index 1742f1d95..0dbbfb49b 100644
  52. --- a/src/test/test.c
  53. +++ b/src/test/test.c
  54. @@ -700,6 +700,7 @@ struct testgroup_t testgroups[] = {
  55.    { "dir/", dir_tests },
  56.    { "dir/auth/process_descs/", process_descs_tests },
  57.    { "dir/md/", microdesc_tests },
  58. +  { "dirauth/dirvote", dirvote_tests},
  59.    { "dir/voting/flags/", voting_flags_tests },
  60.    { "dir/voting/schedule/", voting_schedule_tests },
  61.    { "dir_handle_get/", dir_handle_get_tests },
  62. diff --git a/src/test/test.h b/src/test/test.h
  63. index 63e2faff9..e204bb283 100644
  64. --- a/src/test/test.h
  65. +++ b/src/test/test.h
  66. @@ -122,6 +122,7 @@ extern struct testcase_t crypto_rng_tests[];
  67.  extern struct testcase_t crypto_tests[];
  68.  extern struct testcase_t dir_handle_get_tests[];
  69.  extern struct testcase_t dir_tests[];
  70. +extern struct testcase_t dirvote_tests[];
  71.  extern struct testcase_t dispatch_tests[];
  72.  extern struct testcase_t dns_tests[];
  73.  extern struct testcase_t dos_tests[];
  74. diff --git a/src/test/test_dirvote.c b/src/test/test_dirvote.c
  75. new file mode 100644
  76. index 000000000..da6fcab89
  77. --- /dev/null
  78. +++ b/src/test/test_dirvote.c
  79. @@ -0,0 +1,17 @@
  80. +#define DIRVOTE_PRIVATE
  81. +
  82. +#include "feature/dirauth/dirvote.h"
  83. +static void
  84. +test_dirvote_compare_routerinfo_by_ip_and_bw_(void *arg)
  85. +{
  86. +  compare_routerinfo_by_ip_and_bw(1,2);
  87. +}
  88. +
  89. +
  90. +#define DIRVOTE(name, flags) \
  91. +  { #name, test_dirvote_##name, (flags), NULL, NULL}
  92. +
  93. +struct testcase_t dirvote_tests[] = {
  94. +        DIRVOTE(compare_routerinfo_by_ip_and_bw, TT_FORK),
  95. +        END_OF_TESTCASES
  96. +};
  97.  
  98. ===================================================================================
  99. output of 'make' command
  100. ===================================================================================
  101.  
  102. make  all-am
  103. make[1]: Entering directory '/home/lulwat/Development/S5_project/tor'
  104.   CCLD     src/test/test
  105. Makefile:9761: recipe for target 'src/test/test' failed
  106. make[1]: Leaving directory '/home/lulwat/Development/S5_project/tor'
  107. Makefile:6091: recipe for target 'all' failed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement