aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-08 20:22:01 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-08 20:22:01 +0000
commitd23769239651df818c70f26ab88d57fd712c25bc (patch)
tree82fdaf6d811003a8dac43ecb0742cee37614e164
parent3b97a54226d7c3a1f799f3e80e728924b1f969cb (diff)
downloadtor-d23769239651df818c70f26ab88d57fd712c25bc.tar
tor-d23769239651df818c70f26ab88d57fd712c25bc.tar.gz
Fix unit tests (now that platform code works differently)
svn:r1573
-rw-r--r--src/or/router.c4
-rw-r--r--src/or/test.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 467f1dd2c..fa841c089 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -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';
diff --git a/src/or/test.c b/src/or/test.c
index 34e3dd3af..e81835f06 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -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;