mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
test: Add v3 service config and registration test
This tests our hs_config.c API to properly load v3 services and register them to the global map. It does NOT test the service object validity, that will be the hs service unit test later on. At this commit, we have 100% code coverage of hs_config.c. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
* \brief Implement next generation hidden service functionality
|
||||
**/
|
||||
|
||||
#define HS_SERVICE_PRIVATE
|
||||
|
||||
#include "or.h"
|
||||
#include "circuitlist.h"
|
||||
#include "config.h"
|
||||
@@ -786,3 +788,21 @@ generate_establish_intro_cell(const uint8_t *circuit_key_material,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
|
||||
/* Return the global service map size. Only used by unit test. */
|
||||
STATIC unsigned int
|
||||
get_hs_service_map_size(void)
|
||||
{
|
||||
return HT_SIZE(hs_service_map);
|
||||
}
|
||||
|
||||
/* Return the staging list size. Only used by unit test. */
|
||||
STATIC int
|
||||
get_hs_service_staging_list_size(void)
|
||||
{
|
||||
return smartlist_len(hs_service_staging_list);
|
||||
}
|
||||
|
||||
#endif /* TOR_UNIT_TESTS */
|
||||
|
||||
|
||||
@@ -224,5 +224,16 @@ ssize_t
|
||||
get_establish_intro_payload(uint8_t *buf, size_t buf_len,
|
||||
const trn_cell_establish_intro_t *cell);
|
||||
|
||||
#ifdef HS_SERVICE_PRIVATE
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
|
||||
STATIC unsigned int get_hs_service_map_size(void);
|
||||
STATIC int get_hs_service_staging_list_size(void);
|
||||
|
||||
#endif /* TOR_UNIT_TESTS */
|
||||
|
||||
#endif /* HS_SERVICE_PRIVATE */
|
||||
|
||||
#endif /* TOR_HS_SERVICE_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user