From c6319dde0578156dcca0092451e2e619c97e49d8 Mon Sep 17 00:00:00 2001
From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Mon, 20 Oct 2008 08:51:20 -0700
Subject: [PATCH] fuse/runtests: added a --no-cleanup option

the code had a 'fullcleanup' flag internally which controlled whether
working directories were cleaned up.  this promotes that to a command
line option (negated) '--no-cleanup' defaulting to False, i.e. do cleanup
---
 contrib/fuse/runtests.py | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py
index 9f03bd8b..45d157c7 100644
--- a/contrib/fuse/runtests.py
+++ b/contrib/fuse/runtests.py
@@ -108,6 +108,8 @@ class FuseTestsOptions(usage.Options):
          "Causes the test system to pause at various points, to facilitate debugging"],
         ["web-open", None,
          "Opens a web browser to the web ui at the start of each impl's tests"],
+        ["no-cleanup", False,
+         "Prevents the cleanup of the working directories, to allow analysis thereof"],
          ]
 
     def postOptions(self):
@@ -163,9 +165,6 @@ class SystemTest (object):
     def __init__(self, config):
         self.config = config
 
-        # These members represent configuration:
-        self.fullcleanup = False # FIXME: Make this a commandline option.
-
         # These members represent test state:
         self.cliexec = None
         self.testroot = None
@@ -179,14 +178,7 @@ class SystemTest (object):
     # exception unwinding to do cleanup properly.  Each "layer" invokes
     # a deeper layer, and each layer does its own cleanup upon exit.
 
-    def run(self, fullcleanup = False):
-        '''
-        If full_cleanup, delete all temporary state.
-        Else:  If there is an error do not delete basedirs.
-
-        Set to False if you wish to analyze a failure.
-        '''
-        self.fullcleanup = fullcleanup
+    def run(self):
         print '\n*** Setting up system tests.'
         try:
             results = self.init_cli_layer()
@@ -244,7 +236,7 @@ class SystemTest (object):
         try:
             return self.launch_introducer_layer()
         finally:
-            if self.fullcleanup:
+            if not self.config['no-cleanup']:
                 print 'Cleaning up test root directory.'
                 try:
                     shutil.rmtree(self.testroot)
-- 
2.45.2