◆ _new_backslashreplace_errors()
| def GaudiTesting.BaseTest._new_backslashreplace_errors |
( |
|
exc | ) |
|
|
private |
Definition at line 32 of file BaseTest.py.
33 if isinstance(exc, UnicodeDecodeError):
34 code =
hex(ord(exc.object[exc.start]))
35 return (
"\\" + code[1:], exc.start + 1)
37 return backslashreplace_errors(exc)
◆ _parseTTreeSummary()
| def GaudiTesting.BaseTest._parseTTreeSummary |
( |
|
lines, |
|
|
|
pos |
|
) |
| |
|
private |
Parse the TTree summary table in lines, starting from pos.
Returns a tuple with the dictionary with the digested informations and the
position of the first line after the summary.
Definition at line 1342 of file BaseTest.py.
1344 Parse the TTree summary table in lines, starting from pos.
1345 Returns a tuple with the dictionary with the digested informations and the
1346 position of the first line after the summary.
1353 return [f.strip()
for f
in l.strip(
"*\n").split(
":", 2)]
1358 cols = splitcols(ll[0])
1362 r[
"Name"], r[
"Title"] = cols[1:]
1367 r[
"Title"] = ll[1].strip(
"*\n").split(
"|")[1].strip()
1371 cols = splitcols(ll[1 + delta_i])
1372 r[
"Entries"] = int(cols[1])
1374 sizes = cols[2].split()
1375 r[
"Total size"] = int(sizes[2])
1376 if sizes[-1] ==
"memory":
1379 r[
"File size"] = int(sizes[-1])
1381 cols = splitcols(ll[2 + delta_i])
1382 sizes = cols[2].split()
1383 if cols[0] ==
"Baskets":
1384 r[
"Baskets"] = int(cols[1])
1385 r[
"Basket size"] = int(sizes[2])
1386 r[
"Compression"] = float(sizes[-1])
1390 def nextblock(lines, i):
1392 dots = re.compile(
r"^\.+$")
1393 stars = re.compile(
r"^\*+$")
1397 and not dots.match(lines[i + delta_i][1:-1])
1398 and not stars.match(lines[i + delta_i])
1403 if i < (count - 3)
and lines[i].startswith(
"*Tree"):
1404 i_nextblock = nextblock(lines, i)
1405 result = parseblock(lines[i:i_nextblock])
1406 result[
"Branches"] = {}
1408 while i < (count - 3)
and lines[i].startswith(
"*Br"):
1409 if i < (count - 2)
and lines[i].startswith(
"*Branch "):
1413 i_nextblock = nextblock(lines, i)
1414 if i_nextblock >= count:
1416 branch = parseblock(lines[i:i_nextblock])
1417 result[
"Branches"][branch[
"Name"]] = branch
◆ cmpTreesDicts()
| def GaudiTesting.BaseTest.cmpTreesDicts |
( |
|
reference, |
|
|
|
to_check, |
|
|
|
ignore = None |
|
) |
| |
Check that all the keys in reference are in to_check too, with the same value.
If the value is a dict, the function is called recursively. to_check can
contain more keys than reference, that will not be tested.
The function returns at the first difference found.
Definition at line 1294 of file BaseTest.py.
1296 Check that all the keys in reference are in to_check too, with the same value.
1297 If the value is a dict, the function is called recursively. to_check can
1298 contain more keys than reference, that will not be tested.
1299 The function returns at the first difference found.
1304 ignore_re = re.compile(ignore)
1305 keys = [key
for key
in reference
if not ignore_re.match(key)]
1307 keys = reference.keys()
1311 if isinstance(reference[k], dict)
and isinstance(to_check[k], dict):
1314 failed = fail_keys =
cmpTreesDicts(reference[k], to_check[k], ignore)
1317 failed = to_check[k] != reference[k]
1322 fail_keys.insert(0, k)
◆ dumpProcs()
| def GaudiTesting.BaseTest.dumpProcs |
( |
|
name | ) |
|
helper to debug GAUDI-1084, dump the list of processes
Definition at line 67 of file BaseTest.py.
68 """helper to debug GAUDI-1084, dump the list of processes"""
69 from getpass
import getuser
71 if "WORKSPACE" in os.environ:
72 p = Popen([
"ps",
"-fH",
"-U", getuser()], stdout=PIPE)
73 with open(os.path.join(os.environ[
"WORKSPACE"], name),
"wb")
as f:
74 f.write(p.communicate()[0])
◆ findHistosSummaries()
| def GaudiTesting.BaseTest.findHistosSummaries |
( |
|
stdout | ) |
|
Scan stdout to find ROOT TTree summaries and digest them.
Definition at line 1491 of file BaseTest.py.
1493 Scan stdout to find ROOT TTree summaries and digest them.
1495 outlines = stdout.splitlines()
1496 nlines = len(outlines) - 1
1504 match = h_count_re.search(outlines[pos])
1505 while pos < nlines
and not match:
1507 match = h_count_re.search(outlines[pos])
1510 summaries.update(summ)
◆ findTTreeSummaries()
| def GaudiTesting.BaseTest.findTTreeSummaries |
( |
|
stdout | ) |
|
Scan stdout to find ROOT TTree summaries and digest them.
Definition at line 1272 of file BaseTest.py.
1274 Scan stdout to find ROOT TTree summaries and digest them.
1276 stars = re.compile(
r"^\*+$")
1277 outlines = stdout.splitlines()
1278 nlines = len(outlines)
1284 while i < nlines
and not stars.match(outlines[i]):
1289 trees[tree[
"Name"]] = tree
◆ getCmpFailingValues()
| def GaudiTesting.BaseTest.getCmpFailingValues |
( |
|
reference, |
|
|
|
to_check, |
|
|
|
fail_path |
|
) |
| |
Definition at line 1327 of file BaseTest.py.
1333 if c
is None or r
is None:
1335 return (fail_path, r, c)
◆ GetPlatform()
| def GaudiTesting.BaseTest.GetPlatform |
( |
|
self | ) |
|
Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.
Definition at line 1514 of file BaseTest.py.
1516 Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.
1520 if "BINARY_TAG" in os.environ:
1521 arch = os.environ[
"BINARY_TAG"]
1522 elif "CMTCONFIG" in os.environ:
1523 arch = os.environ[
"CMTCONFIG"]
1524 elif "SCRAM_ARCH" in os.environ:
1525 arch = os.environ[
"SCRAM_ARCH"]
1526 elif os.environ.get(
"ENV_CMAKE_BUILD_TYPE",
"")
in (
1532 elif os.environ.get(
"ENV_CMAKE_BUILD_TYPE",
"")
in (
◆ isWinPlatform()
| def GaudiTesting.BaseTest.isWinPlatform |
( |
|
self | ) |
|
Return True if the current platform is Windows.
This function was needed because of the change in the CMTCONFIG format,
from win32_vc71_dbg to i686-winxp-vc9-dbg.
Definition at line 1542 of file BaseTest.py.
1544 Return True if the current platform is Windows.
1546 This function was needed because of the change in the CMTCONFIG format,
1547 from win32_vc71_dbg to i686-winxp-vc9-dbg.
1550 return "winxp" in platform
or platform.startswith(
"win")
◆ kill_tree()
| def GaudiTesting.BaseTest.kill_tree |
( |
|
ppid, |
|
|
|
sig |
|
) |
| |
Send a signal to a process and all its child processes (starting from the
leaves).
Definition at line 77 of file BaseTest.py.
79 Send a signal to a process and all its child processes (starting from the
82 log = logging.getLogger(
"kill_tree")
83 ps_cmd = [
"ps",
"--no-headers",
"-o",
"pid",
"--ppid", str(ppid)]
86 get_children = Popen(ps_cmd, stdout=PIPE, stderr=PIPE, env={})
87 children =
map(int, get_children.communicate()[0].split())
88 for child
in children:
91 log.debug(
"killing process %d", ppid)
93 except OSError
as err:
96 log.debug(
"no such process %d", ppid)
◆ parseHistosSummary()
| def GaudiTesting.BaseTest.parseHistosSummary |
( |
|
lines, |
|
|
|
pos |
|
) |
| |
Extract the histograms infos from the lines starting at pos.
Returns the position of the first line after the summary block.
Definition at line 1423 of file BaseTest.py.
1425 Extract the histograms infos from the lines starting at pos.
1426 Returns the position of the first line after the summary block.
1429 h_table_head = re.compile(
1430 r'SUCCESS\s+(1D|2D|3D|1D profile|2D profile) histograms in directory\s+"(\w*)"'
1432 h_short_summ = re.compile(
r"ID=([^\"]+)\s+\"([^\"]+)\"\s+(.*)")
1437 m = h_count_re.search(lines[pos])
1438 name = m.group(1).strip()
1439 total = int(m.group(2))
1441 for k, v
in [x.split(
"=")
for x
in m.group(3).split()]:
1444 header[
"Total"] = total
1448 m = h_table_head.search(lines[pos])
1451 t = t.replace(
" profile",
"Prof")
1458 if l.startswith(
" | ID"):
1460 titles = [x.strip()
for x
in l.split(
"|")][1:]
1462 while pos < nlines
and lines[pos].startswith(
" |"):
1464 values = [x.strip()
for x
in l.split(
"|")][1:]
1466 for i
in range(len(titles)):
1467 hcont[titles[i]] = values[i]
1468 cont[hcont[
"ID"]] = hcont
1470 elif l.startswith(
" ID="):
1471 while pos < nlines
and lines[pos].startswith(
" ID="):
1473 x.strip()
for x
in h_short_summ.search(lines[pos]).groups()
1475 cont[values[0]] = values
1478 raise RuntimeError(
"Cannot understand line %d: '%s'" % (pos, l))
1482 summ[d][
"header"] = header
1487 summ[name] = {
"header": header}
◆ RationalizePath()
| def GaudiTesting.BaseTest.RationalizePath |
( |
|
p | ) |
|
Function used to normalize the used path
Definition at line 781 of file BaseTest.py.
783 Function used to normalize the used path
785 newPath = os.path.normpath(os.path.expandvars(p))
786 if os.path.exists(newPath):
787 p = os.path.realpath(newPath)
◆ ROOT6WorkAroundEnabled()
| def GaudiTesting.BaseTest.ROOT6WorkAroundEnabled |
( |
|
id = None | ) |
|
◆ sanitize_for_xml()
| def GaudiTesting.BaseTest.sanitize_for_xml |
( |
|
data | ) |
|
Take a string with invalid ASCII/UTF characters and quote them so that the
string can be used in an XML text.
>>> sanitize_for_xml('this is \x1b')
'this is [NON-XML-CHAR-0x1B]'
Definition at line 50 of file BaseTest.py.
52 Take a string with invalid ASCII/UTF characters and quote them so that the
53 string can be used in an XML text.
55 >>> sanitize_for_xml('this is \x1b')
56 'this is [NON-XML-CHAR-0x1B]'
58 bad_chars = re.compile(
"[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]")
62 return "".join(
"[NON-XML-CHAR-0x%2X]" % ord(c)
for c
in match.group())
64 return bad_chars.sub(quote, data)
◆ which()
| def GaudiTesting.BaseTest.which |
( |
|
executable | ) |
|
Locates an executable in the executables path ($PATH) and returns the full
path to it. An application is looked for with or without the '.exe' suffix.
If the executable cannot be found, None is returned
Definition at line 791 of file BaseTest.py.
791 def which(executable):
793 Locates an executable in the executables path ($PATH) and returns the full
794 path to it. An application is looked for with or without the '.exe' suffix.
795 If the executable cannot be found, None is returned
797 if os.path.isabs(executable):
798 if not os.path.isfile(executable):
799 if executable.endswith(
".exe"):
800 if os.path.isfile(executable[:-4]):
801 return executable[:-4]
803 executable = os.path.split(executable)[1]
806 for d
in os.environ.get(
"PATH").split(os.pathsep):
807 fullpath = os.path.join(d, executable)
808 if os.path.isfile(fullpath):
810 elif executable.endswith(
".exe")
and os.path.isfile(fullpath[:-4]):
◆ __processLine__
| GaudiTesting.BaseTest.__processLine__ |
|
private |
◆ h_count_re
| GaudiTesting.BaseTest.h_count_re |
◆ lineSkipper
| GaudiTesting.BaseTest.lineSkipper |
◆ maskPointers
| GaudiTesting.BaseTest.maskPointers |
◆ normalizeDate
| GaudiTesting.BaseTest.normalizeDate |
◆ normalizeEOL
| GaudiTesting.BaseTest.normalizeEOL |
◆ normalizeExamples
| GaudiTesting.BaseTest.normalizeExamples |
◆ normalizeTestSuite
| GaudiTesting.BaseTest.normalizeTestSuite |
◆ OUTPUT_LIMIT
| GaudiTesting.BaseTest.OUTPUT_LIMIT |
◆ regexps
| list GaudiTesting.BaseTest.regexps |
◆ SKIP_RETURN_CODE
| GaudiTesting.BaseTest.SKIP_RETURN_CODE |
◆ skipEmptyLines
| GaudiTesting.BaseTest.skipEmptyLines |
MsgStream & hex(MsgStream &log)
def _parseTTreeSummary(lines, pos)
def sanitize_for_xml(data)
def getCmpFailingValues(reference, to_check, fail_path)
def _new_backslashreplace_errors(exc)
struct GAUDI_API map
Parametrisation class for map-like implementation.
def parseHistosSummary(lines, pos)
def cmpTreesDicts(reference, to_check, ignore=None)
def findHistosSummaries(stdout)
def findTTreeSummaries(stdout)
def ROOT6WorkAroundEnabled(id=None)
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.