##// END OF EJS Templates
Added ability to relocate gcda and gcno files and added gcovr wrapper...
jeandet -
r398:57611985e772 R3++ draft
parent child
Show More
@@ -0,0 +1,38
1 #!/usr/bin/env python3
2
3 __author__ = "Alexis Jeandet"
4 __copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
5 __credits__ = []
6 __license__ = "GPLv2"
7 __version__ = "1.0.0"
8 __maintainer__ = "Alexis Jeandet"
9 __email__ = "alexis.jeandet@member.fsf.org"
10 __status__ = "Development"
11
12 import argparse
13 import subprocess
14
15
16
17 parser = argparse.ArgumentParser()
18 parser.add_argument("-s", "--sources", help="Source path path", required=True)
19 parser.add_argument("-o", "--output-folder", help="Will generate html report into this folder", required=True)
20 parser.add_argument("-g", "--gcov-exe", help="Gcov executable", required=True)
21 parser.add_argument("path", help="Path where are located gcda and gcno files")
22
23 args = parser.parse_args()
24
25 def main():
26 p = subprocess.Popen(["gcovr",
27 "--gcov-executable=" + args.gcov_exe,
28 "--object-directory=" + args.path,
29 "-r=" + args.sources,
30 "--html",
31 "--html-details",
32 "-o=" + args.output_folder + "/gcov.html"
33 ],
34 stdout=subprocess.PIPE)
35
36
37 if __name__ == "__main__":
38 main()
@@ -1,41 +1,49
1 1 #!/usr/bin/env python3
2 2
3 3 __author__ = "Alexis Jeandet"
4 4 __copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
5 5 __credits__ = []
6 6 __license__ = "GPLv2"
7 7 __version__ = "1.0.0"
8 8 __maintainer__ = "Alexis Jeandet"
9 9 __email__ = "alexis.jeandet@member.fsf.org"
10 10 __status__ = "Development"
11 11
12 12 import time
13 13 import sys
14 14 import os
15 15 import serial
16 16 import argparse
17 17 from datetime import datetime
18 import pathlib
19 from shutil import copyfile
20
18 21
19 22 parser = argparse.ArgumentParser()
20 parser.add_argument("-f", "--gcov-file", help="Gcov output file generated by record_lfr_console.py")
23 parser.add_argument("-r", "--remove-prefix", help="Will remove given prefix path", default="")
24 parser.add_argument("-o", "--output-folder", help="Will prepend given path to gcda files", default="")
25 parser.add_argument("file", help="Gcov output file generated by record_lfr_console.py")
21 26 args = parser.parse_args()
22 27
23 28
24
25 29 def main():
26 with open(args.gcov_file,'r') as gcov:
30 with open(args.file, 'r') as gcov:
27 31 files = []
28 32 for line in gcov.readlines():
29 33 head,dest_file,data = line.split(',')
30 34 if dest_file not in files:
31 35 files.append(dest_file)
32 36 if head == '_GCOV_':
37 gcno_file = dest_file.replace(".gcda",".gcno")
38 dest_file = dest_file.replace(args.remove_prefix, args.output_folder)
39 pathlib.Path(os.path.dirname(dest_file)).mkdir(parents=True, exist_ok=True)
40 copyfile(gcno_file, gcno_file.replace(args.remove_prefix, args.output_folder))
33 41 print(f"Writing {dest_file}\n")
34 42 with open(dest_file,'wb') as gcda_file:
35 43 gcda_file.write(bytes([int(''.join(value),16) for value in zip(data[::2],data[1::2]) ]))
36 44 else:
37 45 raise
38 46
39 47
40 48 if __name__ == "__main__":
41 49 main()
1 NO CONTENT: modified file chmod 100644 => 100755
General Comments 0
You need to be logged in to leave comments. Login now