Expose args as a proper job property, fix up some unit tests. In the
future I'm just going to start reverting patches that break tests.

Signed-off-by: John Admanski <[email protected]>

--- autotest/client/bin/job_unittest.py 2010-04-09 15:27:54.000000000 -0700
+++ autotest/client/bin/job_unittest.py 2010-04-09 15:27:54.000000000 -0700
@@ -85,6 +85,7 @@
             hostname = None
             user = None
             log = False
+            args = ''
         self.god.stub_function_to_return(job.utils, 'drop_caches', None)
 
         self.job._job_state = base_job_unittest.stub_job_state
@@ -236,6 +237,7 @@
         options.verbose = False
         options.hostname = 'localhost'
         options.user = 'my_user'
+        options.args = ''
         self.job.__init__(self.control, options,
                           extra_copy_cmdline=['more-blah'])
 
@@ -274,6 +276,7 @@
         options.verbose = False
         options.hostname = 'localhost'
         options.user = 'my_user'
+        options.args = ''
         error = Exception('fail')
 
         self.god.stub_function(self.job, '_post_record_init')
--- autotest/client/common_lib/base_job.py      2010-04-09 15:27:54.000000000 
-0700
+++ autotest/client/common_lib/base_job.py      2010-04-09 15:27:54.000000000 
-0700
@@ -461,6 +461,9 @@
         tag
             A tag identifying the job. Often used by the scheduler to give
             a name of the form NUMBER-USERNAME/HOSTNAME.
+        args
+            A list of addtional miscellaneous command-line arguments provided
+            when starting the job.
 
         last_boot_tag
             The label of the kernel from the last reboot. [OPTIONAL,PERSISTENT]
--- autotest/client/common_lib/base_job_unittest.py     2010-04-09 
15:27:54.000000000 -0700
+++ autotest/client/common_lib/base_job_unittest.py     2010-04-09 
15:27:54.000000000 -0700
@@ -76,7 +76,7 @@
             'configdir', 'profdir', 'toolsdir', 'conmuxdir',
 
             # other special attributes
-            'automatic_test_tag', 'bootloader', 'control',
+            'args', 'automatic_test_tag', 'bootloader', 'control',
             'default_profile_only', 'drop_caches',
             'drop_caches_between_iterations', 'harness', 'hosts',
             'last_boot_tag', 'logging', 'machines', 'num_tests_failed',
--- autotest/server/autotest.py 2010-04-09 15:08:24.000000000 -0700
+++ autotest/server/autotest.py 2010-04-09 15:27:54.000000000 -0700
@@ -363,7 +363,7 @@
         prologue_lines = []
 
         # Add the additional user arguments
-        prologue_lines.append("args = %r\n" % self.job._args)
+        prologue_lines.append("args = %r\n" % self.job.args)
 
         # If the packaging system is being used, add the repository list.
         repos = None
--- autotest/server/autotest_unittest.py        2010-04-09 15:27:54.000000000 
-0700
+++ autotest/server/autotest_unittest.py        2010-04-09 15:27:54.000000000 
-0700
@@ -30,6 +30,8 @@
         self.host.job.profilers.add_log = {}
         self.host.job.tmpdir = "/job/tmp"
         self.host.job.default_profile_only = False
+        self.host.job.args = []
+        self.host.job.record = lambda *args: None
 
         # stubs
         self.god.stub_function(utils, "get_server_dir")
@@ -69,6 +71,7 @@
 
         # create the autotest object
         self.base_autotest = autotest.BaseAutotest(self.host)
+        self.base_autotest.job = self.host.job
         self.god.stub_function(self.base_autotest, "_install_using_send_file")
 
         # stub out abspath
@@ -140,7 +143,6 @@
                                        type=bool).and_return(True)
         self.base_autotest._install_using_send_file.expect_call(self.host,
                                                                 'autodir')
-
         # run and check
         self.base_autotest.install()
         self.god.check_playback()
@@ -212,7 +214,7 @@
 
         cfile = self.god.create_mock_class(file, "file")
         cfile_orig = "original control file"
-        cfile_new = "job.add_repository(['repo'])\n"
+        cfile_new = "args = []\njob.add_repository(['repo'])\n"
         cfile_new += cfile_orig
 
         autotest.open.expect_call("temp").and_return(cfile)
--- autotest/server/server_job.py       2010-04-09 10:49:40.000000000 -0700
+++ autotest/server/server_job.py       2010-04-09 15:27:54.000000000 -0700
@@ -104,7 +104,7 @@
         else:
             self.user = getpass.getuser()
 
-        self._args = args
+        self.args = args
         self.machines = machines
         self._client = client
         self._record_prefix = ''
@@ -407,7 +407,7 @@
 
         self.aborted = False
         namespace['machines'] = machines
-        namespace['args'] = self._args
+        namespace['args'] = self.args
         namespace['job'] = self
         namespace['ssh_user'] = self._ssh_user
         namespace['ssh_port'] = self._ssh_port
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to