diff mbox series

[1/3] Add tests for declaration-only struct diffs.

Message ID 20200422212059.258602-1-gprocida@google.com
State Committed
Headers show
Series [1/3] Add tests for declaration-only struct diffs. | expand

Commit Message

Giuliano Procida April 22, 2020, 9:20 p.m. UTC
There were no tests exercising this reporting path. The new test is
run with --harmless as these changes are considered harmless.

	* tests/data/Makefile.am: Add new test case files.
	* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
	New test case generating "declaration-only" output.
	* tests/data/test-abidiff-exit/test-decl-struct-v0.c: Ditto.
	* tests/data/test-abidiff-exit/test-decl-struct-v0.o: Ditto.
	* tests/data/test-abidiff-exit/test-decl-struct-v1.c: Ditto.
	* tests/data/test-abidiff-exit/test-decl-struct-v1.o: Ditto.
	* tests/test-abidiff-exit.cc: Run new test case.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 tests/data/Makefile.am                         |   5 +++++
 .../test-decl-struct-report.txt                |  17 +++++++++++++++++
 .../test-abidiff-exit/test-decl-struct-v0.c    |   5 +++++
 .../test-abidiff-exit/test-decl-struct-v0.o    | Bin 0 -> 3016 bytes
 .../test-abidiff-exit/test-decl-struct-v1.c    |   5 +++++
 .../test-abidiff-exit/test-decl-struct-v1.o    | Bin 0 -> 3016 bytes
 tests/test-abidiff-exit.cc                     |   9 +++++++++
 7 files changed, 41 insertions(+)
 create mode 100644 tests/data/test-abidiff-exit/test-decl-struct-report.txt
 create mode 100644 tests/data/test-abidiff-exit/test-decl-struct-v0.c
 create mode 100644 tests/data/test-abidiff-exit/test-decl-struct-v0.o
 create mode 100644 tests/data/test-abidiff-exit/test-decl-struct-v1.c
 create mode 100644 tests/data/test-abidiff-exit/test-decl-struct-v1.o

Comments

Dodji Seketeli April 27, 2020, 11:15 a.m. UTC | #1
Hello Giuliano,

Giuliano Procida <gprocida@google.com> a ?crit:

> There were no tests exercising this reporting path. The new test is
> run with --harmless as these changes are considered harmless.
>
> 	* tests/data/Makefile.am: Add new test case files.
> 	* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
> 	New test case generating "declaration-only" output.
> 	* tests/data/test-abidiff-exit/test-decl-struct-v0.c: Ditto.
> 	* tests/data/test-abidiff-exit/test-decl-struct-v0.o: Ditto.
> 	* tests/data/test-abidiff-exit/test-decl-struct-v1.c: Ditto.
> 	* tests/data/test-abidiff-exit/test-decl-struct-v1.o: Ditto.
> 	* tests/test-abidiff-exit.cc: Run new test case.

Applied to master, thanks!

Cheers,
diff mbox series

Patch

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 6e926ebd..a1b9bf64 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -146,6 +146,11 @@  test-abidiff-exit/test-member-size-v1.cc \
 test-abidiff-exit/test-member-size-v1.o \
 test-abidiff-exit/test-member-size-report0.txt \
 test-abidiff-exit/test-member-size-report1.txt \
+test-abidiff-exit/test-decl-struct-v0.c \
+test-abidiff-exit/test-decl-struct-v0.o \
+test-abidiff-exit/test-decl-struct-v1.c \
+test-abidiff-exit/test-decl-struct-v1.o \
+test-abidiff-exit/test-decl-struct-report.txt \
 \
 test-diff-dwarf/test0-v0.cc		\
 test-diff-dwarf/test0-v0.o			\
diff --git a/tests/data/test-abidiff-exit/test-decl-struct-report.txt b/tests/data/test-abidiff-exit/test-decl-struct-report.txt
new file mode 100644
index 00000000..aa5dedae
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-struct-report.txt
@@ -0,0 +1,17 @@ 
+Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+2 functions with some indirect sub-type change:
+
+  [C] 'function void reg1(const embodied*)' at test-decl-struct-v1.c:4:1 has some indirect sub-type changes:
+    parameter 1 of type 'const embodied*' has sub-type changes:
+      in pointed to type 'const embodied':
+        in unqualified underlying type 'struct embodied' at test-decl-struct-v1.c:1:1:
+          type size changed from 0 to 32 (in bits)
+          type struct embodied was a declaration-only type and is now a defined type
+  [C] 'function void reg2(const disembodied*)' at test-decl-struct-v1.c:5:1 has some indirect sub-type changes:
+    parameter 1 of type 'const disembodied*' has sub-type changes:
+      in pointed to type 'const disembodied':
+        in unqualified underlying type 'struct disembodied':
+          type size changed from 32 to 0 (in bits)
+          type struct disembodied was a defined type and is now a declaration-only type
diff --git a/tests/data/test-abidiff-exit/test-decl-struct-v0.c b/tests/data/test-abidiff-exit/test-decl-struct-v0.c
new file mode 100644
index 00000000..2aca0211
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-struct-v0.c
@@ -0,0 +1,5 @@ 
+struct embodied;
+struct disembodied { int x; };
+
+void reg1(const struct embodied * foo) { (void)foo; }
+void reg2(const struct disembodied * foo) { (void)foo; }
diff --git a/tests/data/test-abidiff-exit/test-decl-struct-v0.o b/tests/data/test-abidiff-exit/test-decl-struct-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..030f443128d0e318695a7f8b4301c747741f34d7
GIT binary patch
literal 3016
zcmbVO&2Jk;6o2EjV~1_FNlhUk99&WQA=t$mp%S-EF$B_9MHMP4LP#jA?TKv>udCg4
zNkNDT@u6N&k&qA)2L%5Cf&&*MgpfFM>x~N%S8hlg;Jw*-&SbK=^hut1@Auws=Iz^g
zvwr`@mo`d50E>VNuxl|2P^<3hZKbxM4oBenr8|FKy7S&Yci;HMP=CgVvWlvy#SSUm
z7#=e866s}8s%_xx?0_geaz(kzK2DW#Wf*5LLx`xTiBy*c6!Fz<9IIR7F?vssUixeR
zHMLgGDHm|QpK{8N{iHdwI768{wc3xQiv{txS9cw6*;^1ts`C%y+I8W0u6x!!=eAr?
z$8_hwspaP7`YI+>J^_~zuN(*0z2G`EfSEu%yX1Iz(8(oQs=fHd^GigpRt$P+5w|{!
zJX&D34vu$z3DbBIf2u@)iy2~;(17788jfNK@vk=r0tF%b3CLuc`90a)_R}nxbTj{E
zGw3RE<rK{3yP$crviL#ei8UNc4)PP(51}_q<)}064P_55UcKH}51(nYf|Vd_tTe+`
z7&coCf0RvPxz?AlOom-Fqog}n+gUy1pLx3B_Z$9Jl-`QFgJc|!C#gS)-yX(2KZ`os
zGCd$Q+<FC`%0@R}x;b22Uq9P8^@8jSqc~5&4_l|LWYk09@Ss-2JJ&$$%!}ni)!JRG
z#iNMRk3^lN=e+rkOY3tp8yJ8X`OcFQrO2Oq_K#HRGW`ADeh<AB^6nQ$zhB$qAfree
z-CMTL$-BgcaTTL^4X*?0%o|9qI@9jj>vCXjFQ6?4yaVukeGk|~cx&v|f%};1O*q>;
zAABxCP=`bB%uW6P+N_g{Ga#Ivc7Z??o*9=p3`h0M_-$=dCz4R+(>_7{G=V4-Z}w-P
z&>W|IE82d=!r#^Q>w4z(`T0Mw;<X8%TJenkV8wr=ZLSIB$+?hgUi*1pZNj+&@P@{z
z24)@F7S8!Yklq?$i{qRn`8;4PlRFs%y(o(y=%gtGiQJBYp6pEeo5Of(j6S7DolYWe
z?r}#+6!-DgFe%%^STY5-fS@}bjU;|Mf_R+C052`P^`h=unj{CCTS+wH7q9cb-)R|%
zR70*auhZ6weOptkDaX(t%<lMC%^*X!`6tmw=kI>`A#&|CX*=HkS27H-W9chJU;MTa
zL+Wq&-vDT60-ZO4xL5F-r(_LBdrfjIYmoau1sBA=T!2yRH=5rh!w`F~E9fiA|1aGv
z%%}Y6HnsEbA!e_M5d5yeYh)N=$8MspX#Yihptw%7Kiwzx{x=Y#H91dIl^oYi%J&81
zyg$!$4;Ash(|kH#rZA7^57EiG8F$aTBn*cg`=#dF;eTl0HG@kkKR?5tqf%7Armi2?
zh3ZFNE9P@uDIa@pgkV)S)IcXp-wpZ-+I)H^cJCnsUsF;j$MR`9+Rsnx7V+QI`F}fQ
I=8Db#AFEN&ivR!s

literal 0
HcmV?d00001

diff --git a/tests/data/test-abidiff-exit/test-decl-struct-v1.c b/tests/data/test-abidiff-exit/test-decl-struct-v1.c
new file mode 100644
index 00000000..c069fa5e
--- /dev/null
+++ b/tests/data/test-abidiff-exit/test-decl-struct-v1.c
@@ -0,0 +1,5 @@ 
+struct embodied { int y; };
+struct disembodied;
+
+void reg1(const struct embodied * foo) { (void)foo; }
+void reg2(const struct disembodied * foo) { (void)foo; }
diff --git a/tests/data/test-abidiff-exit/test-decl-struct-v1.o b/tests/data/test-abidiff-exit/test-decl-struct-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..ee0b463b7052f715fad177dd718d6464f8f0790e
GIT binary patch
literal 3016
zcmbVO-ESL35TEtgvBNb-Qd62JJh-Btf;(~%DskHsLm+KcRH0U_DkK!n_Qtk|&(+<z
zBp^gUe5gF2Rzd<K9uWKo`~j5^LgJY>-uhCBSKg3#fSJ7=d%JO7I+Ay0e>1<`xw)M^
zfAsnr>jfczMZkF&&lm-$l*e{MnGLAILAZYL&clm$KK$qI+rJv-FBnl&Q5Ch=0c9J*
z(}rCjyC_6u9ksIqLL9!V+(jQ%saWd88B7r(N=lLG(tskq-^H=KIT)b#_?KuG?scJp
z8j8C(Ojka`F=rPiu<xTcXBVF(o7mGT6A*Lam{)ZjZ_%3*2g|dE(OVUc=elRyvu@oL
zRZMpVoJu~uR9(TOipSv+;-#bDy60U76PXIc%L|T|2c1};r5f|!yt+X2a><|<=CRCG
zaJ+L1nD>*o0IdYiQ&#vxry6-MOUM}MEBJF1ONf8H87!xIz4#skWHQbCwrp+rX_gFI
znSVPBT8dmc3Dfy5I6YLF|D^QXDvkvQ`HAd=(C($O-yF1ivJDrmT(7N#FV*V7auC**
zm%@4&F4b#(KO4q!wIgGh^jbKLl2&(hd*!r$`o)^xsrj2xx)Zm$$sisKQ-2u0*NfYJ
z7B#nIx=(7j^)kGW^>4vwbGWd!cBXdnHQDS%ah`%7)=yc<sE5MgDQ$@NuY%Z~6^jST
zmAhDrXAq|!i8@QKc(b1u)@G*GF#s|0og*j8B!BMNJJNA4!r%Yx_0U^U&9KMi==W<o
z9Ar!qNB5TPbMkX;!?=pkyoT3-X=64vol$p<F|r((c@)qy2fTgoJ$(<@M0jhA>%e_X
z^(LI>toJ_`A*jQlcjnf90_SX#i!&gco_3Bv6xNK(9EL+$Grp_m*pf;p^HHCmeJY26
z;?4dH44n3*TZrUZu2ekXAL#j8TJ!q+{2yEKB|X1q;d%<+YJ=BdoNGdP@*3ou)d6<=
z*?sVu#;FEo9U2zS`9qNI^s&WJXGyNRY-MsggP<K{5d_UNg&>hzQP7snVP~TkZw}C>
z?5NpH<n2e?Q4+-+yfsY9Rxg%J!7U(Y4f=hF-;N+2WHP`@3va!s^{yt#?#5;k_4&o?
z{2x~>B9Usyb>?*%+OThHiZ$g3P6)F*{)QQ3*f#$J`sn;UE<Z%By(VqP`~OB0L+n`k
zO3@d;VZ@O6d;T{7YMMajjUet7{N^cH#nE1q9E%$KLPd=SJN8X<*%(FtsKKQ%RatiI
zWke_C|CeqS=2QN3o7(xe5wq7s2>#IERhk%L$8Ml+(*E=MKyjUDf4Vp9{cj;gYjU1w
zDmki~^eYCm=KWdIJv52`v*y$JGKG1pKSd|oX563VC1E)1*zYvo4u7D5n+BImetw3(
zMq^U_mUR8NE>u7IS}~vNO8MA(BLpkDp}IO@`fkuy(B{)Sv3n08_<@o_Ig+c<Xg@!#
QJBj~}&i|(oGdFDh|Cwvh7XSbN

literal 0
HcmV?d00001

diff --git a/tests/test-abidiff-exit.cc b/tests/test-abidiff-exit.cc
index 25f58b34..5afc15bc 100644
--- a/tests/test-abidiff-exit.cc
+++ b/tests/test-abidiff-exit.cc
@@ -194,6 +194,15 @@  InOutSpec in_out_specs[] =
     "data/test-abidiff-exit/test-member-size-report1.txt",
     "output/test-abidiff-exit/test-member-size-report1.txt"
   },
+  {
+    "data/test-abidiff-exit/test-decl-struct-v0.o",
+    "data/test-abidiff-exit/test-decl-struct-v1.o",
+    "",
+    "--harmless",
+    abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+    "data/test-abidiff-exit/test-decl-struct-report.txt",
+    "output/test-abidiff-exit/test-decl-struct-report.txt"
+  },
   {0, 0, 0 ,0,  abigail::tools_utils::ABIDIFF_OK, 0, 0}
 };