aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-06-06 17:58:28 -0400
committerNick Mathewson <nickm@torproject.org>2013-07-10 15:20:10 -0400
commita3e0a87d951b1323ca542c9b115d5525d0d022c9 (patch)
treecf0f810beb6960ff0e5b092a8760a707656bc097 /src/test
parentf7d654b81e1a65803c22bb53fc1d3a2021d87d50 (diff)
downloadtor-a3e0a87d951b1323ca542c9b115d5525d0d022c9.tar.gz
tor-a3e0a87d951b1323ca542c9b115d5525d0d022c9.zip
Completely refactor how FILENAME_PRIVATE works
We previously used FILENAME_PRIVATE identifiers mostly for identifiers exposed only to the unit tests... but also for identifiers exposed to the benchmarker, and sometimes for identifiers exposed to a similar module, and occasionally for no really good reason at all. Now, we use FILENAME_PRIVATE identifiers for identifiers shared by Tor and the unit tests. They should be defined static when we aren't building the unit test, and globally visible otherwise. (The STATIC macro will keep us honest here.) For identifiers used only by the unit tests and never by Tor at all, on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS. This is not the motivating use case for the split test/non-test build system; it's just a test example to see how it works, and to take a chance to clean up the code a little.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bench.c1
-rw-r--r--src/test/test.c1
-rw-r--r--src/test/test_crypto.c3
3 files changed, 1 insertions, 4 deletions
diff --git a/src/test/bench.c b/src/test/bench.c
index 97a7909fc9..ca01d3c3e6 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -15,7 +15,6 @@ const char tor_git_revision[] = "";
#include "orconfig.h"
#define RELAY_PRIVATE
-#define CONFIG_PRIVATE
#include "or.h"
#include "onion_tap.h"
diff --git a/src/test/test.c b/src/test/test.c
index a9cf899a0e..7721d2c730 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -29,7 +29,6 @@ const char tor_git_revision[] = "";
/* These macros pull in declarations for some functions and structures that
* are typically file-private. */
#define BUFFERS_PRIVATE
-#define CONFIG_PRIVATE
#define GEOIP_PRIVATE
#define ROUTER_PRIVATE
#define CIRCUITSTATS_PRIVATE
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index f391cce6e6..9dc43b1d27 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -4,7 +4,6 @@
/* See LICENSE for licensing information */
#include "orconfig.h"
-#define CRYPTO_PRIVATE
#define CRYPTO_CURVE25519_PRIVATE
#include "or.h"
#include "test.h"
@@ -632,7 +631,7 @@ test_crypto_formats(void)
data1 = tor_strdup("ABCD1234ABCD56780000ABCD1234ABCD56780000");
test_eq(strlen(data1), 40);
data2 = tor_malloc(FINGERPRINT_LEN+1);
- add_spaces_to_fp(data2, FINGERPRINT_LEN+1, data1);
+ crypto_add_spaces_to_fp(data2, FINGERPRINT_LEN+1, data1);
test_streq(data2, "ABCD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 0000");
tor_free(data1);
tor_free(data2);