mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Fix unit tests (now that platform code works differently)
svn:r1573
This commit is contained in:
parent
3b97a54226
commit
d237692396
@ -6,7 +6,7 @@
|
||||
|
||||
extern or_options_t options; /* command-line and config-file options */
|
||||
|
||||
static void get_platform_str(char *platform, int len);
|
||||
/* exposed for test.c */ void get_platform_str(char *platform, int len);
|
||||
|
||||
/************************************************************/
|
||||
|
||||
@ -388,7 +388,7 @@ int router_rebuild_descriptor(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_platform_str(char *platform, int len)
|
||||
void get_platform_str(char *platform, int len)
|
||||
{
|
||||
snprintf(platform, len-1, "Tor %s on %s", VERSION, get_uname());
|
||||
platform[len-1] = '\0';
|
||||
|
@ -23,6 +23,7 @@ int have_failed = 0;
|
||||
int router_get_routerlist_from_directory_impl(
|
||||
const char *s, routerlist_t **dest, crypto_pk_env_t *pkey);
|
||||
void add_fingerprint_to_dir(const char *nickname, const char *fp);
|
||||
void get_platform_str(char *platform, int len);
|
||||
|
||||
void
|
||||
dump_hex(char *s, int len)
|
||||
@ -669,6 +670,7 @@ void
|
||||
test_dir_format()
|
||||
{
|
||||
char buf[8192], buf2[8192];
|
||||
char platform[256];
|
||||
char *pk1_str = NULL, *pk2_str = NULL, *pk3_str = NULL, *cp;
|
||||
int pk1_str_len, pk2_str_len, pk3_str_len;
|
||||
routerinfo_t r1, r2;
|
||||
@ -684,6 +686,8 @@ test_dir_format()
|
||||
test_assert(! crypto_pk_generate_key(pk2));
|
||||
test_assert(! crypto_pk_generate_key(pk3));
|
||||
|
||||
get_platform_str(platform, sizeof(platform));
|
||||
|
||||
r1.address = "testaddr1.foo.bar";
|
||||
r1.addr = 0xc0a80001u; /* 192.168.0.1 */
|
||||
r1.published_on = 0;
|
||||
@ -696,6 +700,7 @@ test_dir_format()
|
||||
r1.bandwidthrate = r1.bandwidthburst = 1000;
|
||||
r1.exit_policy = NULL;
|
||||
r1.nickname = "Magri";
|
||||
r1.platform = tor_strdup(platform);
|
||||
|
||||
ex1.policy_type = EXIT_POLICY_ACCEPT;
|
||||
ex1.string = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user