From: Dodji Seketeli Date: Tue, 29 Nov 2022 12:42:43 +0000 (+0100) Subject: test-read-ctf: Update tests for fixing size and name for underlying types X-Git-Tag: upstream/2.3~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5efe2247c3447dc994a27dfe32e571023091213e;p=platform%2Fupstream%2Flibabigail.git test-read-ctf: Update tests for fixing size and name for underlying types When applying the patch "217f579b ctf-reader: Fix size and name for underlying types" the testing parts felt through the cracks. Oops. This patch adds back the testing parts of the original patch. Here is the link to the initial post: https://inbox.sourceware.org/libabigail/871qpmou3k.fsf@seketeli.org/T/#m5f37b419e580a2a4ea9d91a9394382d886358809 * src/abg-ctf-reader.cc (process_ctf_{base_type,enum_type}): Look at ctf refence type to build the underlying type if present. * tests/data/Makefile.am: New test cases. * tests/data/test-read-ctf/PR27700/test-PR27700.abi: New test input. * tests/data/test-read-ctf/test-bitfield-enum.abi: Likewise. * tests/data/test-read-ctf/test-bitfield-enum.c: Likewise. * tests/data/test-read-ctf/test-bitfield-enum.o: Likewise. * tests/data/test-read-ctf/test-bitfield.abi: Likewise. * tests/data/test-read-ctf/test-bitfield.c: Likewise. * tests/data/test-read-ctf/test-bitfield.o: Likewise. * tests/data/test-read-ctf/test-enum-many.o.hash.abi: Adjust. * tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-enum.o.abi: Likewise: * tests/data/test-read-ctf/test0.abi: Likewise. * tests/data/test-read-ctf/test0.hash.abi: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test5.o.abi: Likewise. * tests/test-read-ctf.cc: Update test suite. Signed-off-by: Dodji Seketeli Signed-off-by: Guillermo E. Martinez --- diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 4b6e9305..b89a4dd8 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -704,6 +704,12 @@ test-read-ctf/test-linux-module.ko \ test-read-ctf/test-fallback.abi \ test-read-ctf/test-fallback.c \ test-read-ctf/test-fallback.o \ +test-read-ctf/test-bitfield.abi \ +test-read-ctf/test-bitfield.c \ +test-read-ctf/test-bitfield.o \ +test-read-ctf/test-bitfield-enum.abi \ +test-read-ctf/test-bitfield-enum.c \ +test-read-ctf/test-bitfield-enum.o \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-read-ctf/PR27700/test-PR27700.abi b/tests/data/test-read-ctf/PR27700/test-PR27700.abi index 4f34eb8a..1a7c229e 100644 --- a/tests/data/test-read-ctf/PR27700/test-PR27700.abi +++ b/tests/data/test-read-ctf/PR27700/test-PR27700.abi @@ -3,14 +3,14 @@ - - + + diff --git a/tests/data/test-read-ctf/test-bitfield-enum.abi b/tests/data/test-read-ctf/test-bitfield-enum.abi new file mode 100644 index 00000000..b95f1781 --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield-enum.abi @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-bitfield-enum.c b/tests/data/test-read-ctf/test-bitfield-enum.c new file mode 100644 index 00000000..502ec06a --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield-enum.c @@ -0,0 +1,12 @@ +/* gcc -gctf -c test-bitfield-enum.c -o test-bitfield-enum.o */ +enum event_kind +{ + NO_EVENT, +}; + +struct input +{ + enum event_kind kind : 16; +}; + +struct input e; diff --git a/tests/data/test-read-ctf/test-bitfield-enum.o b/tests/data/test-read-ctf/test-bitfield-enum.o new file mode 100644 index 00000000..2c532f50 Binary files /dev/null and b/tests/data/test-read-ctf/test-bitfield-enum.o differ diff --git a/tests/data/test-read-ctf/test-bitfield.abi b/tests/data/test-read-ctf/test-bitfield.abi new file mode 100644 index 00000000..4231ba3e --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield.abi @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-bitfield.c b/tests/data/test-read-ctf/test-bitfield.c new file mode 100644 index 00000000..7d76d2f4 --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield.c @@ -0,0 +1,15 @@ +/* gcc -gctf -c test-bitfield.c -o test-bitfield.o */ +struct foo +{ + unsigned bar : 2; + unsigned baz : 1; +}; + +struct foobar +{ + unsigned char bar : 2; + unsigned char baz : 1; +}; + +struct foo f; +struct foobar fb; diff --git a/tests/data/test-read-ctf/test-bitfield.o b/tests/data/test-read-ctf/test-bitfield.o new file mode 100644 index 00000000..c23c8188 Binary files /dev/null and b/tests/data/test-read-ctf/test-bitfield.o differ diff --git a/tests/data/test-read-ctf/test-enum-many.o.hash.abi b/tests/data/test-read-ctf/test-enum-many.o.hash.abi index 116325f9..9119525b 100644 --- a/tests/data/test-read-ctf/test-enum-many.o.hash.abi +++ b/tests/data/test-read-ctf/test-enum-many.o.hash.abi @@ -4,14 +4,13 @@ - - + - + @@ -61,6 +60,7 @@ + diff --git a/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi b/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi index f4911bc4..da68828c 100644 --- a/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi +++ b/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi @@ -3,13 +3,13 @@ - - + + diff --git a/tests/data/test-read-ctf/test-enum.o.abi b/tests/data/test-read-ctf/test-enum.o.abi index bd3a55be..e13ebdd0 100644 --- a/tests/data/test-read-ctf/test-enum.o.abi +++ b/tests/data/test-read-ctf/test-enum.o.abi @@ -4,19 +4,19 @@ - - - + + - + - + + diff --git a/tests/data/test-read-ctf/test0.abi b/tests/data/test-read-ctf/test0.abi index 05430067..60d3cf1e 100644 --- a/tests/data/test-read-ctf/test0.abi +++ b/tests/data/test-read-ctf/test0.abi @@ -20,47 +20,47 @@ - - - - - - + + + + + - - - + + + - + - + - + - + - - - - - + + + + + + - - + + - + - + - + - + diff --git a/tests/data/test-read-ctf/test0.hash.abi b/tests/data/test-read-ctf/test0.hash.abi index 4aa9a93c..76dd581e 100644 --- a/tests/data/test-read-ctf/test0.hash.abi +++ b/tests/data/test-read-ctf/test0.hash.abi @@ -20,7 +20,6 @@ - @@ -34,14 +33,15 @@ - + - + - + + @@ -49,7 +49,7 @@ - + diff --git a/tests/data/test-read-ctf/test1.so.abi b/tests/data/test-read-ctf/test1.so.abi index 822b57a5..2ecd5826 100644 --- a/tests/data/test-read-ctf/test1.so.abi +++ b/tests/data/test-read-ctf/test1.so.abi @@ -6,9 +6,8 @@ - - - + + @@ -17,8 +16,9 @@ - + + diff --git a/tests/data/test-read-ctf/test1.so.hash.abi b/tests/data/test-read-ctf/test1.so.hash.abi index b3ace158..4f8633dd 100644 --- a/tests/data/test-read-ctf/test1.so.hash.abi +++ b/tests/data/test-read-ctf/test1.so.hash.abi @@ -6,9 +6,8 @@ - - + @@ -19,6 +18,7 @@ + diff --git a/tests/data/test-read-ctf/test5.o.abi b/tests/data/test-read-ctf/test5.o.abi index 6d72d7ab..814aff7f 100644 --- a/tests/data/test-read-ctf/test5.o.abi +++ b/tests/data/test-read-ctf/test5.o.abi @@ -7,10 +7,9 @@ - - - - + + + @@ -18,7 +17,8 @@ - + + @@ -37,7 +37,7 @@ - + diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc index 043032ff..a0b399fc 100644 --- a/tests/test-read-ctf.cc +++ b/tests/test-read-ctf.cc @@ -345,6 +345,24 @@ static InOutSpec in_out_specs[] = "output/test-read-ctf/test-fallback.abi", NULL, }, + { + "data/test-read-ctf/test-bitfield.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-bitfield.abi", + "output/test-read-ctf/test-bitfield.abi", + "--ctf", + }, + { + "data/test-read-ctf/test-bitfield-enum.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-bitfield-enum.abi", + "output/test-read-ctf/test-bitfield-enum.abi", + "--ctf", + }, // This should be the last entry. {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL, NULL} };