diff mbox series

Fix the reporting of leaf change statistics.

Message ID 20200213004424.144689-1-gprocida@google.com
State Superseded
Headers show
Series Fix the reporting of leaf change statistics. | expand

Commit Message

Matthias Maennich via libabigail Jan. 1, 2020, midnight UTC
* src/abg-comparison.cc
	(apply_filters_and_compute_diff_stats):	Increment the correct
        counter for leaf variable changes.
	* tests/data/Makefile.am: Add test case files.
	* tests/data/test-abidiff-exit/test-leaf0-*: New test case.
	* tests/test-abidiff-exit.cc: Run new test case.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-comparison.cc                            |   4 ++--
 tests/data/Makefile.am                           |   3 +++
 .../data/test-abidiff-exit/test-leaf0-report.txt |  13 +++++++++++++
 tests/data/test-abidiff-exit/test-leaf0-v0.o     | Bin 0 -> 2784 bytes
 tests/data/test-abidiff-exit/test-leaf0-v1.o     | Bin 0 -> 2824 bytes
 tests/test-abidiff-exit.cc                       |   9 +++++++++
 6 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 tests/data/test-abidiff-exit/test-leaf0-report.txt
 create mode 100644 tests/data/test-abidiff-exit/test-leaf0-v0.o
 create mode 100644 tests/data/test-abidiff-exit/test-leaf0-v1.o
diff mbox series

Patch

diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc
index af4cd5e7..61aea47f 100644
--- a/src/abg-comparison.cc
+++ b/src/abg-comparison.cc
@@ -9767,8 +9767,8 @@  corpus_diff::priv::apply_filters_and_compute_diff_stats(diff_stats& stat)
 	      (stat.num_leaf_var_changes_filtered_out() + 1);
 	}
       if ((*i)->has_local_changes())
-	stat.num_leaf_func_changes
-	  (stat.num_leaf_func_changes() + 1);
+	stat.num_leaf_var_changes
+	  (stat.num_leaf_var_changes() + 1);
     }
 
   stat.num_func_syms_added(added_unrefed_fn_syms_.size());
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 1f574d2e..2a928ef2 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -107,6 +107,9 @@  test-abidiff-exit/test-loc-v0.bi \
 test-abidiff-exit/test-loc-v1.bi \
 test-abidiff-exit/test-loc-with-locs-report.txt \
 test-abidiff-exit/test-loc-without-locs-report.txt \
+test-abidiff-exit/test-leaf0-v0.o \
+test-abidiff-exit/test-leaf0-v1.o \
+test-abidiff-exit/test-leaf0.report.txt \
 \
 test-diff-dwarf/test0-v0.cc		\
 test-diff-dwarf/test0-v0.o			\
diff --git a/tests/data/test-abidiff-exit/test-leaf0-report.txt b/tests/data/test-abidiff-exit/test-leaf0-report.txt
new file mode 100644
index 00000000..46f39976
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-leaf0-report.txt
@@ -0,0 +1,13 @@ 
+Leaf changes summary: 2 artifacts changed
+Changed leaf types summary: 0 leaf type changed
+Removed/Changed/Added functions summary: 0 Removed, 1 Changed, 0 Added function
+Removed/Changed/Added variables summary: 0 Removed, 1 Changed, 0 Added variable
+
+1 function with some sub-type change:
+
+  [C]'function int changed_fun()' has some sub-type changes:
+    return type changed:
+      type name changed from 'int' to 'long int'
+      type size changed from 32 to 64 (in bits)
+
+
diff --git a/tests/data/test-abidiff-exit/test-leaf0-v0.o b/tests/data/test-abidiff-exit/test-leaf0-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..a79511cc3c6db039aaa1f5528db19b55f75c7a2d
GIT binary patch
literal 2784
zcmbtVOKTHR6h4#N*w)yPHa=P^GJ;QZ#zabO)oL_a>jM$Ng@VLMa?=ExiA*Ln>Ouq&
z+__LhaOa=UwSUBoKftvMJ!j^g<o0HY3s1<s=X~dR&wb3xtG8BDmIX`}T!5j(D1g0V
z$d@9v1bLW&duwlhekJ+gcWB`>7U?FU5HTMC@sQE@6!DgoF5@&QSRuyJEkBH-SRzd@
z88C4G>oZu>*5PbEBeL_^X=`RYw+|q-03v%fb1t)-xt_l`mzo6-hai)=kP#DDnF|-^
zSnp@A=gF-!`|<J|Mn8%Fs3Jg1jX0qOMeHh$0*>NnS--PWI7U6hWm^!+Zs=@CuTgL|
z3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P
zMXoJ<eCUf;vTR87%m>sn4s@;v;(GWV?I7mHL<ru~fOI=$!_l>+I$ey6^9EcSdZvPF
zOMT9&zho{2`&0e&db;)35p!cA1ltDuo)n8*+X~KQ<=;2?xlfdz-VHbZK4KJ;>qJr0
z6O-sI1BP>c=8q81^8egiW_}+z4Er(v&G_>?^S!ahfYHfby*B=?`5gmnj$F0G>u2~S
z3R(SomeD`@I<Y_ZmDb_rrr6I6*fI;H?*qNhu0QRGd-o86zYTbi6pOfT3{l)H|97VT
KKiJT4*Z)8NIl2)5

literal 0
HcmV?d00001

diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc
index 4cef727e..bafa7400 100644
--- a/tests/test-abidiff-exit.cc
+++ b/tests/test-abidiff-exit.cc
@@ -111,6 +111,15 @@  InOutSpec in_out_specs[] =
     "data/test-abidiff-exit/test-loc-without-locs-report.txt",
     "output/test-abidiff-exit/test-loc-without-locs-report.txt"
   },
+  {
+    "data/test-abidiff-exit/test-leaf0-v0.o",
+    "data/test-abidiff-exit/test-leaf0-v1.o",
+    "",
+    "--no-show-locs --leaf-changes-only",
+    abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+    "data/test-abidiff-exit/test-leaf0-report.txt",
+    "output/test-abidiff-exit/test-leaf0-report.txt"
+  },
   {0, 0, 0 ,0,  abigail::tools_utils::ABIDIFF_OK, 0, 0}
 };