From patchwork Wed Apr 22 21:20:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39121 From: gprocida@google.com (Giuliano Procida) Date: Wed, 22 Apr 2020 22:20:57 +0100 Subject: [PATCH 1/3] Add tests for declaration-only struct diffs. Message-ID: <20200422212059.258602-1-gprocida@google.com> 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 --- 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 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 zGw3REvCXjFQ6?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;`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|&(+-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<|<=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%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-MsggPhzQP7snVP~TkZw}C> z?5NpHB9Usyb>?*%+OThHiZ$g3P6)F*{)QQ3*f#$J`sn;UE#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