From b24b1e26e24f18c77035f4255dee90757b08365b Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Fri, 30 Apr 2010 05:35:52 +0000 Subject: Move python test scripts to .py.in and sed in the correct python path. --- src/peerinfo-tool/Makefile.am | 15 +++++- src/peerinfo-tool/test_gnunet_peerinfo.py | 72 ---------------------------- src/peerinfo-tool/test_gnunet_peerinfo.py.in | 72 ++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 74 deletions(-) delete mode 100755 src/peerinfo-tool/test_gnunet_peerinfo.py create mode 100755 src/peerinfo-tool/test_gnunet_peerinfo.py.in (limited to 'src/peerinfo-tool') diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am index 1fc088ad9..8b74efefb 100644 --- a/src/peerinfo-tool/Makefile.am +++ b/src/peerinfo-tool/Makefile.am @@ -20,8 +20,19 @@ gnunet_peerinfo_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la if HAVE_PYTHON_PEXPECT -TESTS_ENVIRONMENT = $(PYTHON) -TESTS = \ +check_SCRIPTS = \ test_gnunet_peerinfo.py endif +TESTS = $(check_SCRIPTS) + +do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' + +test_gnunet_peerinfo.py: test_gnunet_peerinfo.py.in Makefile + $(do_subst) < $(srcdir)/test_gnunet_peerinfo.py.in > test_gnunet_peerinfo.py + chmod +x test_gnunet_peerinfo.py + +EXTRADIST = \ + test_gnunet_peerinfo.py.in + +CLEANFILES = $(check_SCRIPTS) diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py b/src/peerinfo-tool/test_gnunet_peerinfo.py deleted file mode 100755 index bab59ee47..000000000 --- a/src/peerinfo-tool/test_gnunet_peerinfo.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# This file is part of GNUnet. -# (C) 2010 Christian Grothoff (and other contributing authors) -# -# GNUnet is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation; either version 2, or (at your -# option) any later version. -# -# GNUnet is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNUnet; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. -# -# Testcase for gnunet-peerinfo -import pexpect -import os -import signal -import re - -pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') -pinfo.expect ('Timeout trying to interact with PEERINFO service\r') -pinfo.expect (pexpect.EOF); -os.system ('rm -rf /tmp/gnunet-test-peerinfo/') -os.system ('gnunet-arm -sq -c test_gnunet_peerinfo_data.conf') - -try: - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -s') - pinfo.expect (re.compile ("I am peer `.*\'.\r")); - pinfo.expect (pexpect.EOF); - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs') - pinfo.expect (re.compile (".......................................................................................................\r")); - pinfo.expect (pexpect.EOF); - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid') - pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r")); - pinfo.expect (pexpect.EOF); - - - os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') - os.system ('sleep 1') - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') - pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); - pinfo.expect (re.compile (" *localhost:24357\r")); - pinfo.expect (pexpect.EOF); - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -n') - pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); - pinfo.expect (re.compile (" *127..*:24357\r")); - pinfo.expect (pexpect.EOF); - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs') - pid = pinfo.read (-1) - pid = pid.strip () - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid) - pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r")); - pinfo.expect (pexpect.EOF); - - pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid) - pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r")); - pinfo.expect (pexpect.EOF); - -finally: - os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') - os.system ('rm -rf /tmp/gnunet-test-peerinfo/') diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in new file mode 100755 index 000000000..ba542f28a --- /dev/null +++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in @@ -0,0 +1,72 @@ +#!@PYTHON@ +# This file is part of GNUnet. +# (C) 2010 Christian Grothoff (and other contributing authors) +# +# GNUnet is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2, or (at your +# option) any later version. +# +# GNUnet is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNUnet; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# Testcase for gnunet-peerinfo +import pexpect +import os +import signal +import re + +pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') +pinfo.expect ('Timeout trying to interact with PEERINFO service\r') +pinfo.expect (pexpect.EOF); +os.system ('rm -rf /tmp/gnunet-test-peerinfo/') +os.system ('gnunet-arm -sq -c test_gnunet_peerinfo_data.conf') + +try: + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -s') + pinfo.expect (re.compile ("I am peer `.*\'.\r")); + pinfo.expect (pexpect.EOF); + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs') + pinfo.expect (re.compile (".......................................................................................................\r")); + pinfo.expect (pexpect.EOF); + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid') + pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r")); + pinfo.expect (pexpect.EOF); + + + os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') + os.system ('sleep 1') + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') + pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); + pinfo.expect (re.compile (" *localhost:24357\r")); + pinfo.expect (pexpect.EOF); + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -n') + pinfo.expect (re.compile ("Peer `.*\' with trust *0\r")); + pinfo.expect (re.compile (" *127..*:24357\r")); + pinfo.expect (pexpect.EOF); + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs') + pid = pinfo.read (-1) + pid = pid.strip () + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid) + pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r")); + pinfo.expect (pexpect.EOF); + + pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid) + pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r")); + pinfo.expect (pexpect.EOF); + +finally: + os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') + os.system ('rm -rf /tmp/gnunet-test-peerinfo/') -- cgit v1.2.3