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

File last commit:

r398:57611985e772 R3++
r406:72f973a48116 R3++
Show More
49 lines | 1.7 KiB | text/x-python | PythonLexer
#!/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
import pathlib
from shutil import copyfile
parser = argparse.ArgumentParser()
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")
args = parser.parse_args()
def main():
with open(args.file, 'r') as gcov:
files = []
for line in gcov.readlines():
head, dest_file,data = line.split(',')
if dest_file not in files:
if head == '_GCOV_':
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))
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]) ]))
if __name__ == "__main__":