##// END OF EJS Templates
Étiquette 3.2.0.24 ajoutée à la révision f3243196bdc5
Étiquette 3.2.0.24 ajoutée à la révision f3243196bdc5

File last commit:

r398:57611985e772 R3++
r406:72f973a48116 R3++
Show More
build_gcov_files.py
49 lines | 1.7 KiB | text/x-python | PythonLexer
/ libgcov / build_gcov_files.py
Added gcov support...
r387 #!/usr/bin/env python3
__author__ = "Alexis Jeandet"
__copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
__credits__ = []
__license__ = "GPLv2"
__version__ = "1.0.0"
__maintainer__ = "Alexis Jeandet"
__email__ = "alexis.jeandet@member.fsf.org"
__status__ = "Development"
import time
import sys
import os
import serial
import argparse
from datetime import datetime
Added ability to relocate gcda and gcno files and added gcovr wrapper...
r398 import pathlib
from shutil import copyfile
Added gcov support...
r387
parser = argparse.ArgumentParser()
Added ability to relocate gcda and gcno files and added gcovr wrapper...
r398 parser.add_argument("-r", "--remove-prefix", help="Will remove given prefix path", default="")
parser.add_argument("-o", "--output-folder", help="Will prepend given path to gcda files", default="")
parser.add_argument("file", help="Gcov output file generated by record_lfr_console.py")
Added gcov support...
r387 args = parser.parse_args()
def main():
Added ability to relocate gcda and gcno files and added gcovr wrapper...
r398 with open(args.file, 'r') as gcov:
Increased libgcov gcda buffer to avoid file splitting
r388 files = []
Added gcov support...
r387 for line in gcov.readlines():
Added ability to relocate gcda and gcno files and added gcovr wrapper...
r398 head, dest_file,data = line.split(',')
Increased libgcov gcda buffer to avoid file splitting
r388 if dest_file not in files:
files.append(dest_file)
if head == '_GCOV_':
Added ability to relocate gcda and gcno files and added gcovr wrapper...
r398 gcno_file = dest_file.replace(".gcda",".gcno")
dest_file = dest_file.replace(args.remove_prefix, args.output_folder)
pathlib.Path(os.path.dirname(dest_file)).mkdir(parents=True, exist_ok=True)
copyfile(gcno_file, gcno_file.replace(args.remove_prefix, args.output_folder))
Increased libgcov gcda buffer to avoid file splitting
r388 print(f"Writing {dest_file}\n")
with open(dest_file,'wb') as gcda_file:
gcda_file.write(bytes([int(''.join(value),16) for value in zip(data[::2],data[1::2]) ]))
else:
raise
Added gcov support...
r387
if __name__ == "__main__":
main()