summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-06-14 14:37:49 -0400
committerNick Mathewson <nickm@torproject.org>2011-06-14 14:52:53 -0400
commitb031adf112e058595c04d44565c069d15f7ab257 (patch)
tree448a6167fe8ed9bd829624700d2615900e22a3bb /test
parent812d42e8863a7b9ccba8b03c5a7e32b31a1e4155 (diff)
downloadlibevent-b031adf112e058595c04d44565c069d15f7ab257.tar.gz
Don't break when building tests from git without python installed
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am8
-rw-r--r--test/Makefile.nmake5
-rw-r--r--test/regress_rpc.c9
3 files changed, 21 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index b867501f..0374d81e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -72,7 +72,13 @@ bench_httpclient_SOURCES = bench_httpclient.c
bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent_core.la
regress.gen.c regress.gen.h: regress.rpc $(top_srcdir)/event_rpcgen.py
- $(top_srcdir)/event_rpcgen.py $(srcdir)/regress.rpc || echo "No Python installed"
+ if $(top_srcdir)/event_rpcgen.py $(srcdir)/regress.rpc ; then \
+ echo "HI"; \
+ else \
+ echo "No Python installed; can't test RPC."; \
+ echo ""> regress.gen.c; \
+ echo "#define NO_PYTHON_EXISTS" > regress.gen.h; \
+ fi
DISTCLEANFILES = *~
diff --git a/test/Makefile.nmake b/test/Makefile.nmake
index 2c240eec..a899941f 100644
--- a/test/Makefile.nmake
+++ b/test/Makefile.nmake
@@ -50,6 +50,11 @@ bench_http.exe: bench_http.obj
bench_httpclient.exe: bench_httpclient.obj
$(CC) $(CFLAGS) $(LIBS) bench_httpclient.obj
+regress.gen.c regress.gen.h: regress.rpc ../event_rpcgen.py
+ echo // > regress.gen.c
+ echo #define NO_PYTHON_EXISTS > regress.gen.h
+ -python ..\event_rpcgen.py regress.rpc
+
clean:
-del $(REGRESS_OBJS)
-del $(OTHER_OBJS)
diff --git a/test/regress_rpc.c b/test/regress_rpc.c
index 9362e493..94a96f2b 100644
--- a/test/regress_rpc.c
+++ b/test/regress_rpc.c
@@ -71,6 +71,8 @@
#include "regress.h"
#include "regress_testutils.h"
+#ifndef NO_PYTHON_EXISTS
+
static struct evhttp *
http_setup(ev_uint16_t *pport)
{
@@ -870,6 +872,13 @@ end:
{ #name, run_legacy_test_fn, TT_FORK|TT_NEED_BASE|TT_LEGACY, \
&legacy_setup, \
rpc_##name }
+#else
+/* NO_PYTHON_EXISTS */
+
+#define RPC_LEGACY(name) \
+ { #name, NULL, TT_SKIP, NULL, NULL }
+
+#endif
struct testcase_t rpc_testcases[] = {
RPC_LEGACY(basic_test),