Skip to content
Snippets Groups Projects
Commit 8db03da6 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by Andre Maroneze
Browse files

[Analysis Scripts] add dump to CSV

parent d9528b9d
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ import os ...@@ -30,6 +30,7 @@ import os
import signal import signal
import argparse import argparse
import uuid import uuid
import csv
from pathlib import Path from pathlib import Path
import frama_c_results import frama_c_results
...@@ -145,6 +146,22 @@ def poll_results(targets, benchmark_tag): ...@@ -145,6 +146,22 @@ def poll_results(targets, benchmark_tag):
return results return results
def dump_results_csv(results, path):
with open(path, 'w', newline='') as file:
fieldnames = [
"target_name", "timestamp",
"sem_reach_fun", "syn_reach_fun", "total_fun",
"sem_reach_stmt", "syn_reach_stmt",
"alarms", "warnings", "coverage",
"user_time", "memory"]
writer = csv.DictWriter(
file,
fieldnames=fieldnames,
extrasaction='ignore')
writer.writeheader()
writer.writerows(results)
def run_analyses(display, database, framac, benchmark_tag): def run_analyses(display, database, framac, benchmark_tag):
results = [] results = []
targets = list_targets(".") targets = list_targets(".")
...@@ -201,7 +218,9 @@ parser.add_argument("-c", "--comment", ...@@ -201,7 +218,9 @@ parser.add_argument("-c", "--comment",
parser.add_argument("-p", "--repository-path", parser.add_argument("-p", "--repository-path",
action="store", metavar="PATH", action="store", metavar="PATH",
help="don't clone Frama-C, use this git repository instead") help="don't clone Frama-C, use this git repository instead")
parser.add_argument("-o", "--output-csv",
action="store", metavar="PATH", type=Path,
help="output the results to the given CSV file")
errors = b"" errors = b""
...@@ -241,6 +260,9 @@ try: ...@@ -241,6 +260,9 @@ try:
print("Results:\n") print("Results:\n")
results_display.PlainDisplay().print_table(results) results_display.PlainDisplay().print_table(results)
if args.output_csv is not None:
dump_results_csv(results, args.output_csv)
except OperationException as e: except OperationException as e:
errors += bytearray(str(e), "ascii") errors += bytearray(str(e), "ascii")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment