X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fintegration-tests%2Ftest_integration_reconnect.py.in;h=edd5226211d5f2b6fb1b5e27b7a99a23d4586a59;hb=f0a8d26b26cda04518e3555373172f6b4940e489;hp=62bd4bd987495c9222ce6424b5f6d810fc2f4280;hpb=00b211d05bf9ba8a82d120237963c5e84e57afeb;p=oweals%2Fgnunet.git diff --git a/src/integration-tests/test_integration_reconnect.py.in b/src/integration-tests/test_integration_reconnect.py.in index 62bd4bd98..edd522621 100755 --- a/src/integration-tests/test_integration_reconnect.py.in +++ b/src/integration-tests/test_integration_reconnect.py.in @@ -14,8 +14,8 @@ # # 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. +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. # # import sys @@ -49,15 +49,28 @@ check_timeout = 180 if os.name == "nt": tmp = os.getenv ("TEMP") + signals = [signal.SIGTERM, signal.SIGINT] else: tmp = "/tmp" + signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT] + +def cleanup_onerror (function, path, excinfo): + import stat + if not os.path.exists (path): + pass + elif not os.access(path, os.W_OK): + # Is the error an access error ? + os.chmod (path, stat.S_IWUSR) + function (path) + else: + raise def cleanup (): retries = 10 path = os.path.join (tmp, "c_bootstrap_server") test.p ("Removing " + path) while ((os.path.exists(path)) and (retries > 0)): - shutil.rmtree ((path), False) + shutil.rmtree ((path), False, cleanup_onerror) time.sleep (1) retries -= 1 if (os.path.exists(path)): @@ -68,7 +81,7 @@ def cleanup (): path = os.path.join (tmp, "c_no_nat_client") test.p ("Removing " + path) while ((os.path.exists(path)) and (retries > 0)): - shutil.rmtree ((path), False) + shutil.rmtree ((path), False, cleanup_onerror) time.sleep (1) retries -= 1 if (os.path.exists(path)): @@ -152,7 +165,7 @@ def SigHandler(signum = None, frame = None): print 'Test was aborted!' if (None != server): server.stop () - if (None != server): + if (None != client): client.stop () cleanup () sys.exit(success) @@ -167,7 +180,7 @@ def run (): server = None client = None - for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: + for sig in signals: signal.signal(sig, SigHandler) @@ -188,6 +201,10 @@ def run (): client.stop () cleanup () sys.exit(success) + + # Give the server time to start + time.sleep(5) + if (True != client.start()): print 'Failed to start client' if (None != server):