On 02/08/2013 09:47 PM, Dev Priya wrote:
Signed-off-by: Dev Priya <[email protected]>
---
ffsb/control | 8 ++++++++
ffsb/ffsb.py | 24 ++++++++++++++++++++----
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/ffsb/control b/ffsb/control
index c7e92eb..adac105 100644
--- a/ffsb/control
+++ b/ffsb/control
@@ -11,6 +11,14 @@ profiles to measure of different workloads, and it supports
multiple groups of threads across multiple filesystems.
For more info, see http://sourceforge.net/projects/ffsb/
+
+To override the default cfg file use the following syntax -
+
+Using a cfg file in the test's root directory -
+job.run_test('ffsb', cfg='new_profile.cfg')
+
+Using a URL -
+job.run_test('ffsb', cfg='http://myserver.com/new_profile.cfg')
"""
job.run_test('ffsb')
diff --git a/ffsb/ffsb.py b/ffsb/ffsb.py
index 5ded102..4822e39 100644
--- a/ffsb/ffsb.py
+++ b/ffsb/ffsb.py
@@ -157,9 +157,7 @@ class ffsb(test.test):
@param tarball: FFSB tarball. Could be either a path relative to
self.srcdir or a URL.
"""
- profile_src = os.path.join(self.bindir, 'profile.cfg.sample')
- profile_dst = os.path.join(os.path.dirname(self.srcdir), 'profile.cfg')
- shutil.copyfile(profile_src, profile_dst)
+ self.update_config('profile.cfg.sample')
tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
utils.extract_tarball_to_dir(tarball, self.srcdir)
os.chdir(self.srcdir)
@@ -168,10 +166,28 @@ class ffsb(test.test):
utils.make()
- def run_once(self):
+ def update_config(self, cfg):
+ """
+ Update the profile.cfg file.
+
+ @param cfg: Basename of the cfg file, that should be on the
+ test module folder (client/tests/ffsb) or URL of the
+ remote config file.
+ """
+ utils.unmap_url(self.bindir, cfg, self.bindir);
+ filename = cfg.split("/")[len(cfg.split("/")) - 1]
^ Here, os.path.basename() does what you want, and it is much cleaner.
So please send a v2 with that fixed. Other than that, the patch looks good.
Cheers,
Lucas
+ profile_src = os.path.join(self.bindir, filename)
+ profile_dst = os.path.join(os.path.dirname(self.srcdir), 'profile.cfg')
+ shutil.copyfile(profile_src, profile_dst)
+
+
+ def run_once(self, cfg=None):
"""
Runs a single iteration of the FFSB.
"""
+ if cfg is not None:
+ self.update_config(cfg)
+
self.dup_ffsb_profilefl()
# Run FFSB using abspath
cmd = '%s/ffsb %s/profile.cfg' % (self.srcdir, self.srcdir)
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel