tools Package

JUnit_api Module

class autotest.client.tools.JUnit_api.errorType(message=None, type_=None, valueOf_=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

The error message. e.g., if a java exception is thrown, the return value of getMessage()The type of error that occurred. e.g., if a java execption is thrown the full class name of the exception.

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='errorType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='errorType')[source]
exportChildren(outfile, level, namespace_='', name_='errorType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='errorType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_message()[source]
get_type()[source]
get_valueOf_()[source]
hasContent_()[source]
set_message(message)[source]
set_type(type_)[source]
set_valueOf_(valueOf_)[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.failureType(message=None, type_=None, valueOf_=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

The message specified in the assertThe type of the assert.

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='failureType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='failureType')[source]
exportChildren(outfile, level, namespace_='', name_='failureType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='failureType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_message()[source]
get_type()[source]
get_valueOf_()[source]
hasContent_()[source]
set_message(message)[source]
set_type(type_)[source]
set_valueOf_(valueOf_)[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.propertiesType(property=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

add_property(value)[source]
build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='propertiesType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='propertiesType')[source]
exportChildren(outfile, level, namespace_='', name_='propertiesType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='propertiesType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_property()[source]
hasContent_()[source]
insert_property(index, value)[source]
set_property(property)[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.propertyType(name=None, value=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='propertyType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='propertyType')[source]
exportChildren(outfile, level, namespace_='', name_='propertyType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='propertyType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_name()[source]
get_value()[source]
hasContent_()[source]
set_name(name)[source]
set_value(value)[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.system_err[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

Data that was written to standard error while the test was executed

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='system-err', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='system-err')[source]
exportChildren(outfile, level, namespace_='', name_='system-err', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='system-err')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
hasContent_()[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.system_out[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

Data that was written to standard out while the test was executed

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='system-out', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='system-out')[source]
exportChildren(outfile, level, namespace_='', name_='system-out', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='system-out')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
hasContent_()[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.testcaseType(classname=None, name=None, time=None, error=None, failure=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

Name of the test methodFull class name for the class the test method is in.Time taken (in seconds) to execute the test

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='testcaseType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='testcaseType')[source]
exportChildren(outfile, level, namespace_='', name_='testcaseType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='testcaseType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_classname()[source]
get_error()[source]
get_failure()[source]
get_name()[source]
get_time()[source]
hasContent_()[source]
set_classname(classname)[source]
set_error(error)[source]
set_failure(failure)[source]
set_name(name)[source]
set_time(time)[source]
subclass = None
superclass = None
class autotest.client.tools.JUnit_api.testsuite(tests=None, errors=None, name=None, timestamp=None, hostname=None, time=None, failures=None, properties=None, testcase=None, system_out=None, system_err=None, extensiontype_=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

Contains the results of exexuting a testsuiteFull class name of the test for non-aggregated testsuite documents. Class name without the package for aggregated testsuites documentswhen the test was executed. Timezone may not be specified.Host on which the tests were executed. ‘localhost’ should be used if the hostname cannot be determined.The total number of tests in the suiteThe total number of tests in the suite that failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEqualsThe total number of tests in the suite that errorrd. An errored test is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test.Time taken (in seconds) to execute the tests in the suite

add_testcase(value)[source]
build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='testsuite', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='testsuite')[source]
exportChildren(outfile, level, namespace_='', name_='testsuite', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='testsuite')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_errors()[source]
get_extensiontype_()[source]
get_failures()[source]
get_hostname()[source]
get_name()[source]
get_properties()[source]
get_system_err()[source]
get_system_out()[source]
get_testcase()[source]
get_tests()[source]
get_time()[source]
get_timestamp()[source]
hasContent_()[source]
insert_testcase(index, value)[source]
set_errors(errors)[source]
set_extensiontype_(extensiontype_)[source]
set_failures(failures)[source]
set_hostname(hostname)[source]
set_name(name)[source]
set_properties(properties)[source]
set_system_err(system_err)[source]
set_system_out(system_out)[source]
set_testcase(testcase)[source]
set_tests(tests)[source]
set_time(time)[source]
set_timestamp(timestamp)[source]
subclass = None
superclass = None
validate_ISO8601_DATETIME_PATTERN(value)[source]
class autotest.client.tools.JUnit_api.testsuiteType(tests=None, errors=None, name=None, timestamp=None, hostname=None, time=None, failures=None, properties=None, testcase=None, system_out=None, system_err=None, id=None, package=None)[source]

Bases: autotest.client.tools.JUnit_api.testsuite

Derived from testsuite/@name in the non-aggregated documentsStarts at ‘0’ for the first testsuite and is incremented by 1 for each following testsuite

build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='testsuiteType', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='testsuiteType')[source]
exportChildren(outfile, level, namespace_='', name_='testsuiteType', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='testsuiteType')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_id()[source]
get_package()[source]
hasContent_()[source]
set_id(id)[source]
set_package(package)[source]
subclass = None
superclass

alias of testsuite

class autotest.client.tools.JUnit_api.testsuites(testsuite=None)[source]

Bases: autotest.client.tools.JUnit_api.GeneratedsSuper

Contains an aggregation of testsuite results

add_testsuite(value)[source]
build(node)[source]
buildAttributes(node, attrs, already_processed)[source]
buildChildren(child_, node, nodeName_, fromsubclass_=False)[source]
export(outfile, level, namespace_='', name_='testsuites', namespacedef_='')[source]
exportAttributes(outfile, level, already_processed, namespace_='', name_='testsuites')[source]
exportChildren(outfile, level, namespace_='', name_='testsuites', fromsubclass_=False)[source]
exportLiteral(outfile, level, name_='testsuites')[source]
exportLiteralAttributes(outfile, level, already_processed, name_)[source]
exportLiteralChildren(outfile, level, name_)[source]
static factory(*args_, **kwargs_)[source]
get_testsuite()[source]
hasContent_()[source]
insert_testsuite(index, value)[source]
set_testsuite(testsuite)[source]
subclass = None
superclass = None

boottool Module

A boottool clone, but written in python and relying mostly on grubby[1].

[1] - http://git.fedorahosted.org/git/?p=grubby.git

class autotest.client.tools.boottool.Grubby(path=None, opts=None)[source]

Bases: object

Grubby wrapper

This class calls the grubby binary for most commands, but also adds some functionality that is not really suited to be included in int, such as boot-once.

SUPPORTED_BOOTLOADERS = ('lilo', 'grub2', 'grub', 'extlinux', 'yaboot', 'elilo')
add_args(kernel, args)[source]

Add cmdline arguments for the specified kernel.

Parameters:
  • kernel – can be a position number (index) or title
  • args – argument to be added to the current list of args
add_kernel(path, title='autoserv', root=None, args=None, initrd=None, default=False, position='end')[source]

Add a kernel entry to the bootloader (or replace if one exists already with the same title).

Parameters:
  • path – string path to the kernel image file
  • title – title of this entry in the bootloader config
  • root – string of the root device
  • args – string with cmdline args
  • initrd – string path to the initrd file
  • default – set to True to make this entry the default one (default False)
  • position – where to insert the new entry in the bootloader config file (default ‘end’, other valid input ‘start’, or # of the title)
  • xen_hypervisor – xen hypervisor image file (valid only when xen mode is enabled)
arch_probe()

Get the system architecture

This is much simpler version then the original boottool version, that does not attempt to filter the result of the command / system call that returns the archicture.

Returns:string with system archicteture, such as x86_64, ppc64, etc
boot_once(title=None)[source]

Configures the bootloader to boot an entry only once

This is not implemented by grubby, but directly implemented here, via the ‘boot_once_<bootloader>’ method.

boot_once_elilo(entry_index)[source]

Implements boot once for machines with kernel >= 2.6

This manipulates EFI variables via the interface available at /sys/firmware/efi/vars

boot_once_grub(entry_index)[source]

Implements the boot once feature for the grub bootloader

boot_once_grub2(entry_index)[source]

Implements the boot once feature for the grub2 bootloader

Caveat: this assumes the default set is of type “saved”, and not a numeric value.

boot_once_yaboot(entry_title)[source]

Implements the boot once feature for the yaboot bootloader

bootloader_probe()

Get the bootloader name that is detected on this machine

This module performs the same action as client side boottool.py get_type() method, but with a better name IMHO.

Returns:name of detected bootloader
default()

Get the default entry index.

This module performs the same action as client side boottool.py get_default() method, but with a better name IMHO.

Returns:an integer with the the default entry.
get_architecture()[source]

Get the system architecture

This is much simpler version then the original boottool version, that does not attempt to filter the result of the command / system call that returns the archicture.

Returns:string with system archicteture, such as x86_64, ppc64, etc
get_bootloader()[source]

Get the bootloader name that is detected on this machine

This module performs the same action as client side boottool.py get_type() method, but with a better name IMHO.

Returns:name of detected bootloader
get_default()

Get the default entry index.

This module performs the same action as client side boottool.py get_default() method, but with a better name IMHO.

Returns:an integer with the the default entry.
get_default_index()[source]

Get the default entry index.

This module performs the same action as client side boottool.py get_default() method, but with a better name IMHO.

Returns:an integer with the the default entry.
get_default_title()[source]

Get the default entry title.

Conforms to the client side boottool.py API, but rely directly on grubby functionality.

Returns:a string of the default entry title.
get_entries()[source]

Get all entries information.

Returns:a dictionary of index -> entry where entry is a dictionary of entry information as described for get_entry().
get_entry(search_info)[source]

Get a single bootloader entry information.

NOTE: if entry is “fallback” and bootloader is grub use index instead of kernel title (“fallback”) as fallback is a special option in grub

Parameters:search_info – can be ‘default’, position number or title
Returns:a dictionary of key->value where key is the type of entry information (ex. ‘title’, ‘args’, ‘kernel’, etc) and value is the value for that piece of information.
get_grubby_version()[source]

Get the version of grubby that is installed on this machine

Returns:tuple with (major, minor) grubby version
get_grubby_version_raw()[source]

Get the version of grubby that is installed on this machine as is

Returns:string with raw output from grubby –version
get_info(entry='ALL')[source]

Returns information on a given entry, or all of them if not specified

The information is returned as a set of lines, that match the output of ‘grubby –info=<entry>’

Parameters:entry (string) – entry description, usually an index starting from 0
Returns:set of lines
get_info_lines(entry='ALL')[source]

Returns information on a given entry, or all of them if not specified

The information is returned as a set of lines, that match the output of ‘grubby –info=<entry>’

Parameters:entry (string) – entry description, usually an index starting from 0
Returns:set of lines
get_title_for_kernel(path)[source]

Returns a title for a particular kernel.

Parameters:path – path of the kernel image configured in the boot config
Returns:if the given kernel path is found it will return a string with the title for the found entry, otherwise returns None
get_titles()[source]

Get the title of all boot entries.

Returns:list with titles of boot entries
get_type()

Get the bootloader name that is detected on this machine

This module performs the same action as client side boottool.py get_type() method, but with a better name IMHO.

Returns:name of detected bootloader
grubby_build(topdir, tarball)[source]

Attempts to build grubby from the source tarball

grubby_install(path=None)[source]

Attempts to install a recent enough version of grubby

So far tested on:
  • Fedora 16 x86_64
  • Debian 6 x86_64
  • SuSE 12.1 x86_64
  • RHEL 4 on ia64 (with updated python 2.4)
  • RHEL 5 on ia64
  • RHEL 6 on ppc64
grubby_install_backup(path)[source]

Backs up the current grubby binary to make room the one we’ll build

Parameters:path (string) – path to the binary that should be backed up
grubby_install_fetch_tarball(topdir)[source]

Fetches and verifies the grubby source tarball

grubby_install_patch_makefile()[source]

Patch makefile, making CFLAGS more forgivable to older toolchains

remove_args(kernel, args)[source]

Removes specified cmdline arguments.

Parameters:
  • kernel – can be a position number (index) or title
  • args – argument to be removed of the current list of args
remove_kernel(kernel)[source]

Removes a specific entry from the bootloader configuration.

Parameters:kernel – entry position or entry title.

FIXME: param kernel should also take ‘start’ or ‘end’.

set_default(index)

Sets the given entry number to be the default on every next boot

To set a default only for the next boot, use boot_once() instead.

This module performs the same action as client side boottool.py set_default() method, but with a better name IMHO.

Note: both –set-default=<kernel> and –set-default-index=<index> on grubby returns no error when it doesn’t find the kernel or index. So this method will, until grubby gets fixed, always return success.

Parameters:index – entry index number to set as the default.
set_default_by_index(index)[source]

Sets the given entry number to be the default on every next boot

To set a default only for the next boot, use boot_once() instead.

This module performs the same action as client side boottool.py set_default() method, but with a better name IMHO.

Note: both –set-default=<kernel> and –set-default-index=<index> on grubby returns no error when it doesn’t find the kernel or index. So this method will, until grubby gets fixed, always return success.

Parameters:index – entry index number to set as the default.
class autotest.client.tools.boottool.OptionParser(**kwargs)[source]

Bases: optparse.OptionParser

Command line option parser

Aims to maintain compatibility at the command line level with boottool

check_values(opts, args)[source]

Validate the option the user has supplied

option_parser_usage = '%prog [options]'
opts_get_action(opts)[source]

Gets the selected action from the parsed opts

opts_has_action(opts)[source]

Checks if (parsed) opts has a first class action

class autotest.client.tools.boottool.EfiVar(name, data, guid=None, attributes=None)[source]

Bases: object

Helper class to manipulate EFI firmware variables

This class has no notion of the EFI firmware variables interface, that is, where it should read from or write to in order to create or delete EFI variables.

On systems with kernel >= 2.6, that interface is a directory structure under /sys/firmware/efi/vars.

On systems with kernel <= 2.4, that interface is going to be a directory structure under /proc/efi/vars. But be advised: this has not been tested yet on kernels <= 2.4.

ATTR_BOOTSERVICE_ACCESS = 2
ATTR_NON_VOLATILE = 1
ATTR_RUNTIME_ACCESS = 4
DEFAULT_ATTRIBUTES = 7
FMT = '512H16B1L512H1L1I'
GUID_CONTENT = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
GUID_FMT = '16B'
get_data()[source]

Returns the variable data in a list ready for struct.pack()

get_name()[source]

Returns the variable name in a list ready for struct.pack()

get_packed()[source]

Returns the EFI variable raw data packed by struct.pack()

This data should be written to the appropriate interface to create an EFI variable

class autotest.client.tools.boottool.EfiToolSys[source]

Bases: object

Interfaces with /sys/firmware/efi/vars provided by the kernel

This interface is present on kernels >= 2.6 with CONFIG_EFI and CONFIG_EFI_VARS options set.

BASE_PATH = '/sys/firmware/efi/vars'
DEL_VAR = '/sys/firmware/efi/vars/del_var'
NEW_VAR = '/sys/firmware/efi/vars/new_var'
check_basic_structure()[source]

Checks the basic directory structure for the /sys/…/vars interface

create_variable(name, data, guid=None, attributes=None)[source]

Creates a new EFI variable

Parameters:
  • name (string) – the name of the variable that will be created
  • data (string) – user data that will populate the variable
  • guid (tuple) – content for the guid value that composes the full variable name
  • attributes – integer
  • attributes – bitwise AND of the EFI attributes this variable will have set
delete_variable(name, data, guid=None, attributes=None)[source]

Delets an existing EFI variable

Parameters:
  • name (string) – the name of the variable that will be deleted
  • data (string) – user data that will populate the variable
  • guid (tuple) – content for the guid value that composes the full variable name
  • attributes – integer
  • attributes – bitwise AND of the EFI attributes this variable will have set
class autotest.client.tools.boottool.EliloConf(path='/etc/elilo.conf')[source]

Bases: object

A simple parser for elilo configuration file

Has simple features to add and remove global options only, as this is all we need. grubby takes care of manipulating the boot entries themselves.

add_global_option(key, val=None)[source]

Adds a global option to the updated elilo configuration file

Parameters:
  • key (string) – option name
  • key – option value or None for options with no values
Returns:

None

get_updated_content()[source]

Returns the config file content with options to add and remove applied

keyval_to_line(keyval)[source]

Transforms a tuple into a text line suitable for the config file

Parameters:keyval (tuple) – a tuple containing key and value
Returns:a text line suitable for the config file
line_to_keyval(line)[source]

Transforms a text line from the configuration file into a tuple

Parameters:line (string) – line of text from the configuration file
Returns:a tuple with key and value
matches_global_option_to_add(line)[source]

Utility method to check if option is to be added

Parameters:line (string) – line of text from the configuration file
Returns:True or False
matches_global_option_to_remove(line)[source]

Utility method to check if option is to be removed

Parameters:line (string) – line of text from the configuration file
Returns:True or False
remove_global_option(key, val=None)[source]

Removes a global option to the updated elilo configuration file

Parameters:
  • key (string) – option name
  • key – option value or None for options with no values
Returns:

None

update()[source]

Writes the updated content to the configuration file

autotest.client.tools.boottool.find_executable(executable, favorite_path=None)[source]

Returns whether the system has a given executable

Parameters:executable (string) – the name of a file that can be read and executed
autotest.client.tools.boottool.parse_entry(entry_str, separator='=')[source]

Parse entry as returned by boottool.

Parameters:entry_str – one entry information as returned by boottool
Returns:dictionary of key -> value where key is the string before the first “:” in an entry line and value is the string after it

common Module

crash_handler Module

Simple crash handling application for autotest

copyright:Red Hat Inc 2009
author:Lucas Meneghel Rodrigues <lmr@redhat.com>
autotest.client.tools.crash_handler.gdb_report(path)[source]

Use GDB to produce a report with information about a given core.

Parameters:path – Path to core file.
autotest.client.tools.crash_handler.generate_random_string(length)[source]

Return a random string using alphanumeric characters.

@length: length of the string that will be generated.

autotest.client.tools.crash_handler.get_info_from_core(path)[source]

Reads a core file and extracts a dictionary with useful core information.

Right now, the only information extracted is the full executable name.

Parameters:path – Path to core file.
autotest.client.tools.crash_handler.get_parent_pid(pid)[source]

Returns the parent PID for a given PID, converted to an integer.

Parameters:pid – Process ID.
autotest.client.tools.crash_handler.get_results_dir_list(pid, core_dir_basename)[source]

Get all valid output directories for the core file and the report. It works by inspecting files created by each test on /tmp and verifying if the PID of the process that crashed is a child or grandchild of the autotest test process. If it can’t find any relationship (maybe a daemon that died during a test execution), it will write the core file to the debug dirs of all tests currently being executed. If there are no active autotest tests at a particular moment, it will return a list with [‘/tmp’].

Parameters:
  • pid – PID for the process that generated the core
  • core_dir_basename – Basename for the directory that will hold both the core dump and the crash report.
autotest.client.tools.crash_handler.write_cores(core_data, dir_list)[source]

Write core files to all directories, optionally providing reports.

Parameters:
  • core_data – Contents of the core file.
  • dir_list – List of directories the cores have to be written.
  • report – Whether reports are to be generated for those core files.
autotest.client.tools.crash_handler.write_to_file(filename, data, report=False)[source]

Write contents to a given file path specified. If not specified, the file will be created.

Parameters:
  • file_path – Path to a given file.
  • data – File contents.
  • report – Whether we’ll use GDB to get a backtrace report of the file.

process_metrics Module

Program that parses autotest metrics results and prints them to stdout, so that the jenkins measurement-plots plugin can parse them.

Authors:
Steve Conklin <sconklin@canonical.com> Brad Figg <brad.figg@canonical.com>

Copyright (C) 2012 Canonical Ltd.

This script is distributed under the terms and conditions of the GNU General Public License, Version 2 or later. See http://www.gnu.org/copyleft/gpl.html for details.

autotest.client.tools.process_metrics.main(path)[source]
autotest.client.tools.process_metrics.usage()[source]

regression Module

Program that parses standard format results, compute and check regression bug.

copyright:Red Hat 2011-2012
author:Amos Kong <akong@redhat.com>
class autotest.client.tools.regression.Sample(type, arg)[source]

Bases: object

Collect test results in same environment to a sample

getAvg(avg_update=None)[source]
getAvgPercent(avgs_dict)[source]
getSD()[source]
getSDRate(sds_dict)[source]
getTtestPvalue(fs_dict1, fs_dict2, paired=None)[source]

scipy lib is used to compute p-value of Ttest scipy: http://www.scipy.org/ t-test: http://en.wikipedia.org/wiki/Student’s_t-test

autotest.client.tools.regression.analyze(test, type, arg1, arg2, configfile)[source]

Compute averages/p-vales of two samples, print results nicely

autotest.client.tools.regression.display(lists, rates, allpvalues, f, ignore_col, sum='Augment Rate', prefix0=None, prefix1=None, prefix2=None, prefix3=None)[source]

Display lists data to standard format

param lists: row data lists param rates: augment rates lists param f: result output file param ignore_col: do not display some columns param sum: compare result summary param prefix0: output prefix in head lines param prefix1: output prefix in Avg/SD lines param prefix2: output prefix in Diff Avg/P-value lines param prefix3: output prefix in total Sign line

autotest.client.tools.regression.exec_sql(cmd, conf='../../global_config.ini')[source]
autotest.client.tools.regression.get_test_keyval(jobid, keyname, default='')[source]
autotest.client.tools.regression.is_int(n)[source]
autotest.client.tools.regression.tee(content, file)[source]

Write content to standard output and file

results2junit Module

Program that parses the autotest results and generates JUnit test results in XML format.

autotest.client.tools.results2junit.dbg(ostr)[source]
autotest.client.tools.results2junit.dump(obj)[source]
autotest.client.tools.results2junit.file_load(file_name)[source]

Load the indicated file into a string and return the string.

autotest.client.tools.results2junit.main(basedir, resfiles)[source]
autotest.client.tools.results2junit.parse_results(text)[source]

Parse text containing Autotest results.

Returns:A list of result 4-tuples.
autotest.client.tools.results2junit.text_clean(text)[source]

This always seems like such a hack, however, there are some characters that we can’t deal with properly so this function just removes them from the text passed in.

scan_results Module

Program that parses the autotest results and return a nicely printed final test result.

copyright:Red Hat 2008-2009
autotest.client.tools.scan_results.main(resfiles)[source]
autotest.client.tools.scan_results.parse_results(text)[source]

Parse text containing Autotest results.

Returns:A list of result 4-tuples.
autotest.client.tools.scan_results.print_result(result, name_width)[source]

Nicely print a single Autotest result.

Parameters:
  • result – a 4-tuple
  • name_width – test name maximum width