CYCAMORE
config/print_regs.py
Go to the documentation of this file.
1 from __future__ import print_function
2 
3 import os
4 
5 reg_tst_name = """RegressionTests"""
6 end_tst_token = """Testing:"""
7 
8 def main():
9  build_tst_dir = os.path.join(os.getcwd(), "Testing", "Temporary")
10 
11  fname = os.path.join(build_tst_dir, "LastTestsFailed.log")
12 
13  print_regs = False
14  if os.path.exists(fname):
15  with open(fname) as f:
16  lines = f.readlines()
17 
18  for line in lines:
19  if reg_tst_name in line:
20  print_regs = True
21 
22  fname = os.path.join(build_tst_dir, "LastTest.log")
23  with open(fname) as f:
24  lines = f.readlines()
25 
26  if print_regs:
27  in_regs = False
28  for line in lines:
29  # entering regression test region
30  if reg_tst_name in line:
31  in_regs = True
32  # leaving regression test region
33  if in_regs and end_tst_token in line:
34  in_regs = False
35  if in_regs:
36  print(line.strip())
37 
38 if __name__ == "__main__":
39  main()