[PATCHv2] ctf-front-end: Add test for alias symbols

Message ID 20221121034615.632452-1-guillermo.e.martinez@oracle.com
State New
Headers
Series [PATCHv2] ctf-front-end: Add test for alias symbols |

Commit Message

Guillermo E. Martinez Nov. 21, 2022, 3:46 a.m. UTC
  This patch v2 to add a new test case in the ctf-front-end test suite to
to test for alias symbols.

Changes from v1:
  + I forget to add the correct tests/data/test-read-ctf/test-alias.o.abi file.

Comments will be appreciated!.

Thanks,
guillermo

---
 tests/data/Makefile.am                    |   1 +
 tests/data/test-read-ctf/test-alias.o     | Bin 0 -> 1664 bytes
 tests/data/test-read-ctf/test-alias.o.abi |  16 ++++++++--------
 tests/test-read-ctf.cc                    |   8 ++++++++
 4 files changed, 17 insertions(+), 8 deletions(-)
 create mode 100644 tests/data/test-read-ctf/test-alias.o

index 1fe61b8f..b5fd92ad 100644
  

Comments

Guillermo E. Martinez Dec. 20, 2022, 6:59 p.m. UTC | #1
Hello,

Any comment about this patch?

Thanks in advanced!.

Kind regards,
guillermo


On Sun, Nov 20, 2022 at 09:46:15PM -0600, Guillermo E. Martinez wrote:
> This patch v2 to add a new test case in the ctf-front-end test suite to
> to test for alias symbols.
> 
> Changes from v1:
>   + I forget to add the correct tests/data/test-read-ctf/test-alias.o.abi file.
> 
> Comments will be appreciated!.
> 
> Thanks,
> guillermo
> 
> ---
>  tests/data/Makefile.am                    |   1 +
>  tests/data/test-read-ctf/test-alias.o     | Bin 0 -> 1664 bytes
>  tests/data/test-read-ctf/test-alias.o.abi |  16 ++++++++--------
>  tests/test-read-ctf.cc                    |   8 ++++++++
>  4 files changed, 17 insertions(+), 8 deletions(-)
>  create mode 100644 tests/data/test-read-ctf/test-alias.o
> 
> diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
> index 5ec33924..3d9eb9d1 100644
> --- a/tests/data/Makefile.am
> +++ b/tests/data/Makefile.am
> @@ -640,6 +640,7 @@ test-read-ctf/test9.c		\
>  test-read-ctf/test9.o		\
>  test-read-ctf/test9.o.abi	\
>  test-read-ctf/test-alias.c	\
> +test-read-ctf/test-alias.o	\
>  test-read-ctf/test-alias.o.abi	\
>  test-read-ctf/test-ambiguous-struct-A.c	\
>  test-read-ctf/test-ambiguous-struct-A.o	\
> diff --git a/tests/data/test-read-ctf/test-alias.o b/tests/data/test-read-ctf/test-alias.o
> new file mode 100644
> index 0000000000000000000000000000000000000000..18549b793a81754d6bc319eaa0f46179a4686b49
> GIT binary patch
> literal 1664
> zcmbtUv2GJV5S??36TpcQgb-3da-fJK@SbfX1SycgfFpz`5GkW*@4SvrobRl=O|WU8
> zLZZtjQ1S_sNc;dL9Tgt{H4@CMcfekZC>UvOX5Y-4_3hj9i+d067d#KxJh%nFSBwI*
> z7N&BOwqO~`u)Fj6%kka^`1ZM2;EqjBFfO5&(a)lvN3WtkLD%TC4>^rKfxd!%(MG}v
> z;~q>)MSN5cqB&@#NdS*HXy?oih!PD0872EiG6NY$GB?>#8g(al?=T6$@23Oh2jgJu
> zr<n|6<>y)G$59}I=s-qsEm6;W;cJ!a-0w;)O<K#8?AAivo2<-q5dw7D?d?jn^JsUg
> z(zqt-qF!m%o6Sa}ezQ_lqoK;8fl9QDw*c%rn0G@06u^5=7@KF;^xkB2Ze-r`$KZ`t
> zz4h|q(lHh<AVyBMNRQhqtFH>}<<cE&p!Hvj<`&`Wk9p+<bK0{N(&Wq(ZuUZqG`KVe
> zzl`{rQ4|w2ez&WbZ_L4gj=07rX@oNZO_Vd~95u~7F!M?CUl)%Mk&g#j1{ifViG9wr
> z8fg%uCWs)<L7<ZONC%`2h$PiYpeD6k%kZgPA0&rjn5C$p9)rkKEQRXt_cA$9X8-?v
> ztm6REgfBDCYuSX)n{mDuyxzcsu&K|}lseqtM3=vbb-FJuf5-AzKOW<*Nmq9!^)mlE
> z6K!;R8;BEDclz$y#w!lae2&|e@3cY64Nk#@A7Gu%c;*h_dT1Nn-{pQ=0rpa>%YS3}
> zH?THsE`JY;bf&H8Cd}X2f%d-+P9a8I<}*HTZyNQ<?*En+Xs6LhW0!x@;uvP^rQQGf
> U4Em?mYgl*h4pBZ@e*6#qPtYBU=>Px#
> 
> literal 0
> HcmV?d00001
> 
> diff --git a/tests/data/test-read-ctf/test-alias.o.abi b/tests/data/test-read-ctf/test-alias.o.abi
> index 1fe61b8f..b5fd92ad 100644
> --- a/tests/data/test-read-ctf/test-alias.o.abi
> +++ b/tests/data/test-read-ctf/test-alias.o.abi
> @@ -1,19 +1,19 @@
>  <abi-corpus version='2.1' path='data/test-read-ctf/test-alias.o'>
>    <elf-function-symbols>
>      <elf-symbol name='alias_func' type='func-type' binding='weak-binding' visibility='default-visibility' is-defined='yes'/>
> -    <elf-symbol name='main_func' type='func-type' binding='global-binding' visibility='default-visibility' alias='alias_func,main_var,alias_var' is-defined='yes'/>
> +    <elf-symbol name='main_func' type='func-type' binding='global-binding' visibility='default-visibility' alias='alias_func' is-defined='yes'/>
>    </elf-function-symbols>
>    <elf-variable-symbols>
>      <elf-symbol name='alias_var' size='4' type='object-type' binding='weak-binding' visibility='default-visibility' is-defined='yes'/>
> -    <elf-symbol name='main_var' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
> +    <elf-symbol name='main_var' size='4' type='object-type' binding='global-binding' visibility='default-visibility' alias='alias_var' is-defined='yes'/>
>    </elf-variable-symbols>
>    <abi-instr address-size='64' language='LANG_C'>
> -    <type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='95e97e5e'/>
> -    <function-decl name='main_func' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='8'>
> -      <return type-id='48b5725f'/>
> +    <type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
> +    <function-decl name='main_func' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='8' elf-symbol-id='main_func'>
> +      <return type-id='type-id-2'/>
>      </function-decl>
> -    <var-decl name='alias_var' type-id='95e97e5e' mangled-name='alias_var' visibility='default'/>
> -    <var-decl name='main_var' type-id='95e97e5e' mangled-name='main_var' visibility='default'/>
> -    <type-decl name='void' id='48b5725f'/>
> +    <var-decl name='alias_var' type-id='type-id-1' mangled-name='alias_var' visibility='default' elf-symbol-id='alias_var'/>
> +    <var-decl name='main_var' type-id='type-id-1' mangled-name='main_var' visibility='default' elf-symbol-id='main_var'/>
> +    <type-decl name='void' id='type-id-2'/>
>    </abi-instr>
>  </abi-corpus>
> diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc
> index 6dc2d53f..8da196c8 100644
> --- a/tests/test-read-ctf.cc
> +++ b/tests/test-read-ctf.cc
> @@ -302,6 +302,14 @@ static InOutSpec in_out_specs[] =
>      "data/test-read-ctf/test-linux-module.abi",
>      "output/test-read-ctf/test-linux-module.abi",
>    },
> +  {
> +    "data/test-read-ctf/test-alias.o",
> +    "",
> +    "",
> +    SEQUENCE_TYPE_ID_STYLE,
> +    "data/test-read-ctf/test-alias.o.abi",
> +    "output/test-read-ctf/test-alias.o.abi",
> +  },
>    // This should be the last entry.
>    {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL}
>  };
> -- 
> 2.35.1
>
  

Patch

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 5ec33924..3d9eb9d1 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -640,6 +640,7 @@  test-read-ctf/test9.c		\
 test-read-ctf/test9.o		\
 test-read-ctf/test9.o.abi	\
 test-read-ctf/test-alias.c	\
+test-read-ctf/test-alias.o	\
 test-read-ctf/test-alias.o.abi	\
 test-read-ctf/test-ambiguous-struct-A.c	\
 test-read-ctf/test-ambiguous-struct-A.o	\
diff --git a/tests/data/test-read-ctf/test-alias.o b/tests/data/test-read-ctf/test-alias.o
new file mode 100644
index 0000000000000000000000000000000000000000..18549b793a81754d6bc319eaa0f46179a4686b49
GIT binary patch
literal 1664
zcmbtUv2GJV5S??36TpcQgb-3da-fJK@SbfX1SycgfFpz`5GkW*@4SvrobRl=O|WU8
zLZZtjQ1S_sNc;dL9Tgt{H4@CMcfekZC>UvOX5Y-4_3hj9i+d067d#KxJh%nFSBwI*
z7N&BOwqO~`u)Fj6%kka^`1ZM2;EqjBFfO5&(a)lvN3WtkLD%TC4>^rKfxd!%(MG}v
z;~q>)MSN5cqB&@#NdS*HXy?oih!PD0872EiG6NY$GB?>#8g(al?=T6$@23Oh2jgJu
zr<n|6<>y)G$59}I=s-qsEm6;W;cJ!a-0w;)O<K#8?AAivo2<-q5dw7D?d?jn^JsUg
z(zqt-qF!m%o6Sa}ezQ_lqoK;8fl9QDw*c%rn0G@06u^5=7@KF;^xkB2Ze-r`$KZ`t
zz4h|q(lHh<AVyBMNRQhqtFH>}<<cE&p!Hvj<`&`Wk9p+<bK0{N(&Wq(ZuUZqG`KVe
zzl`{rQ4|w2ez&WbZ_L4gj=07rX@oNZO_Vd~95u~7F!M?CUl)%Mk&g#j1{ifViG9wr
z8fg%uCWs)<L7<ZONC%`2h$PiYpeD6k%kZgPA0&rjn5C$p9)rkKEQRXt_cA$9X8-?v
ztm6REgfBDCYuSX)n{mDuyxzcsu&K|}lseqtM3=vbb-FJuf5-AzKOW<*Nmq9!^)mlE
z6K!;R8;BEDclz$y#w!lae2&|e@3cY64Nk#@A7Gu%c;*h_dT1Nn-{pQ=0rpa>%YS3}
zH?THsE`JY;bf&H8Cd}X2f%d-+P9a8I<}*HTZyNQ<?*En+Xs6LhW0!x@;uvP^rQQGf
U4Em?mYgl*h4pBZ@e*6#qPtYBU=>Px#

literal 0
HcmV?d00001

diff --git a/tests/data/test-read-ctf/test-alias.o.abi b/tests/data/test-read-ctf/test-alias.o.abi
--- a/tests/data/test-read-ctf/test-alias.o.abi
+++ b/tests/data/test-read-ctf/test-alias.o.abi
@@ -1,19 +1,19 @@ 
 <abi-corpus version='2.1' path='data/test-read-ctf/test-alias.o'>
   <elf-function-symbols>
     <elf-symbol name='alias_func' type='func-type' binding='weak-binding' visibility='default-visibility' is-defined='yes'/>
-    <elf-symbol name='main_func' type='func-type' binding='global-binding' visibility='default-visibility' alias='alias_func,main_var,alias_var' is-defined='yes'/>
+    <elf-symbol name='main_func' type='func-type' binding='global-binding' visibility='default-visibility' alias='alias_func' is-defined='yes'/>
   </elf-function-symbols>
   <elf-variable-symbols>
     <elf-symbol name='alias_var' size='4' type='object-type' binding='weak-binding' visibility='default-visibility' is-defined='yes'/>
-    <elf-symbol name='main_var' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+    <elf-symbol name='main_var' size='4' type='object-type' binding='global-binding' visibility='default-visibility' alias='alias_var' is-defined='yes'/>
   </elf-variable-symbols>
   <abi-instr address-size='64' language='LANG_C'>
-    <type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='95e97e5e'/>
-    <function-decl name='main_func' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='8'>
-      <return type-id='48b5725f'/>
+    <type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
+    <function-decl name='main_func' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='8' elf-symbol-id='main_func'>
+      <return type-id='type-id-2'/>
     </function-decl>
-    <var-decl name='alias_var' type-id='95e97e5e' mangled-name='alias_var' visibility='default'/>
-    <var-decl name='main_var' type-id='95e97e5e' mangled-name='main_var' visibility='default'/>
-    <type-decl name='void' id='48b5725f'/>
+    <var-decl name='alias_var' type-id='type-id-1' mangled-name='alias_var' visibility='default' elf-symbol-id='alias_var'/>
+    <var-decl name='main_var' type-id='type-id-1' mangled-name='main_var' visibility='default' elf-symbol-id='main_var'/>
+    <type-decl name='void' id='type-id-2'/>
   </abi-instr>
 </abi-corpus>
diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc
index 6dc2d53f..8da196c8 100644
--- a/tests/test-read-ctf.cc
+++ b/tests/test-read-ctf.cc
@@ -302,6 +302,14 @@  static InOutSpec in_out_specs[] =
     "data/test-read-ctf/test-linux-module.abi",
     "output/test-read-ctf/test-linux-module.abi",
   },
+  {
+    "data/test-read-ctf/test-alias.o",
+    "",
+    "",
+    SEQUENCE_TYPE_ID_STYLE,
+    "data/test-read-ctf/test-alias.o.abi",
+    "output/test-read-ctf/test-alias.o.abi",
+  },
   // This should be the last entry.
   {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL}
 };