commit 3a3d2e47428d92e1953bddf02dec0840cedb9992 Author: Zack Weinberg zackw@panix.com Date: Mon Jul 25 17:11:27 2011 -0700
Add a stub integration test runner in Python, which will eventually subsume the existing integration test fragments. --- Makefile.am | 10 ++++++++++ configure.ac | 8 ++++++++ src/test/tester.py.in | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/Makefile.am b/Makefile.am index fe47256..5a815ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,3 +51,13 @@ noinst_HEADERS = \ EXTRA_DIST = doc/protocol-spec.txt
TESTS = unittests + +if HAVE_PYTHON +TESTS += tester.py +noinst_PROGRAMS += tester.py +tester_py_SOURCES = src/test/tester.py.in + +tester.py: src/test/tester.py.in Makefile + $(SED) -e 's,[@]PYTHON[@],$(PYTHON),' < $< > $@ + chmod +x $@ +endif diff --git a/configure.ac b/configure.ac index 08d21c3..ceeec89 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,14 @@ m4_pushdef([AC_INCLUDES_DEFAULT], [$1])
AC_PROG_CC AC_PROG_RANLIB +AC_PROG_SED + +AM_PATH_PYTHON([2.6],, [:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"]) +if test "$PYTHON" == ":"; then + AC_MSG_WARN([Python interpreter not found; integration tests disabled.]) +fi + PKG_PROG_PKG_CONFIG
### Libraries ### diff --git a/src/test/tester.py.in b/src/test/tester.py.in new file mode 100644 index 0000000..d330e69 --- /dev/null +++ b/src/test/tester.py.in @@ -0,0 +1,18 @@ +#! @PYTHON@ + +# Integration tests for obfsproxy. +# +# The obfsproxy binary is assumed to exist in the current working +# directory, and you need to have Python 2.6 or better (but not 3). +# You need to be able to make connections to arbitrary high-numbered +# TCP ports on the loopback interface (there is, however, an effort to +# figure out which ones are already in use) and all IPv4 addresses in +# 127.0.0/24 are assumed to be bound to the loopback interface. + +import socket +import struct +import subprocess +import sys + +print "All tests successful." +sys.exit(0)