bcoconni / ValgrindCI

A Python package that provides tools to integrate valgrind into your CI workflow
GNU General Public License v3.0
19 stars 8 forks source link

multiple xml reports #3

Open hocai opened 2 years ago

hocai commented 2 years ago

Can ValgrindCI handle multiple xml reports now? If we have many valgrind.xml reports in the folder "/output/", could we use the command of "valgrind-ci /output/*.valgrind.xml "? Thank you very much!

bcoconni commented 2 years ago

Hi @hocai,

Unfortunately not at the moment: valgrind-ci cannot handle multiple input in one row: https://github.com/bcoconni/ValgrindCI/blob/f825a326cc758fcd6b4af59c65cb3cdd55919f54/ValgrindCI/__init__.py#L53-L55 However it would be quite easy to iterate over the files with the glob module:

import glob
files = glob.glob(args.xml_file)
for fname in files:
    data = ValgrindData()
    data.parse(fname)

Keep in mind that all the files would be parsed with the same options and that if HTML reports are queried, they will be all overwritten by the HTML report of the last file.

hocai commented 2 years ago

Thank you for your reply!!!

hocai commented 2 years ago

Hi, if HTML reports are queried about all of xml files, could we merge these html reports to one? If we can only get the last html report, we lost others. Thanks!

bcoconni commented 2 years ago

Not sure about the feasibility of merging all HTML into one but you could certainly overload the class HTMLRenderer so that its method _unique_html_filename would pick a new name if it finds that the default name is already chosen.

ppizarror commented 1 year ago

This can easily be implemented using bash commands, for example:

for x in /output/*.valgrind.xml; do
    [ -f "$x" ] || continue
    valgrind-ci "$x" --summary
done

I suggest adding this to README, as today I faced the same problem. Thanks @bcoconni for your library, very useful! 🥰