Skip to content

Commit

Permalink
test: Detect if tor is running in test_fd_passing
Browse files Browse the repository at this point in the history
Also, replace spaces for a tab.

Signed-off-by: David Goulet <[email protected]>
  • Loading branch information
dgoulet committed Aug 4, 2017
1 parent 2a6f518 commit 70822d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test_socket_LDADD = $(LIBTAP) $(LIBTORSOCKS)
test_connect_SOURCES = test_connect.c
test_connect_LDADD = $(LIBTAP) $(LIBTORSOCKS)

test_fd_passing_SOURCES = test_fd_passing.c
test_fd_passing_SOURCES = test_fd_passing.c $(HELPER_SOURCES)
test_fd_passing_LDADD = $(LIBTAP) $(LIBTORSOCKS) -lpthread

test_getpeername_SOURCES = test_getpeername.c $(HELPER_SOURCES)
Expand Down
10 changes: 9 additions & 1 deletion tests/test_fd_passing.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <lib/torsocks.h>

#include <tap/tap.h>
#include "helpers.h"

#define NUM_TESTS 5

Expand Down Expand Up @@ -514,10 +515,17 @@ static void test_inet_socket(void)

int main(int argc, char **argv)
{
/* Try to connect to SocksPort localhost:9050 and if we can't skip. This is
* to avoid to have failing test if no tor daemon is available. */
if (!helper_is_default_tor_running()) {
goto end;
}

/* Libtap call for the number of tests planned. */
plan_tests(NUM_TESTS);

test_inet_socket();

return 0;
end:
return 0;
}

0 comments on commit 70822d0

Please sign in to comment.