Thanks Lucas, your patch worked :) I am going to add one more feature to this test which will allow the users to specify a url to download the config file, once that is done I will send the patch for review.
Thanks, Dev On Fri, Feb 8, 2013 at 12:28 PM, Lucas Meneghel Rodrigues <[email protected]>wrote: > On 02/08/2013 05:20 PM, Dev Priya wrote: > >> Hi, >> >> I have been using Autotest for about a month. Yesterday I had a need to >> make some changes to the FFSB test where I added the code that accepts >> the cfg file as an argument in the setup step. After doing that change I >> noticed that it wasn't taking any effect! Reading a bit into the docs >> and looking at the files in autotest directory on the client I figured >> out that the cfg file as per the argument will be copied only once per >> test version number. Every time I increment the version number, the >> first test after that copies the correct file and there on that file >> remains there for the subsequent runs and setup is not run anymore. >> >> I got it that this is the intended behavior of setup but then how do I >> handle this particular case where I want to switch cfg files on per run >> basis but only one of them is getting copied over to the client? Can you >> guys please give me some advice on this or point me to an example that >> > does something similar? > > By default autotest would remove and recreate the source code dir and > compile the test suite again (param preserve_srcdir = False by default). > ffsb does not set preserve_srcdir = True, so I'm baffled as of why this > happens. > > You could easily override this by passing the cfg param to run_once (which > is anyway the place you should modify if you need things on a per test run > basis), and calling a function to update the cfg file. > > I haven't test this, I'll leave it as an exercise for you to test it, and > if you think it resolves your problem, let me know and send us a patch. > > Thanks, > > Lucas > > diff --git a/ffsb/ffsb.py b/ffsb/ffsb.py > index 5ded102..0713153 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,25 @@ 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). > + """ > + profile_src = os.path.join(self.bindir, cfg) > + 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
