# this doctest contains tests for miscellaneous features of the RPC interface
# that would clutter the main rpc_test
# setup
>>> from autotest_lib.frontend.afe import rpc_interface
>>> rpc_interface.add_profiler(name='oprofile')
1
>>> rpc_interface.add_profiler(name='iostat')
2
# profiler support in control file generation
>>> cf_info = rpc_interface.generate_control_file(
... client_control_file='print "Hi"\n',
... profilers=['oprofile', 'iostat'])
>>> print cf_info['control_file']
def step_init():
job.next_step('step0')
job.next_step('step1')
job.next_step('step2')
job.next_step('step3')
job.next_step('step4')
<BLANKLINE>
def step0():
job.profilers.add('oprofile')
<BLANKLINE>
def step1():
job.profilers.add('iostat')
<BLANKLINE>
def step2():
print "Hi"
<BLANKLINE>
return locals()
<BLANKLINE>
def step3():
job.profilers.delete('oprofile')
<BLANKLINE>
def step4():
job.profilers.delete('iostat')
# profile_only=False support in control file generation
>>> cf_info = rpc_interface.generate_control_file(
... client_control_file='print "Hi"\n',
... profilers=['oprofile'],
... profile_only=False)
>>> print cf_info['control_file']
def step_init():
job.next_step('step0')
job.next_step('step1')
job.next_step('step2')
job.next_step('step3')
<BLANKLINE>
def step0():
job.default_profile_only = False
<BLANKLINE>
def step1():
job.profilers.add('oprofile')
<BLANKLINE>
def step2():
print "Hi"
<BLANKLINE>
return locals()
<BLANKLINE>
def step3():
job.profilers.delete('oprofile')
# profile_only=True support in control file generation
>>> cf_info = rpc_interface.generate_control_file(
... client_control_file='print "Hi"\n',
... profilers=['iostat'],
... profile_only=True)
>>> print cf_info['control_file']
def step_init():
job.next_step('step0')
job.next_step('step1')
job.next_step('step2')
job.next_step('step3')
<BLANKLINE>
def step0():
job.default_profile_only = True
<BLANKLINE>
def step1():
job.profilers.add('iostat')
<BLANKLINE>
def step2():
print "Hi"
<BLANKLINE>
return locals()
<BLANKLINE>
def step3():
job.profilers.delete('iostat')
# test that multiline quoted strings are not indented
>>> import common
>>> from autotest_lib.frontend.afe import test, control_file
>>> import os
>>> control_path = os.path.join(os.path.dirname(test.__file__),
... 'doctests', 'test.control.3')
>>> control_path = os.path.abspath(control_path)
>>> class FakeTest(object):
... path = control_path
...
>>> print control_file.generate_control([FakeTest()], is_server=True) #doctest: +NORMALIZE_WHITESPACE
def step_init():
step0()
def step0():
client_code = """
some content\"""quoted content\"""
'''other quoted content\"""'''
\\"""
client_code2 = '''
some content\'''quoted content\'''
"""other quoted content\'''"""
\\'''
job.run_test('testname')
step_init()