Updated the wb_kupdate code to allow a test to remove a previously existing mount_point.
Signed-off-by: Akshay Lal <[email protected]> --- autotest/client/tests/wb_kupdate/control 2010-09-23 14:29:16.000000000 -0700 +++ autotest/client/tests/wb_kupdate/control 2010-09-28 14:15:50.000000000 -0700 @@ -28,6 +28,8 @@ sparse_file=os.path.join( # Absolute path to the sparse file. os.getcwd(), 'sparse_file') +old_cleanup=False # Remove a previously created mount_point if it + # exits and not mounted. # Beginning execution of the xfstests: # ------------------------------------ @@ -40,4 +42,5 @@ file_system=file_system, remove_previous=remove_previous, sparse_file=sparse_file, + old_cleanup=old_cleanup, tag='wb_kupdate_execution') --- autotest/client/tests/wb_kupdate/wb_kupdate.py 2010-09-23 14:29:16.000000000 -0700 +++ autotest/client/tests/wb_kupdate/wb_kupdate.py 2010-09-28 14:15:50.000000000 -0700 @@ -47,17 +47,25 @@ return ret,output - def _check_parameters(self, mount_point, write_size, file_count): + def _check_parameters(self, mount_point, write_size, file_count, + old_cleanup=False): """Check all test parameters. @param mount_point: the path to the desired mount_point. @param write_size: the size of data in MB to write. @param file_count: the number of files to write. + @param old_cleanup: removes previous mount_point if it exists and is + not mounted. Default is False. """ # Check mount_point. if not os.path.exists(mount_point): logging.info('%s does not exist. Creating directory.', mount_point) self._execute('mkdir %s' % mount_point) + elif not os.path.ismount(mount_point) and old_cleanup: + logging.info('Removing previous mount_point directory') + self._execute('rmdir %s' % mount_point) + logging.info('Creating new mount_point.') + self._execute('mkdir %s' % mount_point) else: raise error.TestError('Mount point: %s already exists.' % mount_point) @@ -206,7 +214,8 @@ def run_once(self, duration, mount_point, file_count, write_size, max_flush_time=1, file_system=None, remove_previous=False, - sparse_file=os.path.join(os.getcwd(),'sparse_file')): + sparse_file=os.path.join(os.getcwd(),'sparse_file'), + old_cleanup=False): """Control execution of the test. @param duration: an integer defining the duration of test test in @@ -221,9 +230,11 @@ @param remove_previous: boolean that allows the removal of previous files before creating a new one. Default = False. @param sparse_file: the absolute path to the sparse file. + @param old_cleanup: removes previous mount_point if it exists and is + not mounted. Default is False. """ # Check validity of parameters. - self._check_parameters(mount_point, write_size, file_count) + self._check_parameters(mount_point, write_size, file_count, old_cleanup) self.mount_point = mount_point self.sparse_file = sparse_file _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
