Extra step based on grepping trigbs_dumpHLTContentInBS.py output
and comparing the line count to expected value
Definition at line 17 of file TrigP1TestSteps.py.
◆ __init__()
def python.TrigP1TestSteps.TrigBSDumpGrepStep.__init__ |
( |
|
self, |
|
|
|
name = 'TrigBSDumpGrep' |
|
) |
| |
Definition at line 23 of file TrigP1TestSteps.py.
23 def __init__(self, name='TrigBSDumpGrep'):
24 super(TrigBSDumpGrepStep, self).
__init__(name)
25 self.executable =
'trigbs_dumpHLTContentInBS_run3.py'
26 self.file_name_base =
'output'
27 self.auto_report_result =
True
30 self.comparator =
lambda n: n > 0
◆ run()
def python.TrigP1TestSteps.TrigBSDumpGrepStep.run |
( |
|
self, |
|
|
|
dry_run = False |
|
) |
| |
Definition at line 32 of file TrigP1TestSteps.py.
32 def run(self, dry_run=False):
34 self.log.
info(
'Skipping %s in dry run', self.name)
36 return self.result,
'# (internal) {} -> skipped'.
format(self.name)
38 for ls_file
in os.listdir(
'.'):
39 if self.file_name_base
in ls_file:
42 self.log.
error(
'%s cannot find the BS output file', self.name)
44 if self.auto_report_result:
46 return self.result,
'# (internal) {} -> failed'.
format(self.name)
47 self.log.
debug(
'%s found BS file %s', self.name, file_name)
48 self.args +=
' ' + file_name
49 self.args +=
' | grep "{}" | wc -l'.
format(self.regex)
51 old_auto_report = self.auto_report_result
52 self.auto_report_result =
False
53 ret, cmd = super(TrigBSDumpGrepStep, self).
run(dry_run)
54 self.auto_report_result = old_auto_report
57 self.log.
error(
'%s failed', self.name)
58 if self.auto_report_result:
60 return self.result, cmd
62 if not os.path.isfile(self.get_log_file_name()):
63 self.log.
error(
'%s failed, the file %s is missing',
64 self.name, self.get_log_file_name())
66 if self.auto_report_result:
68 return self.result, cmd
71 with open(self.get_log_file_name())
as log_file:
72 num = eval(log_file.read())
73 if not self.comparator(num)
or num
is None:
74 self.log.
error(
'%s failed the comparison', self.name)
76 if self.auto_report_result:
78 return self.result, cmd
80 compare_str_list = inspect.getsource(self.comparator).
split(
':')
81 compare_str =
''.
join(compare_str_list[1:])
82 compare_str = compare_str.strip()
83 self.log.
info(
'Comparison %s for num=%s gives True', compare_str, num)
85 if self.auto_report_result:
87 return self.result, cmd
◆ auto_report_result
python.TrigP1TestSteps.TrigBSDumpGrepStep.auto_report_result |
◆ comparator
python.TrigP1TestSteps.TrigBSDumpGrepStep.comparator |
◆ executable
python.TrigP1TestSteps.TrigBSDumpGrepStep.executable |
◆ file_name_base
python.TrigP1TestSteps.TrigBSDumpGrepStep.file_name_base |
◆ regex
python.TrigP1TestSteps.TrigBSDumpGrepStep.regex |
◆ required
python.TrigP1TestSteps.TrigBSDumpGrepStep.required |
◆ result
python.TrigP1TestSteps.TrigBSDumpGrepStep.result |
The documentation for this class was generated from the following file: