From Fedora Project Wiki

No edit summary
(Add section on control files)
Line 1: Line 1:
== Will's notes (to be integrated into main page) ==
== Will's notes (to be integrated into main page) ==
=== Control Files ===
=== Control Files ===
The control file, when interpreted, starts by importing all the symbols from the <code>autotest_lib.client.bin.util</code> module.<ref>http://autotest.kernel.org/browser/branches/0.10.1/client/bin/job.py#L19</ref> This means the control files can use any function defined in <code>common_lib.utils</code> or <code>bin.base_utils</code>, among others<ref>http://autotest.kernel.org/browser/branches/0.10.1/client/bin/utils.py</ref>.
The control file is actually interpreted as a Python script. So you can do any of the normal pythonic things you might want to do.


=== Test Results ===
Before it reads the control file, Autotest imports all the symbols from the <code>autotest_lib.client.bin.util</code> module.<ref>http://autotest.kernel.org/browser/branches/0.10.1/client/bin/job.py#L19</ref> This means the control files can use any function defined in <code>common_lib.utils</code> or <code>bin.base_utils</code><ref>http://autotest.kernel.org/browser/branches/0.10.1/client/bin/utils.py</ref>. This lets you do things like:
<pre>arch = get_arch()
baseurl = 'http://download.fedora.redhat.com/pub/fedora/linux/development/%s/os/' % arch
job.run_test('some_test', arch=arch, baseurl=baseurl)</pre>
since <code>get_arch</code> is defined in common_lib.utils.
 
=== Test Objects: Getting test results ===
The result of the test is the exit code of the command. Usually retrieved like so:
The result of the test is the exit code of the command. Usually retrieved like so:
<pre>self.results = utils.system_output(cmd, retain_output=True)</pre>
<pre>self.results = utils.system_output(cmd, retain_output=True)</pre>
Line 19: Line 25:
** Just perf: <code>test.write_perf_keyval(perf_dict)</code>
** Just perf: <code>test.write_perf_keyval(perf_dict)</code>
** Both: <code>test.write_iteration_keyval(attr_dict, perf_dict)</code>
** Both: <code>test.write_iteration_keyval(attr_dict, perf_dict)</code>
=== Test Directories ===
=== Test Objects: Attributes for directories ===
<code>test</code> objects have the following attributes available<ref>http://autotest.kernel.org/browser/branches/0.10.1/client/common_lib/test.py#L9</ref>:
<code>test</code> objects have the following attributes available<ref>http://autotest.kernel.org/browser/branches/0.10.1/client/common_lib/test.py#L9</ref>:
<pre>
<pre>

Revision as of 19:49, 31 July 2009

Will's notes (to be integrated into main page)

Control Files

The control file is actually interpreted as a Python script. So you can do any of the normal pythonic things you might want to do.

Before it reads the control file, Autotest imports all the symbols from the autotest_lib.client.bin.util module.[1] This means the control files can use any function defined in common_lib.utils or bin.base_utils[2]. This lets you do things like:

arch = get_arch()
baseurl = 'http://download.fedora.redhat.com/pub/fedora/linux/development/%s/os/' % arch
job.run_test('some_test', arch=arch, baseurl=baseurl)

since get_arch is defined in common_lib.utils.

Test Objects: Getting test results

The result of the test is the exit code of the command. Usually retrieved like so:

self.results = utils.system_output(cmd, retain_output=True)

Further test-level info can be returned by using test.write_test_keyval(dict):

extrainfo = dict()
for line in self.results.stdout:
    if line.startswith("kernel version "):
        extrainfo['kernelver'] = line.split()[3]
    ...
self.write_test_keyval(extrainfo)
  • For per-iteration data (performance numbers, etc) there are three methods:
    • Just attr: test.write_attr_keyval(attr_dict)
    • Just perf: test.write_perf_keyval(perf_dict)
    • Both: test.write_iteration_keyval(attr_dict, perf_dict)

Test Objects: Attributes for directories

test objects have the following attributes available[3]:

outputdir       eg. results/<job>/<testname.tag>
resultsdir      eg. results/<job>/<testname.tag>/results
profdir         eg. results/<job>/<testname.tag>/profiling
debugdir        eg. results/<job>/<testname.tag>/debug
bindir          eg. tests/<test>
src             eg. tests/<test>/src
tmpdir          eg. tmp/<tempname>_<testname.tag>