mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-20 15:56:57 +00:00
Add support for bidiff regression testing
* tests/data/test-bidiff/test-enum0-v0.cc.bi: New input file. * tests/data/test-bidiff/test-enum0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-enum0-report.diff: Likewise. * tests/data/test-bidiff/test-enum1-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-enum1-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-enum1-report.txt: Likewise. * tests/data/test-bidiff/test-qual-type0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-qual-type0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-qual-type0-report.txt: Likewise. * tests/data/test-bidiff/test-struct0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-struct0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-struct0-report.txt: Likewise. * tests/data/test-bidiff/test-struct1-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-struct1-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-struct1-report.txt: Likewise. * tests/data/test-bidiff/test-var0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-var0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-var0-report.txt: Likewise. * tests/test-bidiff.cc: New file. * tests/Makefile.am: Build the new runtestbidiff regression test and add the above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
d8882b850c
commit
c5b81de47d
@ -4,6 +4,7 @@ TESTS= \
|
||||
runtestreadwrite \
|
||||
runtestwritereadarchive \
|
||||
runtestcorediff \
|
||||
runtestbidiff \
|
||||
runtestsvg \
|
||||
runtestdot
|
||||
|
||||
@ -34,6 +35,10 @@ runtestcorediff_SOURCES=$(h)/test-core-diff.cc
|
||||
runtestcorediff_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
||||
runtestcorediff_DEPENDENCIES=libtestutils.la
|
||||
|
||||
runtestbidiff_SOURCES = $(h)/test-bidiff.cc
|
||||
runtestbidiff_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
||||
runtestbidiff_DEPENDENCIES = libtestutils.la
|
||||
|
||||
runtestsvg_SOURCES=$(h)/test-svg.cc
|
||||
runtestsvg_LDADD=$(top_builddir)/src/libabigail.la
|
||||
|
||||
@ -78,7 +83,26 @@ data/test-write-read-archive/test0.xml \
|
||||
data/test-write-read-archive/test1.xml \
|
||||
data/test-write-read-archive/test2.xml \
|
||||
data/test-write-read-archive/test3.xml \
|
||||
data/test-write-read-archive/test4.xml
|
||||
data/test-write-read-archive/test4.xml \
|
||||
\
|
||||
data/test-bidiff/test-enum0-v0.cc.bi \
|
||||
data/test-bidiff/test-enum0-v1.cc.bi \
|
||||
data/test-bidiff/test-enum0-report.txt \
|
||||
data/test-bidiff/test-enum1-v0.cc.bi \
|
||||
data/test-bidiff/test-enum1-v1.cc.bi \
|
||||
data/test-bidiff/test-enum1-report.txt \
|
||||
data/test-bidiff/test-qual-type0-v0.cc.bi \
|
||||
data/test-bidiff/test-qual-type0-v1.cc.bi \
|
||||
data/test-bidiff/test-qual-type0-report.txt \
|
||||
data/test-bidiff/test-struct0-v0.cc.bi \
|
||||
data/test-bidiff/test-struct0-v1.cc.bi \
|
||||
data/test-bidiff/test-struct0-report.txt \
|
||||
data/test-bidiff/test-struct1-v0.cc.bi \
|
||||
data/test-bidiff/test-struct1-v1.cc.bi \
|
||||
data/test-bidiff/test-struct1-report.txt \
|
||||
data/test-bidiff/test-var0-v0.cc.bi \
|
||||
data/test-bidiff/test-var0-v1.cc.bi \
|
||||
data/test-bidiff/test-var0-report.txt
|
||||
|
||||
clean-local: clean-local-check
|
||||
.PHONY: clean-local-check
|
||||
|
17
tests/data/test-bidiff/test-enum0-report.txt
Normal file
17
tests/data/test-bidiff/test-enum0-report.txt
Normal file
@ -0,0 +1,17 @@
|
||||
1 changed type:
|
||||
'enum E' changed:
|
||||
1 enumerator deletion:
|
||||
'E::e2' value '1'
|
||||
|
||||
1 enumerator insertion:
|
||||
'E::e1' value '1'
|
||||
|
||||
1 changed declaration:
|
||||
'function void foo(E)' was changed to 'function void foo(E)':
|
||||
parameter 0 of type 'E' changed:
|
||||
1 enumerator deletion:
|
||||
'E::e2' value '1'
|
||||
|
||||
1 enumerator insertion:
|
||||
'E::e1' value '1'
|
||||
|
13
tests/data/test-bidiff/test-enum0-v0.cc.bi
Normal file
13
tests/data/test-bidiff/test-enum0-v0.cc.bi
Normal file
@ -0,0 +1,13 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<enum-decl name='E' filepath='../../abitests/test-enum0-v0.cc' line='1' column='6' id='type-id-2'>
|
||||
<underlying-type type-id='type-id-1'/>
|
||||
<enumerator name='e0' value='0'/>
|
||||
<enumerator name='e2' value='1'/>
|
||||
</enum-decl>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-3'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foo1E' filepath='../../abitests/test-enum0-v0.cc' line='8' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-2'/>
|
||||
<return type-id='type-id-3'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
13
tests/data/test-bidiff/test-enum0-v1.cc.bi
Normal file
13
tests/data/test-bidiff/test-enum0-v1.cc.bi
Normal file
@ -0,0 +1,13 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<enum-decl name='E' filepath='../../abitests/test-enum0-v1.cc' line='1' column='6' id='type-id-2'>
|
||||
<underlying-type type-id='type-id-1'/>
|
||||
<enumerator name='e0' value='0'/>
|
||||
<enumerator name='e1' value='1'/>
|
||||
</enum-decl>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-3'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foo1E' filepath='../../abitests/test-enum0-v1.cc' line='8' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-2'/>
|
||||
<return type-id='type-id-3'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
17
tests/data/test-bidiff/test-enum1-report.txt
Normal file
17
tests/data/test-bidiff/test-enum1-report.txt
Normal file
@ -0,0 +1,17 @@
|
||||
1 changed type:
|
||||
'enum E' changed:
|
||||
1 enumerator insertion:
|
||||
'E::e1' value '1'
|
||||
|
||||
1 enumerator change:
|
||||
'E::e2' from value '1' to '2'
|
||||
|
||||
1 changed declaration:
|
||||
'function void foo(E)' was changed to 'function void foo(E)':
|
||||
parameter 0 of type 'E' changed:
|
||||
1 enumerator insertion:
|
||||
'E::e1' value '1'
|
||||
|
||||
1 enumerator change:
|
||||
'E::e2' from value '1' to '2'
|
||||
|
13
tests/data/test-bidiff/test-enum1-v0.cc.bi
Normal file
13
tests/data/test-bidiff/test-enum1-v0.cc.bi
Normal file
@ -0,0 +1,13 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<enum-decl name='E' filepath='../../abitests/test-enum1-v0.cc' line='1' column='6' id='type-id-2'>
|
||||
<underlying-type type-id='type-id-1'/>
|
||||
<enumerator name='e0' value='0'/>
|
||||
<enumerator name='e2' value='1'/>
|
||||
</enum-decl>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-3'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foo1E' filepath='../../abitests/test-enum1-v0.cc' line='8' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-2'/>
|
||||
<return type-id='type-id-3'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
14
tests/data/test-bidiff/test-enum1-v1.cc.bi
Normal file
14
tests/data/test-bidiff/test-enum1-v1.cc.bi
Normal file
@ -0,0 +1,14 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<enum-decl name='E' filepath='../../abitests/test-enum1-v1.cc' line='1' column='6' id='type-id-2'>
|
||||
<underlying-type type-id='type-id-1'/>
|
||||
<enumerator name='e0' value='0'/>
|
||||
<enumerator name='e1' value='1'/>
|
||||
<enumerator name='e2' value='2'/>
|
||||
</enum-decl>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-3'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foo1E' filepath='../../abitests/test-enum1-v1.cc' line='9' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-2'/>
|
||||
<return type-id='type-id-3'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
28
tests/data/test-bidiff/test-qual-type0-report.txt
Normal file
28
tests/data/test-bidiff/test-qual-type0-report.txt
Normal file
@ -0,0 +1,28 @@
|
||||
3 changed types:
|
||||
'class S0' changed:
|
||||
size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char S0::m1', at offset 32 (in bits)
|
||||
|
||||
'const S0' changed:
|
||||
in unqualified underlying type 'class S0':
|
||||
size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char S0::m1', at offset 32 (in bits)
|
||||
|
||||
'const S0&' changed:
|
||||
in referenced type 'const S0':
|
||||
in unqualified underlying type 'class S0':
|
||||
size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char S0::m1', at offset 32 (in bits)
|
||||
|
||||
1 changed declaration:
|
||||
'function void foo(const S0&)' was changed to 'function void foo(const S0&)':
|
||||
parameter 0 of type 'const S0&' changed:
|
||||
in referenced type 'const S0':
|
||||
in unqualified underlying type 'class S0':
|
||||
size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char S0::m1', at offset 32 (in bits)
|
||||
|
19
tests/data/test-bidiff/test-qual-type0-v0.cc.bi
Normal file
19
tests/data/test-bidiff/test-qual-type0-v0.cc.bi
Normal file
@ -0,0 +1,19 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<class-decl name='S0' visibility='default' is-declaration-only='yes' id='type-id-2'/>
|
||||
<class-decl name='S0' size-in-bits='32' alignment-in-bits='32' visibility='default' filepath='../../abitests/test-qual-type0-v0.cc' line='1' column='8' def-of-decl-id='type-id-2' id='type-id-3'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='S0' type-id='type-id-2' filepath='../../abitests/test-qual-type0-v0.cc' line='2' column='1' id='type-id-4'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-qual-type0-v0.cc' line='3' column='7'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<qualified-type-def type-id='type-id-3' const='yes' filepath='../../abitests/test-qual-type0-v0.cc' line='1' column='8' id='type-id-5'/>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-5' size-in-bits='64' alignment-in-bits='64' id='type-id-6'/>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-7'/>
|
||||
<function-decl name='foo' mangled-name='_Z3fooRK2S0' filepath='../../abitests/test-qual-type0-v0.cc' line='7' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-6'/>
|
||||
<return type-id='type-id-7'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
23
tests/data/test-bidiff/test-qual-type0-v1.cc.bi
Normal file
23
tests/data/test-bidiff/test-qual-type0-v1.cc.bi
Normal file
@ -0,0 +1,23 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-2'/>
|
||||
<class-decl name='S0' visibility='default' is-declaration-only='yes' id='type-id-3'/>
|
||||
<class-decl name='S0' size-in-bits='64' alignment-in-bits='32' visibility='default' filepath='../../abitests/test-qual-type0-v1.cc' line='1' column='8' def-of-decl-id='type-id-3' id='type-id-4'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='S0' type-id='type-id-3' filepath='../../abitests/test-qual-type0-v1.cc' line='2' column='1' id='type-id-5'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-qual-type0-v1.cc' line='3' column='7'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='32'>
|
||||
<var-decl name='m1' type-id='type-id-2' visibility='default' filepath='../../abitests/test-qual-type0-v1.cc' line='4' column='8'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<qualified-type-def type-id='type-id-4' const='yes' filepath='../../abitests/test-qual-type0-v1.cc' line='1' column='8' id='type-id-6'/>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-6' size-in-bits='64' alignment-in-bits='64' id='type-id-7'/>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-8'/>
|
||||
<function-decl name='foo' mangled-name='_Z3fooRK2S0' filepath='../../abitests/test-qual-type0-v1.cc' line='8' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-7'/>
|
||||
<return type-id='type-id-8'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
38
tests/data/test-bidiff/test-struct0-report.txt
Normal file
38
tests/data/test-bidiff/test-struct0-report.txt
Normal file
@ -0,0 +1,38 @@
|
||||
2 changed types:
|
||||
'class s0' changed:
|
||||
size changed from 64 to 96 bits
|
||||
1 data member change:
|
||||
's0::m1' type changed:
|
||||
name changed from 'char' to 'unsigned int'
|
||||
size changed from 8 to 32 bits
|
||||
alignment changed from 8 to 32 bits
|
||||
|
||||
1 data member insertion:
|
||||
'char s0::m2', at offset 64 (in bits)
|
||||
|
||||
's0&' changed:
|
||||
in referenced type 'class s0':
|
||||
size changed from 64 to 96 bits
|
||||
1 data member change:
|
||||
's0::m1' type changed:
|
||||
name changed from 'char' to 'unsigned int'
|
||||
size changed from 8 to 32 bits
|
||||
alignment changed from 8 to 32 bits
|
||||
|
||||
1 data member insertion:
|
||||
'char s0::m2', at offset 64 (in bits)
|
||||
|
||||
1 changed declaration:
|
||||
'function int foo(s0&)' was changed to 'function int foo(s0&)':
|
||||
parameter 0 of type 's0&' changed:
|
||||
in referenced type 'class s0':
|
||||
size changed from 64 to 96 bits
|
||||
1 data member change:
|
||||
's0::m1' type changed:
|
||||
name changed from 'char' to 'unsigned int'
|
||||
size changed from 8 to 32 bits
|
||||
alignment changed from 8 to 32 bits
|
||||
|
||||
1 data member insertion:
|
||||
'char s0::m2', at offset 64 (in bits)
|
||||
|
21
tests/data/test-bidiff/test-struct0-v0.cc.bi
Normal file
21
tests/data/test-bidiff/test-struct0-v0.cc.bi
Normal file
@ -0,0 +1,21 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-2'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-3'/>
|
||||
<class-decl name='s0' size-in-bits='64' alignment-in-bits='32' visibility='default' filepath='../../abitests/test-struct0-v0.cc' line='1' column='8' def-of-decl-id='type-id-3' id='type-id-4'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='s0' type-id='type-id-3' filepath='../../abitests/test-struct0-v0.cc' line='2' column='1' id='type-id-5'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-struct0-v0.cc' line='3' column='7'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='32'>
|
||||
<var-decl name='m1' type-id='type-id-2' visibility='default' filepath='../../abitests/test-struct0-v0.cc' line='4' column='8'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-4' size-in-bits='64' alignment-in-bits='64' id='type-id-6'/>
|
||||
<function-decl name='foo' mangled-name='_Z3fooR2s0' filepath='../../abitests/test-struct0-v0.cc' line='8' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-6'/>
|
||||
<return type-id='type-id-1'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
25
tests/data/test-bidiff/test-struct0-v1.cc.bi
Normal file
25
tests/data/test-bidiff/test-struct0-v1.cc.bi
Normal file
@ -0,0 +1,25 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-2'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-3'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-4'/>
|
||||
<class-decl name='s0' size-in-bits='96' alignment-in-bits='32' visibility='default' filepath='../../abitests/test-struct0-v1.cc' line='1' column='8' def-of-decl-id='type-id-4' id='type-id-5'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='s0' type-id='type-id-4' filepath='../../abitests/test-struct0-v1.cc' line='2' column='1' id='type-id-6'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='0'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-struct0-v1.cc' line='3' column='7'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='32'>
|
||||
<var-decl name='m1' type-id='type-id-2' visibility='default' filepath='../../abitests/test-struct0-v1.cc' line='4' column='12'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m2' type-id='type-id-3' visibility='default' filepath='../../abitests/test-struct0-v1.cc' line='5' column='8'/>
|
||||
</data-member>
|
||||
</class-decl>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-5' size-in-bits='64' alignment-in-bits='64' id='type-id-7'/>
|
||||
<function-decl name='foo' mangled-name='_Z3fooR2s0' filepath='../../abitests/test-struct0-v1.cc' line='10' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-7'/>
|
||||
<return type-id='type-id-1'/>
|
||||
</function-decl>
|
||||
</abi-instr>
|
64
tests/data/test-bidiff/test-struct1-report.txt
Normal file
64
tests/data/test-bidiff/test-struct1-report.txt
Normal file
@ -0,0 +1,64 @@
|
||||
2 changed types:
|
||||
'class s0' changed:
|
||||
size changed from 192 to 256 bits
|
||||
1 member type change:
|
||||
'typedef s0::number_type' changed:
|
||||
underlying type changed:
|
||||
name changed from 'int' to 'char'
|
||||
size changed from 32 to 8 bits
|
||||
alignment changed from 32 to 8 bits
|
||||
|
||||
1 member type insertion:
|
||||
'typedef s0::grrr'
|
||||
|
||||
1 data member deletion:
|
||||
'char s0::m1', at offset 96 (in bits)
|
||||
|
||||
2 data member changes:
|
||||
's0::m2' offset changed from 128 to 192
|
||||
's0::m0' type changed:
|
||||
name changed from 'int' to 'char'
|
||||
size changed from 32 to 8 bits
|
||||
alignment changed from 32 to 8 bits
|
||||
|
||||
1 data member insertion:
|
||||
'double s0::m01', at offset 128 (in bits)
|
||||
|
||||
2 member function insertions:
|
||||
'method int s0::foo()'
|
||||
'method int s0::foo(int, char) const', virtual at voffset 2/2
|
||||
|
||||
's0&' changed:
|
||||
in referenced type 'class s0':
|
||||
size changed from 192 to 256 bits
|
||||
1 member type change:
|
||||
'typedef s0::number_type' changed:
|
||||
underlying type changed:
|
||||
name changed from 'int' to 'char'
|
||||
size changed from 32 to 8 bits
|
||||
alignment changed from 32 to 8 bits
|
||||
|
||||
1 member type insertion:
|
||||
'typedef s0::grrr'
|
||||
|
||||
1 data member deletion:
|
||||
'char s0::m1', at offset 96 (in bits)
|
||||
|
||||
2 data member changes:
|
||||
's0::m2' offset changed from 128 to 192
|
||||
's0::m0' type changed:
|
||||
name changed from 'int' to 'char'
|
||||
size changed from 32 to 8 bits
|
||||
alignment changed from 32 to 8 bits
|
||||
|
||||
1 data member insertion:
|
||||
'double s0::m01', at offset 128 (in bits)
|
||||
|
||||
2 member function insertions:
|
||||
'method int s0::foo()'
|
||||
'method int s0::foo(int, char) const', virtual at voffset 2/2
|
||||
|
||||
'function int bar(s0&)' was removed
|
||||
|
||||
'function int baz(s0&)' was added
|
||||
|
70
tests/data/test-bidiff/test-struct1-v0.cc.bi
Normal file
70
tests/data/test-bidiff/test-struct1-v0.cc.bi
Normal file
@ -0,0 +1,70 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-2'/>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-3'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-4'/>
|
||||
<pointer-type-def type-id='type-id-4' size-in-bits='64' alignment-in-bits='64' id='type-id-5'/>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-6'/>
|
||||
<qualified-type-def type-id='type-id-4' const='yes' filepath='../../abitests/test-struct1-v0.cc' line='1' column='8' id='type-id-7'/>
|
||||
<pointer-type-def type-id='type-id-7' size-in-bits='64' alignment-in-bits='64' id='type-id-8'/>
|
||||
<class-decl name='s0' size-in-bits='192' alignment-in-bits='64' visibility='default' filepath='../../abitests/test-struct1-v0.cc' line='1' column='8' def-of-decl-id='type-id-4' id='type-id-9'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='s0' type-id='type-id-4' filepath='../../abitests/test-struct1-v0.cc' line='2' column='1' id='type-id-10'/>
|
||||
</member-type>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='number_type' type-id='type-id-1' filepath='../../abitests/test-struct1-v0.cc' line='7' column='15' id='type-id-11'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-struct1-v0.cc' line='3' column='7'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='96'>
|
||||
<var-decl name='m1' type-id='type-id-2' visibility='default' filepath='../../abitests/test-struct1-v0.cc' line='4' column='8'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='128'>
|
||||
<var-decl name='m2' type-id='type-id-3' visibility='default' filepath='../../abitests/test-struct1-v0.cc' line='5' column='12'/>
|
||||
</data-member>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='__base_ctor ' mangled-name='_ZN2s0C2Ev' filepath='../../abitests/test-struct1-v0.cc' line='16' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='__comp_ctor ' mangled-name='_ZN2s0C1Ev' filepath='../../abitests/test-struct1-v0.cc' line='16' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes'>
|
||||
<function-decl name='__base_dtor ' mangled-name='_ZN2s0D2Ev' filepath='../../abitests/test-struct1-v0.cc' line='20' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes'>
|
||||
<function-decl name='__comp_dtor ' mangled-name='_ZN2s0D1Ev' filepath='../../abitests/test-struct1-v0.cc' line='20' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes' vtable-offset='1'>
|
||||
<function-decl name='__deleting_dtor ' mangled-name='_ZN2s0D0Ev' filepath='../../abitests/test-struct1-v0.cc' line='20' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' const='yes'>
|
||||
<function-decl name='foo' mangled-name='_ZNK2s03fooEv' filepath='../../abitests/test-struct1-v0.cc' line='25' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-8'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
</class-decl>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-9' size-in-bits='64' alignment-in-bits='64' id='type-id-12'/>
|
||||
<function-decl name='bar' mangled-name='_Z3barR2s0' filepath='../../abitests/test-struct1-v0.cc' line='29' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-12'/>
|
||||
<return type-id='type-id-1'/>
|
||||
</function-decl>
|
||||
<class-decl name='__class_type_info_pseudo' size-in-bits='128' alignment-in-bits='64' visibility='default' id='type-id-13'/>
|
||||
<qualified-type-def type-id='type-id-13' const='yes' id='type-id-14'/>
|
||||
<var-decl name='_ZTI2s0' type-id='type-id-14' mangled-name='_ZTI2s0' visibility='default' binding='weak' filepath='../../abitests/test-struct1-v0.cc' line='1' column='8'/>
|
||||
</abi-instr>
|
88
tests/data/test-bidiff/test-struct1-v1.cc.bi
Normal file
88
tests/data/test-bidiff/test-struct1-v1.cc.bi
Normal file
@ -0,0 +1,88 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-1'/>
|
||||
<type-decl name='double' size-in-bits='64' alignment-in-bits='64' id='type-id-2'/>
|
||||
<type-decl name='unsigned int' size-in-bits='32' alignment-in-bits='32' id='type-id-3'/>
|
||||
<class-decl name='s0' visibility='default' is-declaration-only='yes' id='type-id-4'/>
|
||||
<pointer-type-def type-id='type-id-4' size-in-bits='64' alignment-in-bits='64' id='type-id-5'/>
|
||||
<type-decl name='void' alignment-in-bits='8' id='type-id-6'/>
|
||||
<qualified-type-def type-id='type-id-4' const='yes' filepath='../../abitests/test-struct1-v1.cc' line='1' column='8' id='type-id-7'/>
|
||||
<pointer-type-def type-id='type-id-7' size-in-bits='64' alignment-in-bits='64' id='type-id-8'/>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-9'/>
|
||||
<class-decl name='s0' size-in-bits='256' alignment-in-bits='64' visibility='default' filepath='../../abitests/test-struct1-v1.cc' line='1' column='8' def-of-decl-id='type-id-4' id='type-id-10'>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='s0' type-id='type-id-4' filepath='../../abitests/test-struct1-v1.cc' line='2' column='1' id='type-id-11'/>
|
||||
</member-type>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='number_type' type-id='type-id-1' filepath='../../abitests/test-struct1-v1.cc' line='7' column='16' id='type-id-12'/>
|
||||
</member-type>
|
||||
<member-type access='public'>
|
||||
<typedef-decl name='grrr' type-id='type-id-2' filepath='../../abitests/test-struct1-v1.cc' line='8' column='18' id='type-id-13'/>
|
||||
</member-type>
|
||||
<data-member access='public' layout-offset-in-bits='64'>
|
||||
<var-decl name='m0' type-id='type-id-1' visibility='default' filepath='../../abitests/test-struct1-v1.cc' line='3' column='8'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='128'>
|
||||
<var-decl name='m01' type-id='type-id-2' visibility='default' filepath='../../abitests/test-struct1-v1.cc' line='4' column='10'/>
|
||||
</data-member>
|
||||
<data-member access='public' layout-offset-in-bits='192'>
|
||||
<var-decl name='m2' type-id='type-id-3' visibility='default' filepath='../../abitests/test-struct1-v1.cc' line='5' column='12'/>
|
||||
</data-member>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='__base_ctor ' mangled-name='_ZN2s0C2Ev' filepath='../../abitests/test-struct1-v1.cc' line='24' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' constructor='yes'>
|
||||
<function-decl name='__comp_ctor ' mangled-name='_ZN2s0C1Ev' filepath='../../abitests/test-struct1-v1.cc' line='24' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes'>
|
||||
<function-decl name='__base_dtor ' mangled-name='_ZN2s0D2Ev' filepath='../../abitests/test-struct1-v1.cc' line='28' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes'>
|
||||
<function-decl name='__comp_dtor ' mangled-name='_ZN2s0D1Ev' filepath='../../abitests/test-struct1-v1.cc' line='28' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' destructor='yes' vtable-offset='1'>
|
||||
<function-decl name='__deleting_dtor ' mangled-name='_ZN2s0D0Ev' filepath='../../abitests/test-struct1-v1.cc' line='28' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-6'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' const='yes'>
|
||||
<function-decl name='foo' mangled-name='_ZNK2s03fooEv' filepath='../../abitests/test-struct1-v1.cc' line='33' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-8'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public'>
|
||||
<function-decl name='foo' mangled-name='_ZN2s03fooEv' filepath='../../abitests/test-struct1-v1.cc' line='37' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-5'/>
|
||||
<return type-id='type-id-9'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
<member-function access='public' const='yes' vtable-offset='2'>
|
||||
<function-decl name='foo' mangled-name='_ZNK2s03fooEic' filepath='../../abitests/test-struct1-v1.cc' line='44' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-8'/>
|
||||
<parameter type-id='type-id-9'/>
|
||||
<parameter type-id='type-id-1'/>
|
||||
<return type-id='type-id-9'/>
|
||||
</function-decl>
|
||||
</member-function>
|
||||
</class-decl>
|
||||
<reference-type-def kind='lvalue' type-id='type-id-10' size-in-bits='64' alignment-in-bits='64' id='type-id-14'/>
|
||||
<function-decl name='baz' mangled-name='_Z3bazR2s0' filepath='../../abitests/test-struct1-v1.cc' line='48' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<parameter type-id='type-id-14'/>
|
||||
<return type-id='type-id-9'/>
|
||||
</function-decl>
|
||||
<class-decl name='__class_type_info_pseudo' size-in-bits='128' alignment-in-bits='64' visibility='default' id='type-id-15'/>
|
||||
<qualified-type-def type-id='type-id-15' const='yes' id='type-id-16'/>
|
||||
<var-decl name='_ZTI2s0' type-id='type-id-16' mangled-name='_ZTI2s0' visibility='default' binding='weak' filepath='../../abitests/test-struct1-v1.cc' line='1' column='8'/>
|
||||
</abi-instr>
|
6
tests/data/test-bidiff/test-var0-report.txt
Normal file
6
tests/data/test-bidiff/test-var0-report.txt
Normal file
@ -0,0 +1,6 @@
|
||||
1 changed declaration:
|
||||
'int var' was changed to 'char var':
|
||||
type of variable changed:
|
||||
name changed from 'int' to 'char'
|
||||
size changed from 32 to 8 bits
|
||||
alignment changed from 32 to 8 bits
|
7
tests/data/test-bidiff/test-var0-v0.cc.bi
Normal file
7
tests/data/test-bidiff/test-var0-v0.cc.bi
Normal file
@ -0,0 +1,7 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foov' filepath='../../abitests/test-var0-v0.cc' line='4' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<return type-id='type-id-1'/>
|
||||
</function-decl>
|
||||
<var-decl name='var' type-id='type-id-1' mangled-name='var' visibility='default' binding='global' filepath='../../abitests/test-var0-v0.cc' line='1' column='5'/>
|
||||
</abi-instr>
|
8
tests/data/test-bidiff/test-var0-v1.cc.bi
Normal file
8
tests/data/test-bidiff/test-var0-v1.cc.bi
Normal file
@ -0,0 +1,8 @@
|
||||
<abi-instr version='1.0'>
|
||||
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
||||
<function-decl name='foo' mangled-name='_Z3foov' filepath='../../abitests/test-var0-v1.cc' line='4' column='1' visibility='default' binding='global' size-in-bits='8' alignment-in-bits='8'>
|
||||
<return type-id='type-id-1'/>
|
||||
</function-decl>
|
||||
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-2'/>
|
||||
<var-decl name='var' type-id='type-id-2' mangled-name='var' visibility='default' binding='global' filepath='../../abitests/test-var0-v1.cc' line='1' column='6'/>
|
||||
</abi-instr>
|
170
tests/test-bidiff.cc
Normal file
170
tests/test-bidiff.cc
Normal file
@ -0,0 +1,170 @@
|
||||
// -*- Mode: C++ -*-
|
||||
//
|
||||
// Copyright (C) 2013 Red Hat, Inc.
|
||||
//
|
||||
// This file is part of the GNU Application Binary Interface Generic
|
||||
// Analysis and Instrumentation Library (libabigail). This library is
|
||||
// free software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option) any
|
||||
// later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Lesser Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this program; see the file COPYING-LGPLV3. If
|
||||
// not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Author: Dodji Seketeli
|
||||
|
||||
/// @file
|
||||
///
|
||||
/// This program runs a diff between input files and compares the
|
||||
/// resulting report with a reference report. If the resulting report
|
||||
/// is different from the reference report, the test has failed.
|
||||
///
|
||||
/// The set of input files and reference reports to consider should be
|
||||
/// present in the source distribution.
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include "abg-tools-utils.h"
|
||||
#include "test-utils.h"
|
||||
#include "abg-comparison.h"
|
||||
|
||||
using std::string;
|
||||
using std::ofstream;
|
||||
using std::cerr;
|
||||
|
||||
struct InOutSpec
|
||||
{
|
||||
const char* first_in_path;
|
||||
const char* second_in_path;
|
||||
const char* ref_diff_path;
|
||||
const char* out_path;
|
||||
};// end struct InOutSpec
|
||||
|
||||
static InOutSpec specs[] =
|
||||
{
|
||||
{
|
||||
"data/test-bidiff/test-enum0-v0.cc.bi",
|
||||
"data/test-bidiff/test-enum0-v1.cc.bi",
|
||||
"data/test-bidiff/test-enum0-report.txt",
|
||||
"output/test-bidiff/test-enum0-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-bidiff/test-enum1-v0.cc.bi",
|
||||
"data/test-bidiff/test-enum1-v1.cc.bi",
|
||||
"data/test-bidiff/test-enum1-report.txt",
|
||||
"output/test-bidiff/test-enum1-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-bidiff/test-qual-type0-v0.cc.bi",
|
||||
"data/test-bidiff/test-qual-type0-v1.cc.bi",
|
||||
"data/test-bidiff/test-qual-type0-report.txt",
|
||||
"output/test-bidiff/test-qual-type0-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-bidiff/test-struct0-v0.cc.bi",
|
||||
"data/test-bidiff/test-struct0-v1.cc.bi",
|
||||
"data/test-bidiff/test-struct0-report.txt",
|
||||
"output/test-bidiff/test-struct0-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-bidiff/test-struct1-v0.cc.bi",
|
||||
"data/test-bidiff/test-struct1-v1.cc.bi",
|
||||
"data/test-bidiff/test-struct1-report.txt",
|
||||
"output/test-bidiff/test-struct1-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-bidiff/test-var0-v0.cc.bi",
|
||||
"data/test-bidiff/test-var0-v1.cc.bi",
|
||||
"data/test-bidiff/test-var0-report.txt",
|
||||
"output/test-bidiff/test-var0-report.txt"
|
||||
},
|
||||
// This should be the last entry.
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#define NUM_SPEC_ELEMS \
|
||||
((sizeof(specs) / sizeof(InOutSpec)) - 1)
|
||||
|
||||
using std::string;
|
||||
using std::cerr;
|
||||
using std::ofstream;
|
||||
using abigail::translation_unit;
|
||||
using abigail::translation_unit_sptr;
|
||||
using abigail::comparison::translation_unit_diff_sptr;
|
||||
using abigail::comparison::compute_diff;
|
||||
|
||||
int
|
||||
main(int, char*[])
|
||||
{
|
||||
bool is_ok = true;
|
||||
|
||||
string out_path =
|
||||
abigail::tests::get_build_dir() + "/tests/" + specs->out_path;
|
||||
if (!abigail::tools::ensure_parent_dir_created(out_path))
|
||||
{
|
||||
cerr << "Could not create parent director for " << out_path;
|
||||
return 1;
|
||||
}
|
||||
|
||||
string first_in_path, second_in_path, ref_diff_path;
|
||||
for (InOutSpec *s = specs; s->first_in_path; ++s)
|
||||
{
|
||||
first_in_path =
|
||||
abigail::tests::get_src_dir() + "/tests/" + s->first_in_path;
|
||||
second_in_path =
|
||||
abigail::tests::get_src_dir() + "/tests/" + s->second_in_path;
|
||||
ref_diff_path =
|
||||
abigail::tests::get_src_dir() + "/tests/" + s->ref_diff_path;
|
||||
out_path =
|
||||
abigail::tests::get_build_dir() + "/tests/" + s->out_path;
|
||||
|
||||
if (!abigail::tools::ensure_parent_dir_created(out_path))
|
||||
{
|
||||
cerr << "Could not create parent director for " << out_path;
|
||||
continue;
|
||||
}
|
||||
|
||||
translation_unit_sptr tu1(new translation_unit(first_in_path));
|
||||
if (!tu1->read())
|
||||
{
|
||||
cerr << "failed to read " << tu1->get_path() << "\n";
|
||||
is_ok = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
translation_unit_sptr tu2(new translation_unit(second_in_path));
|
||||
if (!tu2->read())
|
||||
{
|
||||
cerr << "failed to read " << tu1->get_path() << "\n";
|
||||
is_ok = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
translation_unit_diff_sptr d = compute_diff(tu1, tu2);
|
||||
ofstream of(s->out_path, std::ios_base::trunc);
|
||||
if (!of.is_open())
|
||||
{
|
||||
cerr << "failed to read " << s->out_path << "\n";
|
||||
is_ok = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
d->report(of);
|
||||
of.close();
|
||||
|
||||
string cmd = "diff -u " + ref_diff_path + " " + out_path;
|
||||
if (system(cmd.c_str()))
|
||||
is_ok = false;
|
||||
}
|
||||
|
||||
return !is_ok;
|
||||
}
|
Loading…
Reference in New Issue
Block a user