Code review comment for lp:~spiv/bzr-usertest/server-start-stop

Revision history for this message
Martin Pool (mbp) wrote :

It looks good; there's just one nit.

=== modified file 'suiterunner.py'
--- suiterunner.py 2008-07-06 07:35:11 +0000
+++ suiterunner.py 2008-10-08 10:07:00 +0000

@@ -255,6 +256,10 @@
         csv_data = [['Task','Label','Measure','Unit'] + tools]
         index_for_action = {}
         tool_count = len(tools)
+ if 'server_start_cmd' in dynamic_params:
+ exit_code = subprocess.call(dynamic_params['server_start_cmd'], shell=True)
+ assert exit_code == 0, exit_code
+ orig_cwd = os.getcwd()
         for tool_index,tool in enumerate(tools):
             for task_index,task in enumerate(suite.iter_scripts()):
                 initial_params['task_name'] = task.name()
@ -275,4 +280,8 @@
                             csv_data.append([task,label,measure,unit] +
                                 ['-' for i in xrange(tool_count)])
                         csv_data[index][4 + tool_index] = measurement
+ if 'server_stop_cmd' in dynamic_params:
+ os.chdir(orig_cwd)
+ exit_code = subprocess.call(dynamic_params['server_stop_cmd'], shell=True)
+ assert exit_code == 0, exit_code
         return csv_data

Don't use 'assert' when checking the state of the outside world or user input.

« Back to merge proposal