| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | List of all members
GaudiTesting.QMTTest.QMTTest Class Reference
Inheritance diagram for GaudiTesting.QMTTest.QMTTest:
[legend]
Collaboration diagram for GaudiTesting.QMTTest.QMTTest:
[legend]

## Public Member Functions
def | __init__ (self, path=None)
def | XMLParser (self, path)
def | ValidateOutput (self, stdout, stderr, result)
Public Member Functions inherited from GaudiTesting.BaseTest.BaseTest
def | __init__ (self)
def | run (self)
def | findReferenceBlock (self, reference=None, stdout=None, result=None, causes=None, signature_offset=0, signature=None, id=None)
def | countErrorLines (self, expected={ 'ERROR':0, 'FATAL':0 }, stdout=None, result=None, causes=None)
def | CheckTTreesSummaries (self, stdout=None, result=None, causes=None, trees_dict=None, ignore=r"Basket|.*size|Compression")
def | CheckHistosSummaries (self, stdout=None, result=None, causes=None, dict=None, ignore=None)
def | validateWithReference (self, stdout=None, stderr=None, result=None, causes=None, preproc=None)

## Public Attributes
| validator
| name
| callable
| extra_args
| args_order
Public Attributes inherited from GaudiTesting.BaseTest.BaseTest
| program
| args
| reference
| error_reference
| options
| stderr
| timeout
| exit_code
| environment
| unsupported_platforms
| signal
| workdir
| use_temp_dir
| status
| name
| causes
| result
| returnedCode
| out
| err
| proc
| stack_trace
| basedir

## Detailed Description

Definition at line 8 of file QMTTest.py.

## Constructor & Destructor Documentation

## ◆ __init__()

def GaudiTesting.QMTTest.QMTTest.__init__ | ( |  | self,
|  |  | path = `None`
| ) |  |

Definition at line 9 of file QMTTest.py.

9 def __init__(self, path=None):
10 BaseTest.__init__(self)
11 self.validator = ''
12 if path:
13 self.XMLParser(path)
14

## Member Function Documentation

## ◆ ValidateOutput()

def GaudiTesting.QMTTest.QMTTest.ValidateOutput | ( |  | self,
|  |  | stdout,
|  |  | stderr,
|  |  | result
| ) |  |

Reimplemented from GaudiTesting.BaseTest.BaseTest.

Definition at line 50 of file QMTTest.py.

50 def ValidateOutput(self, stdout, stderr, result):
51 if self.validator:
52
53 class CallWrapper(object):
54 """
55 Small wrapper class to dynamically bind some default arguments
56 to a callable.
57 """
58
59 def __init__(self, callable, extra_args={}):
60 self.callable = callable
61 self.extra_args = extra_args
62 # get the list of names of positional arguments
63 from inspect import getargspec
64 self.args_order = getargspec(callable)[0]
65 # Remove "self" from the list of positional arguments
66 # since it is added automatically
67 if self.args_order[0] == "self":
68 del self.args_order[0]
69
70 def __call__(self, *args, **kwargs):
71 # Check which positional arguments are used
72 positional = self.args_order[:len(args)]
73
74 kwargs = dict(kwargs) # copy the arguments dictionary
75 for a in self.extra_args:
76 # use "extra_args" for the arguments not specified as
77 # positional or keyword
78 if a not in positional and a not in kwargs:
79 kwargs[a] = self.extra_args[a]
80 return self.callable(*args, **kwargs)
81
82 # local names to be exposed in the script
83 stdout_ref = self._expandReferenceFileName(self.reference)
84 stderr_ref = self._expandReferenceFileName(self.error_reference)
85 exported_symbols = {
86 "self":
87 self,
88 "stdout":
89 stdout,
90 "stderr":
91 stderr,
92 "result":
93 result,
94 "causes":
95 self.causes,
96 "reference":
97 stdout_ref,
98 "error_reference":
99 stderr_ref,
100 "findReferenceBlock":
101 CallWrapper(self.findReferenceBlock, {
102 "stdout": stdout,
103 "result": result,
104 "causes": self.causes
105 }),
106 "validateWithReference":
107 CallWrapper(
108 self.validateWithReference, {
109 "stdout": stdout,
110 "stderr": stderr,
111 "result": result,
112 "causes": self.causes
113 }),
114 "countErrorLines":
115 CallWrapper(self.countErrorLines, {
116 "stdout": stdout,
117 "result": result,
118 "causes": self.causes
119 }),
120 "checkTTreesSummaries":
121 CallWrapper(self.CheckTTreesSummaries, {
122 "stdout": stdout,
123 "result": result,
124 "causes": self.causes
125 }),
126 "checkHistosSummaries":
127 CallWrapper(self.CheckHistosSummaries, {
128 "stdout": stdout,
129 "result": result,
130 "causes": self.causes
131 })
132 }
133 # print self.validator
134 exec (self.validator, globals(), exported_symbols)
135 return result, self.causes
136 else:
137 return super(QMTTest, self).ValidateOutput(stdout, stderr, result)

## ◆ XMLParser()

def GaudiTesting.QMTTest.QMTTest.XMLParser | ( |  | self,
|  |  | path
| ) |  |

    Parse a QMTest XML test description (.qmt file) to initialize the test
    instance.

Definition at line 15 of file QMTTest.py.

15 def XMLParser(self, path):
16 '''
17 Parse a QMTest XML test description (.qmt file) to initialize the test
18 instance.
19 '''
20 log = logging.getLogger('QMTest.XMLParser')
21 import xml.etree.ElementTree as ET
22 log.debug('parsing %s', path)
23
24 self.name = '.'.join(
25 os.path.relpath(path, self.basedir).replace('.qmt', '').replace(
26 '.qms', '').split(os.sep))
27
28 tree = ET.parse(path)
29 for child in tree.getroot():
30 name = child.attrib['name']
31 if hasattr(self, name):
32 log.debug('setting %s', name)
33 value = child[0]
34 if name in ('args', 'unsupported_platforms'):
35 setattr(self, name,
36 [el.text for el in value.findall('text')])
37 elif name == 'environment':
38 setattr(
39 self, name,
40 dict(
41 el.text.split('=', 1)
42 for el in value.findall('text')))
43 else:
44 data = value.text
45 if data is not None:
46 if value.tag == 'integer':
47 data = int(data)
48 setattr(self, name, data)
49

## Member Data Documentation

## ◆ args_order

GaudiTesting.QMTTest.QMTTest.args_order

Definition at line 64 of file QMTTest.py.

## ◆ callable

GaudiTesting.QMTTest.QMTTest.callable

Definition at line 60 of file QMTTest.py.

## ◆ extra_args

GaudiTesting.QMTTest.QMTTest.extra_args

Definition at line 61 of file QMTTest.py.

## ◆ name

GaudiTesting.QMTTest.QMTTest.name

Definition at line 24 of file QMTTest.py.

## ◆ validator

GaudiTesting.QMTTest.QMTTest.validator

Definition at line 11 of file QMTTest.py.

The documentation for this class was generated from the following file:

- GaudiPolicy/python/GaudiTesting/QMTTest.py