It seems reasonable to me. The only other way to have a configurable harness would be with global_config.ini options, but I can certainly imagine cases where that isn't flexible enough. I suppose another alternative would be using -a and job.args which the harness already has access to, but an explicit harness args options is more obvious than cramming harness configuration into job.args.
-- John On Thu, Feb 10, 2011 at 6:24 AM, Lucas Meneghel Rodrigues <l...@redhat.com>wrote: > On Wed, 2011-02-09 at 08:41 -0500, Jan Stancek wrote: > > This parameter allows to pass extra configuration to > > custom harness. This can be any string, whose content > > has meaning for custom harness. > > For example: > > options to configure communication with custom server side > > Ok, the patchset looks good to me. John, do you see any problem with > allowing passing arguments to the harness? The purpose of all this is to > make autotest to play nice with a new harness that is being developed on > the beaker test project. > > > Signed-off-by: Jan Stancek <jstan...@redhat.com> > > --- > > client/bin/autotest | 3 +++ > > client/bin/harness.py | 4 ++-- > > client/bin/harness_ABAT.py | 2 +- > > client/bin/harness_autoserv.py | 2 +- > > client/bin/harness_simple.py | 2 +- > > client/bin/harness_standalone.py | 2 +- > > client/bin/harness_unittest.py | 15 +++++++++------ > > client/bin/job.py | 6 +++--- > > client/bin/job_unittest.py | 12 +++++++++--- > > 9 files changed, 30 insertions(+), 18 deletions(-) > > > > diff --git a/client/bin/autotest b/client/bin/autotest > > index e843b7f..28c6015 100755 > > --- a/client/bin/autotest > > +++ b/client/bin/autotest > > @@ -35,6 +35,9 @@ parser.add_option("-t", "--tag", dest="tag", > type="string", default="default", > > parser.add_option("-H", "--harness", dest="harness", type="string", > default='', > > help="set the harness type") > > > > +parser.add_option("-P", "--harness_args", dest="harness_args", > type="string", default='', > > + help="arguments delivered to harness") > > + > > parser.add_option("-U", "--user", dest="user", type="string", > > default='', help="set the job username") > > > > diff --git a/client/bin/harness.py b/client/bin/harness.py > > index bcb4f96..6265ca2 100644 > > --- a/client/bin/harness.py > > +++ b/client/bin/harness.py > > @@ -82,7 +82,7 @@ class harness(object): > > pass > > > > > > -def select(which, job): > > +def select(which, job, harness_args): > > if not which: > > which = 'standalone' > > > > @@ -91,6 +91,6 @@ def select(which, job): > > harness_name = 'harness_%s' % which > > harness_module = common.setup_modules.import_module(harness_name, > > > 'autotest_lib.client.bin') > > - harness_instance = getattr(harness_module, harness_name)(job) > > + harness_instance = getattr(harness_module, harness_name)(job, > harness_args) > > > > return harness_instance > > diff --git a/client/bin/harness_ABAT.py b/client/bin/harness_ABAT.py > > index 18459b8..4fdcf7b 100644 > > --- a/client/bin/harness_ABAT.py > > +++ b/client/bin/harness_ABAT.py > > @@ -45,7 +45,7 @@ class harness_ABAT(harness.harness): > > The job object for this job > > """ > > > > - def __init__(self, job): > > + def __init__(self, job, harness_args): > > """ > > job > > The job object for this job > > diff --git a/client/bin/harness_autoserv.py > b/client/bin/harness_autoserv.py > > index edab24f..94c4094 100644 > > --- a/client/bin/harness_autoserv.py > > +++ b/client/bin/harness_autoserv.py > > @@ -13,7 +13,7 @@ class harness_autoserv(harness.harness): > > The job object for this job > > """ > > > > - def __init__(self, job): > > + def __init__(self, job, harness_args): > > """ > > job > > The job object for this job > > diff --git a/client/bin/harness_simple.py b/client/bin/harness_simple.py > > index 5ff90d4..3f2b49a 100644 > > --- a/client/bin/harness_simple.py > > +++ b/client/bin/harness_simple.py > > @@ -15,7 +15,7 @@ class harness_simple(harness.harness): > > The job object for this job > > """ > > > > - def __init__(self, job): > > + def __init__(self, job, harness_args): > > """ > > job > > The job object for this job > > diff --git a/client/bin/harness_standalone.py > b/client/bin/harness_standalone.py > > index 9730850..75a2da9 100644 > > --- a/client/bin/harness_standalone.py > > +++ b/client/bin/harness_standalone.py > > @@ -16,7 +16,7 @@ class harness_standalone(harness.harness): > > The job object for this job > > """ > > > > - def __init__(self, job): > > + def __init__(self, job, harness_args): > > """ > > job > > The job object for this job > > diff --git a/client/bin/harness_unittest.py > b/client/bin/harness_unittest.py > > index 908243f..a94af55 100755 > > --- a/client/bin/harness_unittest.py > > +++ b/client/bin/harness_unittest.py > > @@ -18,8 +18,9 @@ class harness_unittest(unittest.TestCase): > > job = object() > > self.god.stub_class(harness_standalone, "harness_standalone") > > > > - harness_standalone.harness_standalone.expect_new(job) > > - harness.select(None, job) > > + harness_args = '' > > + harness_standalone.harness_standalone.expect_new(job, > harness_args) > > + harness.select(None, job, harness_args) > > self.god.check_playback() > > > > > > @@ -27,8 +28,9 @@ class harness_unittest(unittest.TestCase): > > job = object() > > self.god.stub_class(harness_standalone, "harness_standalone") > > > > - harness_standalone.harness_standalone.expect_new(job) > > - harness.select('standalone', job) > > + harness_args = '' > > + harness_standalone.harness_standalone.expect_new(job, > harness_args) > > + harness.select('standalone', job, harness_args) > > self.god.check_playback() > > > > > > @@ -36,8 +38,9 @@ class harness_unittest(unittest.TestCase): > > job = object() > > self.god.stub_class(harness_ABAT, "harness_ABAT") > > > > - harness_ABAT.harness_ABAT.expect_new(job) > > - harness.select('ABAT', job) > > + harness_args = '' > > + harness_ABAT.harness_ABAT.expect_new(job, harness_args) > > + harness.select('ABAT', job, harness_args) > > self.god.check_playback() > > > > > > diff --git a/client/bin/job.py b/client/bin/job.py > > index 3e285c6..948f899 100644 > > --- a/client/bin/job.py > > +++ b/client/bin/job.py > > @@ -192,7 +192,7 @@ class base_client_job(base_job.base_job): > > if stored_harness: > > selected_harness = stored_harness > > > > - self.harness = harness.select(selected_harness, self) > > + self.harness = harness.select(selected_harness, self, > options.harness_args) > > > > # set up the status logger > > def client_job_record_hook(entry): > > @@ -388,8 +388,8 @@ class base_client_job(base_job.base_job): > > self.control = os.path.abspath(control) > > > > > > - def harness_select(self, which): > > - self.harness = harness.select(which, self) > > + def harness_select(self, which, harness_args): > > + self.harness = harness.select(which, self, harness_args) > > > > > > def config_set(self, name, value): > > diff --git a/client/bin/job_unittest.py b/client/bin/job_unittest.py > > index 0e5aede..88fa272 100755 > > --- a/client/bin/job_unittest.py > > +++ b/client/bin/job_unittest.py > > @@ -82,6 +82,7 @@ class test_init_minimal_options(abstract_test_init, > job_test_case): > > verbose = False > > cont = False > > harness = 'stub' > > + harness_args = None > > hostname = None > > user = None > > log = False > > @@ -181,7 +182,8 @@ class test_base_job(unittest.TestCase): > > my_harness = self.god.create_mock_class(harness.harness, > > 'my_harness') > > harness.select.expect_call(None, > > - self.job).and_return(my_harness) > > + self.job, > > + None).and_return(my_harness) > > > > return resultdir, my_harness > > > > @@ -237,6 +239,7 @@ class test_base_job(unittest.TestCase): > > options.tag = self.jobtag > > options.cont = cont > > options.harness = None > > + options.harness_args = None > > options.log = False > > options.verbose = False > > options.hostname = 'localhost' > > @@ -277,6 +280,7 @@ class test_base_job(unittest.TestCase): > > options.tag = self.jobtag > > options.cont = False > > options.harness = None > > + options.harness_args = None > > options.log = False > > options.verbose = False > > options.hostname = 'localhost' > > @@ -322,10 +326,12 @@ class test_base_job(unittest.TestCase): > > > > # record > > which = "which" > > - harness.select.expect_call(which, self.job).and_return(None) > > + harness_args = '' > > + harness.select.expect_call(which, self.job, > > + harness_args).and_return(None) > > > > # run and test > > - self.job.harness_select(which) > > + self.job.harness_select(which, harness_args) > > self.god.check_playback() > > > > > > >
_______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest