HowTo: Using gcov (the GNU coverage tool) with LMDZ : Différence entre versions

De LMDZPedia
Aller à : navigation, rechercher
(Page créée avec « == HowTo: Using the GNU coverage tool gcov with LMDZ == If you want a summary of the lines (and branches) in your code that are actually executed, you can use the GNU h... »)
 
(HowTo: Using the GNU coverage tool gcov with LMDZ)
Ligne 1 : Ligne 1 :
== HowTo: Using the GNU coverage tool gcov with LMDZ ==
+
 
  
 
If you want a summary of the lines (and branches) in your code that are actually executed, you can use the GNU [[https://gcc.gnu.org/onlinedocs/gcc/Gcov.html coverage tool]]. This entails the following three steps:
 
If you want a summary of the lines (and branches) in your code that are actually executed, you can use the GNU [[https://gcc.gnu.org/onlinedocs/gcc/Gcov.html coverage tool]]. This entails the following three steps:

Version du 28 avril 2022 à 17:41


If you want a summary of the lines (and branches) in your code that are actually executed, you can use the GNU [coverage tool]. This entails the following three steps:

  1. compiling your code with the right options
  2. running the code to output the statistics that gcov will analyze
  3. running gcov on the data file created in the previous step

Running gcov on LMDZ

We will be using [gcovr] a utility using gcov and providing different types os outputs

Compiling LMDZ

You will need to add the following flags to your compilation flags in the arch.fcm.file:

 %BASE_FFLAGS          -cpp -ffree-line-length-0 -fdefault-real-8 -DNC_DOUBLE -pg --coverage -fprofile-arcs -ftest-coverage -fprofile-abs-path

Running LMDZ

You just run gcm.e as you usually do. This will create a bunch of gcda and gcno files that are used by gcov in the following step

Running gcovr

You then launch the gcovr command as

gcovr -r . -v --html-details gcm_details libo/local_32x32x39_phylmd_seq.e/.config/tmp/
                                         ^
                                         this is where the gcda and gcno files are saved by the compiler               

to create html files