Allow file system partition tests to optionally defer post-test fsck's to a 
slightly later point in the test script, for more control over container memory 
during the fsck.

Signed-off-by: Duane Sand <[email protected]>

--- autotest/client/bin/partition.py    2010-09-30 14:37:09.000000000 -0700
+++ autotest/client/bin/partition.py    2010-10-08 14:14:04.000000000 -0700
@@ -311,11 +311,11 @@
 
 
 def run_test_on_partitions(job, test, partitions, mountpoint_func,
-                           tag, fs_opt, **dargs):
+                           tag, fs_opt, do_fsck=True, **dargs):
     """
     Run a test that requires multiple partitions.  Filesystems will be
     made on the partitions and mounted, then the test will run, then the
-    filesystems will be unmounted and fsck'd.
+    filesystems will be unmounted and optionally fsck'd.
 
     @param job: A job instance to run the test
     @param test: A string containing the name of the test
@@ -327,6 +327,7 @@
             files that make multiple calls to this routine with the same value
             of 'test'.)
     @param fs_opt: An FsOptions instance that describes what filesystem to make
+    @param do_fsck: include fsck in post-test partition cleanup.
     @param dargs: Dictionary of arguments to be passed to job.run_test() and
             eventually the test
     """
@@ -342,8 +343,10 @@
     # run the test against all the partitions
     job.run_test(test, tag=tag, partitions=partitions, dir=mountpoint, **dargs)
 
-    # fsck and then remake all the filesystems in parallel
-    parallel(partitions, 'cleanup_after_test')
+    parallel(partitions, 'unmount')  # unmount all partitions in parallel
+    if do_fsck:
+        parallel(partitions, 'fsck')  # fsck all partitions in parallel
+    # else fsck is done by caller
 
 
 class partition(object):
@@ -430,15 +433,6 @@
         self.mount(mountpoint)
 
 
-    def cleanup_after_test(self):
-        """
-        Cleans up a partition after running a filesystem test.  The
-        filesystem is unmounted, and then checked for errors.
-        """
-        self.unmount()
-        self.fsck()
-
-
     def run_test_on_partition(self, test, mountpoint_func, **dargs):
         """
         Executes a test fs-style (umount,mkfs,mount,test)
@@ -470,7 +464,9 @@
             try:
                 self.job.run_test(test, tag=test_tag, dir=mountpoint, **dargs)
             finally:
-                self.cleanup_after_test()
+                self.unmount()
+                self.fsck()
+
 
         mountpoint = mountpoint_func(self)
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to