diff mbox series

[1/2] tests: Add symtab test suite

Message ID 20200518115014.225405-1-maennich@google.com
State Committed
Headers show
Series [1/2] tests: Add symtab test suite | expand

Commit Message

Matthias Maennich May 18, 2020, 11:50 a.m. UTC
Add (Catch based) test suite to test symbol table reading through the
result persisted in abigail::corpus.

The test cases are created through simple C source files targeting the
desired properties (having an undefined/export function or both). The
Makefile that comes with them recreates the test cases from the sources.

This covers reading sorted_(undefined_)var|fun_symbols as well as the
corresponding symbols maps accessible through the accessors of
abigail::corpus.

	* tests/Makefile.am: add new test runtestsymtab
	* tests/data/Makefile.am: add new test data for runtestsymtab
	* tests/data/test-symtab/basic/empty.c: New test case source.
	* tests/data/test-symtab/basic/link_against_me.c: Likewise.
	* tests/data/test-symtab/basic/no_debug_info.c: Likewise.
	* tests/data/test-symtab/basic/one_function_one_variable.c: Likewise.
	* tests/data/test-symtab/basic/one_function_one_variable_undefined.c: Likewise.
	* tests/data/test-symtab/basic/single_function.c: Likewise.
	* tests/data/test-symtab/basic/single_undefined_function.c: Likewise.
	* tests/data/test-symtab/basic/single_undefined_variable.c: Likewise.
	* tests/data/test-symtab/basic/single_variable.c: Likewise.
	* tests/data/test-symtab/basic/empty.so: New test data.
	* tests/data/test-symtab/basic/link_against_me.so: Likewise.
	* tests/data/test-symtab/basic/no_debug_info.so: Likewise.
	* tests/data/test-symtab/basic/one_function_one_variable.so: Likewise.
	* tests/data/test-symtab/basic/one_function_one_variable_undefined.so: Likewise.
	* tests/data/test-symtab/basic/single_function.so: Likewise.
	* tests/data/test-symtab/basic/single_undefined_function.so: Likewise.
	* tests/data/test-symtab/basic/single_undefined_variable.so: Likewise.
	* tests/data/test-symtab/basic/single_variable.so: Likewise.
	* tests/test-symtab.cc: New test driver.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 tests/Makefile.am                             |   4 +
 tests/data/Makefile.am                        |  22 +-
 tests/data/test-symtab/basic/Makefile         |  19 ++
 tests/data/test-symtab/basic/empty.c          |   1 +
 tests/data/test-symtab/basic/empty.so         | Bin 0 -> 15608 bytes
 .../data/test-symtab/basic/link_against_me.c  |   2 +
 .../data/test-symtab/basic/link_against_me.so | Bin 0 -> 15600 bytes
 tests/data/test-symtab/basic/no_debug_info.c  |   1 +
 tests/data/test-symtab/basic/no_debug_info.so | Bin 0 -> 15360 bytes
 .../basic/one_function_one_variable.c         |   3 +
 .../basic/one_function_one_variable.so        | Bin 0 -> 16624 bytes
 .../one_function_one_variable_undefined.c     |   7 +
 .../one_function_one_variable_undefined.so    | Bin 0 -> 16792 bytes
 .../data/test-symtab/basic/single_function.c  |   1 +
 .../data/test-symtab/basic/single_function.so | Bin 0 -> 16472 bytes
 .../basic/single_undefined_function.c         |   5 +
 .../basic/single_undefined_function.so        | Bin 0 -> 16648 bytes
 .../basic/single_undefined_variable.c         |   7 +
 .../basic/single_undefined_variable.so        | Bin 0 -> 16728 bytes
 .../data/test-symtab/basic/single_variable.c  |   1 +
 .../data/test-symtab/basic/single_variable.so | Bin 0 -> 16280 bytes
 tests/test-symtab.cc                          | 205 ++++++++++++++++++
 22 files changed, 277 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/test-symtab/basic/Makefile
 create mode 100644 tests/data/test-symtab/basic/empty.c
 create mode 100755 tests/data/test-symtab/basic/empty.so
 create mode 100644 tests/data/test-symtab/basic/link_against_me.c
 create mode 100755 tests/data/test-symtab/basic/link_against_me.so
 create mode 100644 tests/data/test-symtab/basic/no_debug_info.c
 create mode 100755 tests/data/test-symtab/basic/no_debug_info.so
 create mode 100644 tests/data/test-symtab/basic/one_function_one_variable.c
 create mode 100755 tests/data/test-symtab/basic/one_function_one_variable.so
 create mode 100644 tests/data/test-symtab/basic/one_function_one_variable_undefined.c
 create mode 100755 tests/data/test-symtab/basic/one_function_one_variable_undefined.so
 create mode 100644 tests/data/test-symtab/basic/single_function.c
 create mode 100755 tests/data/test-symtab/basic/single_function.so
 create mode 100644 tests/data/test-symtab/basic/single_undefined_function.c
 create mode 100755 tests/data/test-symtab/basic/single_undefined_function.so
 create mode 100644 tests/data/test-symtab/basic/single_undefined_variable.c
 create mode 100755 tests/data/test-symtab/basic/single_undefined_variable.so
 create mode 100644 tests/data/test-symtab/basic/single_variable.c
 create mode 100755 tests/data/test-symtab/basic/single_variable.so
 create mode 100644 tests/test-symtab.cc

Comments

Dodji Seketeli May 26, 2020, 2 p.m. UTC | #1
Hello,

Matthias Maennich <maennich@google.com> a écrit:

[...]

> +++ b/tests/test-symtab.cc

> +TEST_CASE("Symtab::Empty", "[symtab, basic]")
> +{
> +  const std::string	     binary = "basic/empty.so";

You see, the main criteria I care about in testing is actually the
capacity for someone who is running the test to debug it (when it fails)
without having to know about the details about a particular testing
framework.  I know other people favor "fancy test outputs" and other
niceties.  I don't really care about those :-) What I care the most
about is to be able to pratically debug and fix stuff because I think
that's what matters ultimately, fixing stuff to make it work.

That means, I should be able to run the test under the debugger, set a
breakpoint in the source code of the test that I am reading and go from
there.

So for instance, in this example, I can't do that.  I can't set a
breakpoint at the line where the variable "binary" is defined, without
knowing about the function that is automatically generated by the macro
TEST_CASE("blah") etc.  To me, that's a real loss of functionality
compared to the other libabigail tests.  I was a bit reluctant to accept
the use of libCatch, because of that.  But I think there is a middle
ground we can strike here.

How about we decide that each test case should be its own function? I.e,
having:

void
test_case1()
{
  //blah.
}

and then

TEST_CASE("Symtab::Empty", "[symtab, basic]")
{
  test_case1();
}


That way, when the "Symtab::Empty" test fails, I can do:

$ gdb --args runtestsymtab
> break test_case1
> run

And then break inside test_case1 and work from there.

Or something along those lines.  This might seem like a minor point to
you today, but when we are gone and someone else has (or maybe us 10
years from now when we forgot everything about today) to fix issues
raised by this test failing, being able to single step from the failing
test will prove invaluable.  So I really care about this.

What do you think?  I am probably missing something.  Maybe you have a better idea?

Cheers,
Dodji Seketeli May 26, 2020, 3:36 p.m. UTC | #2
Dodji Seketeli <dodji@seketeli.org> a écrit:

[...]

> So for instance, in this example, I can't do that.  I can't set a
> breakpoint at the line where the variable "binary" is defined, without
> knowing about the function that is automatically generated by the macro
> TEST_CASE("blah") etc.

Err, I was wrong here. The reason why I couldn't do it was that the test
wasn't being compiled with debug info because I screwed up my
environment, of course.

So, my bad.  I take what I have said back.  Sorry :-(

I'll go ahead with the review in a subsequent message then.

Thanks!

Cheers,
Dodji Seketeli May 27, 2020, 9:06 a.m. UTC | #3
Matthias Maennich <maennich@google.com> a écrit:

[...]

>  tests/data/test-symtab/basic/Makefile         |  19 ++

This file is missing from the ChangeLog part of the commit log.  So I
have added it there.

[...]

> 	* tests/Makefile.am: add new test runtestsymtab
> 	* tests/data/Makefile.am: add new test data for runtestsymtab
> 	* tests/data/test-symtab/basic/empty.c: New test case source.
> 	* tests/data/test-symtab/basic/link_against_me.c: Likewise.
> 	* tests/data/test-symtab/basic/no_debug_info.c: Likewise.
> 	* tests/data/test-symtab/basic/one_function_one_variable.c: Likewise.
> 	* tests/data/test-symtab/basic/one_function_one_variable_undefined.c: Likewise.
> 	* tests/data/test-symtab/basic/single_function.c: Likewise.
> 	* tests/data/test-symtab/basic/single_undefined_function.c: Likewise.
> 	* tests/data/test-symtab/basic/single_undefined_variable.c: Likewise.
> 	* tests/data/test-symtab/basic/single_variable.c: Likewise.
> 	* tests/data/test-symtab/basic/empty.so: New test data.
> 	* tests/data/test-symtab/basic/link_against_me.so: Likewise.
> 	* tests/data/test-symtab/basic/no_debug_info.so: Likewise.
> 	* tests/data/test-symtab/basic/one_function_one_variable.so: Likewise.
> 	* tests/data/test-symtab/basic/one_function_one_variable_undefined.so: Likewise.
> 	* tests/data/test-symtab/basic/single_function.so: Likewise.
> 	* tests/data/test-symtab/basic/single_undefined_function.so: Likewise.
> 	* tests/data/test-symtab/basic/single_undefined_variable.so: Likewise.
> 	* tests/data/test-symtab/basic/single_variable.so: Likewise.
> 	* tests/test-symtab.cc: New test driver.
>
> Signed-off-by: Matthias Maennich <maennich@google.com>
  Acked-by: Dodji Seketeli <dodji@redhat.com>

Applied to master with the change above, thanks!

Cheers,
diff mbox series

Patch

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d8ab9e794a4..c2d4d1dc5d35 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -49,6 +49,7 @@  runtestini			\
 runtestkmiwhitelist		\
 runtestlookupsyms		\
 runtestreadwrite		\
+runtestsymtab			\
 runtesttoolsutils		\
 $(FEDABIPKGDIFF_TEST) 		\
 $(ZIP_ARCHIVE_TESTS)		\
@@ -154,6 +155,9 @@  runtestelfhelpers_LDADD = libcatch.la $(top_builddir)/src/libabigail.la
 runtestcxxcompat_SOURCES = test-cxx-compat.cc
 runtestcxxcompat_LDADD = libcatch.la $(top_builddir)/src/libabigail.la
 
+runtestsymtab_SOURCES = test-symtab.cc
+runtestsymtab_LDADD = libtestutils.la libcatch.la $(top_builddir)/src/libabigail.la
+
 runtestsvg_SOURCES=test-svg.cc
 runtestsvg_LDADD=$(top_builddir)/src/libabigail.la
 
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 7e91f52c44fe..6505de594ab2 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -1700,4 +1700,24 @@  test-ini/test01-equal-in-property-string.abignore \
 test-kmi-whitelist/whitelist-with-single-entry \
 test-kmi-whitelist/whitelist-with-another-single-entry \
 test-kmi-whitelist/whitelist-with-duplicate-entry \
-test-kmi-whitelist/whitelist-with-two-sections
+test-kmi-whitelist/whitelist-with-two-sections \
+\
+test-symtab/basic/Makefile \
+test-symtab/basic/empty.c \
+test-symtab/basic/empty.so \
+test-symtab/basic/link_against_me.c \
+test-symtab/basic/link_against_me.so \
+test-symtab/basic/no_debug_info.c \
+test-symtab/basic/no_debug_info.so \
+test-symtab/basic/one_function_one_variable.c \
+test-symtab/basic/one_function_one_variable.so \
+test-symtab/basic/one_function_one_variable_undefined.c \
+test-symtab/basic/one_function_one_variable_undefined.so \
+test-symtab/basic/single_function.c \
+test-symtab/basic/single_function.so \
+test-symtab/basic/single_undefined_function.c \
+test-symtab/basic/single_undefined_function.so \
+test-symtab/basic/single_undefined_variable.c \
+test-symtab/basic/single_undefined_variable.so \
+test-symtab/basic/single_variable.c \
+test-symtab/basic/single_variable.so
diff --git a/tests/data/test-symtab/basic/Makefile b/tests/data/test-symtab/basic/Makefile
new file mode 100644
index 000000000000..c84d128a4e28
--- /dev/null
+++ b/tests/data/test-symtab/basic/Makefile
@@ -0,0 +1,19 @@ 
+srcs = $(wildcard *.c)
+libs = $(srcs:.c=.so)
+
+flags = -fPIC
+
+all:	$(libs)
+
+clean:
+	rm $(libs)
+
+no_debug_info.so: no_debug_info.c Makefile
+	$(CC) $< -shared $(flags) -o $@
+
+link_against_me.so: link_against_me.c
+	$(CC) $< -shared $(flags) -o $@
+
+%.so: %.c Makefile link_against_me.so
+	$(CC) $< -shared $(flags) -g -o $@ link_against_me.so
+
diff --git a/tests/data/test-symtab/basic/empty.c b/tests/data/test-symtab/basic/empty.c
new file mode 100644
index 000000000000..5bb380ba0db8
--- /dev/null
+++ b/tests/data/test-symtab/basic/empty.c
@@ -0,0 +1 @@ 
+// empty!
diff --git a/tests/data/test-symtab/basic/empty.so b/tests/data/test-symtab/basic/empty.so
new file mode 100755
index 0000000000000000000000000000000000000000..28a54747116d9aa30b02192080e09300835c6716
GIT binary patch
literal 15608
zcmeHOUuYaf7@y=Co7T3mw%TaLu2O9a-X@J{k_u@r&7W>1X=_bE!Lsb#ZSD^4PuSg~
zIejn?gqBk5lk`EM`rtpL_#(chRQg<f5Ck8BScsq!1tlW%{J!1!UH0}iT7B?ohP(ad
z`#UqgncbO(`CcENoM>-r6DSFBL@<|nAdsY_Vs$`Ph@`}j=%i=2*yY=9SW~ss788L8
zRLHp8MhB}TAEoFLDD>>-x2Lf)70rJ(DEa~#_PdWv=k>sT{zx;u#(}APC@K8fNydIx
zq~8_k2YOoCgLZNdD%`%`2M)j`LiYwz0qWb5?1ejCmfO460{G65AIDg4eDkuOpcp3m
z?4&<W)A5sM#h*J4XRZzmTpzxZ8r@;!+n?O`em|)M+vCsty_N|w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K&*{QSnnx$fJy&g194e0vN2H>Er}U$;r#9<!dm_T{bX@LNAl>w5T=<Qn~>
zh4X;4sF3*G>&OS!k&BGuxn6Z<hQ29lX(FaqGBcbg;!-|IwqoXrm9$kfvtGq<O{+R5
zGL_P7(e~`DKG@$s7;nV+BL&lP9IIy9^rfna8OJKwX0}=?)yO5pnPllTnc_QVniFS6
zrpC?jlVhCCGWPPxk*O1-<V~3@5Sm%HV&<)KmUCJ-lJJ`r=JCl>$3`a2Qxg*}j!&D@
zBgZDkDMoW{i=QA9p9J%FsWZ)4HbM`+utYtFKEOotsFf?8t>?;BJzXsnv&lkM_*~v{
z^Fq(o%H$bP&k?#~7cCYF-5-ZOTlDl?#S^+`&(V_+6}p`dunUX=*a98u6u~Odr=EQ|
z1~ou?fzZ>gD|DK>63qw6>~u9pnL<v?I{LRFK6mh5-`F-#k#uh)U^Hik)5(6Py&rDa
zXFzdo!M1^O1i}tch0h}J$9@DlCk?q>dKK34lB7IElw-qxQC2{4-jU{h4Ahw#^yk>{
z$NmP2^G>w?I5(XkU+x#qTaA5CeiwI<E?lDcy-munKlV$|$mca0Uc40X$G!?0#Tz`R
z74c8W20=dycb@9e{^TP5*r!2pPDGgK_<0}U@dJOMNlQti_UN~?66dMHdmZKn=V{~*
zM(x3aE|70m$RFo}3%szYz%Jm{c*x%*1<yU&$2kIdmdK~XIN%2yUm;%}Km2jtSfX2>
zTr~f=_JBX=RZ@lhMM~QC1{CX5N*m*W|GT6J`(r=smj1Ad`h)*~Dr|%PYpFn^t>e#a
zh07<zuuPgaRPcYgAqgt*2j%q{=RY9>zVi?M?Aus-A=_p2UryY^q}xY--~n8DePiq)
fcd_DUo6`9S9hJ%mODD#7{{fk&yciBj^{D?}#aZM}

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/link_against_me.c b/tests/data/test-symtab/basic/link_against_me.c
new file mode 100644
index 000000000000..42d6a46bd23d
--- /dev/null
+++ b/tests/data/test-symtab/basic/link_against_me.c
@@ -0,0 +1,2 @@ 
+int undefined_variable =1;
+void undefined_function() { }
diff --git a/tests/data/test-symtab/basic/link_against_me.so b/tests/data/test-symtab/basic/link_against_me.so
new file mode 100755
index 0000000000000000000000000000000000000000..33c8b5d62cd639f4cb96ff2b363326fbf1818668
GIT binary patch
literal 15600
zcmeHOU1%It6uz5H>{inxt$)#qT_u)O>~xLQrb_Il`ROQ4jWK}=mgyur$*%5C*_~)o
z1p}qhQiSM(_@eYdMD)QQ5Jh~jM0`@vHz^2FEL89(B9#i-^_-dW?aodnB0h-7y=3Ox
z^WF2Ed+)h-ckX8HeR^pBa8oR%kmBlI#ag<<N77QTa+hRCq*bq4PxnrBt!LX@FIts5
zD20$p{Bj*FY%O|Nwn&p8QO>aEGRb60N$*~huZRj6<XuK(3x;p7aBri0Me2J^BzR3^
z#=J%0Eea2ERO}%WzFV)2+|FKh5FxvKSV6Kar_pn6#>*!?wbn266ZVkcJxDxm=if~T
z`<T?XR$LaOe~<_d*LxLRak};$m{2M8&KoaZZEk)3```aK{$A>_lh@g&xGmg$9%trB
z`#MxYje28G*oQklEq?XrmAfe$nT82XMwHyP2G0G8vgi7v@GRk*Xf|JvfUF~((*#``
zsU(?ZP39bDENiAvDq0oSF1wbctoz1Ctc+83W^xtRDUXi~<V!_o+@8!kepz&hH8p2j
z)48IZ&mDEtY%$}I;$*DH?Q+iJ)}iUy;*^^!6}fVnzcT+Y&sL<}CqnpJf_J7p8im|X
z(3ki4I*$p*2I+hNm#OO&tpso$bEJy_9CHz6TIvYs2<Qmt2<Qmt2<Qmt2<Qmt2>iDq
zU>^HEVV-LFVTV%Y@sHf5>gVRMj}uF^Mpp0qhKj1Ud`tKCEosWVPPyqt7?{uYea+lw
zTh6lBebK#|+`Yhga<{&^+`eUjZI?un{o9`Xo$SZlcF8=sVxIYNk9p=|+>Cu<esRgY
ziX4oHgG6<Cx_!%FoxjjmpdvN9W5PVvcOz%bljq!4^Hkscq?|ugtya%x>Gny>5b3c)
zs2B3PC#i6PIE#m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;m96-%yT%oJyh$=O^!vpttlo|d&MS!HDA
zi^TM$TUJKd$=eJn!wZ0MB<~tCC07})Ge>tG6lFMB34b<26lgxh9|zwOdGco$a#K`q
z$z_jJo$cDnn5<NkL6f0C1Kc>F|Dnd~4SvSU@}TxS!*h-QA0AB2L51>sjO<r>=7WD&
zGLYS3kM#i74{*~<8D4{ckLM#K))`zceWYsZ9;`Rggt2e%@f?N3I)_ZW#6E(_B!zv0
zkLN8U>JPUc^^XykebP6WpYS~<@><{`!}0UKckBG5@F3w1ZlFURq=I1mc+NwH;|(3s
z4)O6^gZvN`i$uMEXF`0e8z8YhgnhXG{9NPqBmOEWmLj`Eg$VO`e1m+fLm;05Q6%~e
z_&8<w*^TkVIvnQ*!}ic2pCfL2fRA;}3I1SEf}O9`b>J^i0nZ)OkM$4EXW|?t`VAh&
zf!{T8|G~#PX_<D5a!Pvl`VD-@SE(q-S81_L`4aP7&{}`Mf0GJ=d_3Pfg<t#qBM!iW
zzjrCa7~0>J_Di~ikAC~8Ul;N$KcI{27juTZ1pZb4BH5NxP}b(2U*z3K#o?$l;2J`^
n=|cMv7oOi}yGNAU>79P&Bq|a-r1FX-lD|#PCoc&PBFz62zM2mb

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/no_debug_info.c b/tests/data/test-symtab/basic/no_debug_info.c
new file mode 100644
index 000000000000..5bb380ba0db8
--- /dev/null
+++ b/tests/data/test-symtab/basic/no_debug_info.c
@@ -0,0 +1 @@ 
+// empty!
diff --git a/tests/data/test-symtab/basic/no_debug_info.so b/tests/data/test-symtab/basic/no_debug_info.so
new file mode 100755
index 0000000000000000000000000000000000000000..827c1eee3e4e8f326af7e360ea444627ee59bee6
GIT binary patch
literal 15360
zcmeHOPiz%M7@yZirA45kAXSX45e*nwY6U4Kg;)BA#k56hiJC|@+rDl4lJ|$aw~Z|(
z(%5Jqgvg0t;z7BH#)B8VT7n@aUc`%fF^z!)6E!taQ$6tfzTNNlx^KEQgoCG<^zAp_
z@B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test-symtab/basic/one_function_one_variable.c b/tests/data/test-symtab/basic/one_function_one_variable.c
new file mode 100644
index 000000000000..f31122a88fb8
--- /dev/null
+++ b/tests/data/test-symtab/basic/one_function_one_variable.c
@@ -0,0 +1,3 @@ 
+void exported_function(){}
+
+int exported_variable;
diff --git a/tests/data/test-symtab/basic/one_function_one_variable.so b/tests/data/test-symtab/basic/one_function_one_variable.so
new file mode 100755
index 0000000000000000000000000000000000000000..51d918c7ec9be6e5a900bcccc5f0964486d76cb4
GIT binary patch
literal 16624
zcmeHOZ)hCH6`#G;*-~VmWIJi4IIXuq4tB|{WJQUk7+I&kJ{!w%RS8mv+3elz-7Vbh
ziM>5rN(vP<DK;h`_d{Ds3!x3c$(Q;=`=#_l5{FQlFKM8(B~VOBz$s~~(z>{`_4U1-
zd3$@SJ-1LOCCs4P_h;Vk&CHvbojKjiSLRPIBou{FQrU5aQl_74G9u&pgkXSV*f{Hf
z=V#bMzHL`4Ya92p$Rx^yUo0bu)<TZbq^J^6%15>DQbRB#&3^{;Wg!v`<90yahRzK(
zj<?g7M0wW)C0qi`5Vt9Cn*vAltgt8A&E5KS#CndSgBUu*)r=_GVmkYwSMYhw7lU?D
zJIS6X;l2Pktml84DC|q3yiRf15bYyM;lXn6hmQ)M6K7V~*yTsBKJpjm>j!_9{QlvI
ztE;!(U;i`K1)Gokj5uDuhoLDNNL=p?l~z_hI&j5T#5@*2r^V<W?V!hY#n~$z^d->m
zVf)xn1{g>b&lTYJ!YIEj0=3i6g@<93sx`-`d#39d1~X1BFB%2QwMur~v)tvy*-Fi^
zmd#wn;(75oMt;pSine1`?B^_It*zEv&ng(jhLiW~n$yypH(lFzCd#LAOXF-y)bElQ
zm!!Wg^aB|VBt6MDr??*b1Y<+#R!A>~uAj9P(qo@fx)ah<>?luC837pq837pq837pq
z837pq837rA|E~ySFMiyey^{R>Fk{&lUiT8sce5AY>b?<FvibOLA**@t19<iw$N={m
zaK%kB$i6uFYs9{od=JUQ9q$2f_YLI1T~G67-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pI4<I9qr+vbJz>{4RPx6m|K^v;Smf<;C2Ry}rTQT-yV6c2)PHIN@
zM*<CJ&=wQX8zJ7$5RV1nFzT0ZWcywR{CNSi$WYKI{x==)?+g5?e}n(H1ODI<4#f9U
zI7Q391DU9cw)29({~`<)wx}XMNQ1eH86uq><;+h-hv7Pth7XMg8dvy!puXn_{v5!K
dHl(Xm5Ep}Tg@`-HSp2Kw+yeKP;S>?szW}b0nQj08

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/one_function_one_variable_undefined.c b/tests/data/test-symtab/basic/one_function_one_variable_undefined.c
new file mode 100644
index 000000000000..53ff5d82c5f8
--- /dev/null
+++ b/tests/data/test-symtab/basic/one_function_one_variable_undefined.c
@@ -0,0 +1,7 @@ 
+extern int undefined_variable;
+void undefined_function(int);
+
+
+static void local_function(){
+	undefined_function(undefined_variable);
+}
diff --git a/tests/data/test-symtab/basic/one_function_one_variable_undefined.so b/tests/data/test-symtab/basic/one_function_one_variable_undefined.so
new file mode 100755
index 0000000000000000000000000000000000000000..fc2356c2aa0af88bad9f3c0f88837bebd5a53575
GIT binary patch
literal 16792
zcmeHOYit}>6~43UO`NX1cIq^Bnv_hzK`z4U#Ch0G;$;2Ih9+q+jtZ1$GP^tbP<Lm`
z?rd$hG+2s?ltzUJq^jZ}L4|-H{NM*aKtkXuRY3@(mS5o|S*Vp<@p6Tzj1XDQnYrJ1
zc05KA5+J0x^31vCyXU))Gk50R>%I5W)8}R)iXsrA;*?<RVz+~&WJ2$886lApBVq^L
z-y<HhZQC}IHpOnrL`Wg?<uYPyEp@*<Agct4bcXFLRVGtV?Yk?#E>%b`ZyTkJBprj1
zQ>}7MmbWe?co8yVURv_fk_UNH+C#QG+1hpFdX8`g0kY451ti;YxcHWpv*W6*y6r+c
zVGjx3hl$7ayxRb`&&u+)^2<+T`yk;SE_WAQQM%4txFmk?-7B{rdEd*w_|>gFCx3sV
z=h<%@&RylYustr;?>5Ykp&DTP!7XrZPmq0)@O$a<hf4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CHr$~ke4R4|RZBAKbzMUr|>g?a;FMy639if$IDn@P1~=BtS7
znM}=i3L2d*GZ3dn2fRZ67R2*;o)bqT+kXzS&zGy5M!P5<w|tl8$lza*5lE~DFn`8;
z8ySpHgy;C+FUbhxx1=GLORuoIuE0o>B8>9}AM*=HtRu+84xEQKq)Fkt!N)uVa#<St
z>yPqhC4WNNVVwa9JLdEE3hf8Zzo~JZunuy+yYl;sae_?j;P?MygnId^<hfGvAn;j-
z%=q{znE;9Uf)5??2_GNlks*HuqLe5X@F#tIj3ba(kHOyG{&~sA^AoDHl(J8%5Ptr1
zl)(N2AM-fKPk|^U+70+~6yZ4t`Ulp@IH&8khYtBA;&yrXm=~t_#i9T^N88YWf0Gip
z@1T6lA8`&E=bh1R@bDb+#O3ybk9p>8+J()b-x2N|e8}%mikB}^()6GsRjERN2l;(U
z@bcA^W2s6$?EHM_KcWcRp#GTG^>4xFvb^C{QW%rwZW8$KcM&H7KBO~G^BIwPL1yUB
z7d$Y2LlHm5X;&qYm$lyDw_T+~KgRaIl>D@p9ANuy0LGMu4)I+G%@OY1Usi+w#{BJE
zlKkJgOeX@qSK{6CnqC=lv~}5Wc^u&`iT;4^Cx0LC>>Y-4|LCwIzm0-qqEEHwib4Fg
MQHRj!BluMDPaKW4n*aa+

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/single_function.c b/tests/data/test-symtab/basic/single_function.c
new file mode 100644
index 000000000000..8ac09016eb4d
--- /dev/null
+++ b/tests/data/test-symtab/basic/single_function.c
@@ -0,0 +1 @@ 
+void exported_function(){}
diff --git a/tests/data/test-symtab/basic/single_function.so b/tests/data/test-symtab/basic/single_function.so
new file mode 100755
index 0000000000000000000000000000000000000000..9b7e45d6ab0f03d602ff2ac50be3539bf909ace6
GIT binary patch
literal 16472
zcmeHOZ)_Y#6@PmhCr<60owNa`Db0dhlp=2JxM|`va&wOV<PybcFt$WdqwU_^-rY)f
zd(rJ)W48!Sii%Q2mCP5YRFDFyQ0ND!kSY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<sNZo3Z@`KOW+PagHo9RKkIQ}<yf(1VEssn@`H1!;wAPTjNgveVS_O}kpm
z*hTQUis@EBFRnX?45-%ty<t^N5`yjrt6!{odb#d_?pbSir5gacRS~JK6cNH)010v)
zSaKcxnKhix$P;<Q=5WFTJ@2}p<BhN3%|w}%Z<Y~aI%OOsg0-Deo$F>k->{xxu4+3L
z*D=)20RJy*v@WH!pjbwR^D3VQ9FO@8Rzn>j9XI?3t_>Ogw5Tv;Jg*yhoyi`iu|jKA
z#`8SQbVC?YyZGpZ>tlYiXHiDJ8PDruro0|T6Tgs;XvrZ%z8TN+KGW;MINpD5e;M`U
zlh@<ndriFG;xkh`f5CgWgVzL(Y3wx_cMo5Pwa@Dfrty3;&(w_Jv!X$!KSh1C#QQ_}
zjmFRG7pD9@f_=o}r+JR>oPW@SrJ&=2WfI3fhl(hk*F#Ld#6UqgZWcd}6`ITW{_^)V
zK4%)YXP)WT5IYjV^ZM!vJs4QnF5o&m%fE#R8av!RufzBpFQ3=txEaUyfqs*u_!-aZ
zwN2brOhxmroeSfceiv0yJY<FKWI%bG3uzb+<9~pPD4ys0F@a~hIG*{}u|hW7e=Qqm
zv_5!hD_VYn49SFfsABx5LrG9!Jky&f=6ck0Q8<kIjoZG}2mg!!=Aup$Y=561BgoGL
zp1!e0OT7JeQ5lz!{hvQ%`*#FB9_Q2{@&fSVfP`0WD@wy>H?#uS68P7|z@>R6gC8Cb
kJg(^d!1q1^higXyuE`AvWsId2U?P6+bO2CefEWw^2I-V<qyPW_

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/single_undefined_function.c b/tests/data/test-symtab/basic/single_undefined_function.c
new file mode 100644
index 000000000000..484d6a5c6943
--- /dev/null
+++ b/tests/data/test-symtab/basic/single_undefined_function.c
@@ -0,0 +1,5 @@ 
+void undefined_function();
+
+static void local_function() {
+  undefined_function();
+}
diff --git a/tests/data/test-symtab/basic/single_undefined_function.so b/tests/data/test-symtab/basic/single_undefined_function.so
new file mode 100755
index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M1_hPF3;omOQVv|qYxBT{09>ZiAewe

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/single_undefined_variable.c b/tests/data/test-symtab/basic/single_undefined_variable.c
new file mode 100644
index 000000000000..b0602c2d4e6a
--- /dev/null
+++ b/tests/data/test-symtab/basic/single_undefined_variable.c
@@ -0,0 +1,7 @@ 
+extern int undefined_variable;
+
+static void other_local_function(int variable) { (void)variable; }
+
+static void local_function(){
+	other_local_function(undefined_variable);
+}
diff --git a/tests/data/test-symtab/basic/single_undefined_variable.so b/tests/data/test-symtab/basic/single_undefined_variable.so
new file mode 100755
index 0000000000000000000000000000000000000000..7188667cc6d6495bd7712e0f31ec5ed3f75b8737
GIT binary patch
literal 16728
zcmeHOU2Ggz6~43MO`Q5Sf5mB9Wm2W3MR@F_X%i<nS;w)nF8RYGDy5Cav%BNn5xcWy
zXEw205QeB#qo~Mz0Q!(3!~+5zXdghTcuE!2g2Y3K5VSAIiYN-AKoAO~3d-`GnR_;~
zv*S?lz>hRno;mk?=jYyg?wvb#y!U=-;_zfjQ3NMd>=VRg`U4~*1p|9z1|%bPi#534
zC+_uiJ8p~Ga>u2RsgQoDj5KLWK1#RBDlug_!M;n4jFB||-lRX5EYq;vD#%KDpitV^
zN?(`dU6hpVQcxqid1*H<?U>F;eWsm(TfdG}&)wu8hHeXB!PIXPu;cG}1wXGzg$Vt)
zgqgD4r(j3*{IH3`J}t{zDK0O|_A%w~P`Mj$skjauJt=<aY`J;p%Bz3B@q<51+1oEa
z`P9kRG7t&U=Zp9cn<k;C#VAv|<8W$E9DWk`T3pdYb<(0B@rF^XR2{?h%$jEy!k9X7
z#3)!bt7yBPRXcHHyj*px6K1Y#1+sXFk)Jn>S=%wo_A{2KI|U1jRWMGQHQTo>+s@|<
zvuN6m>lqbGcdJ2VcwF*0x+XhnPL4aqUz7MiCa`0i`FHjQIE@KvE2rfUE{CQsx*Ec%
zPdQx+;XKwzb|ZxQ&oLV$G>JeGfg}P+1d<3O5lAACL?D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Dn=Tr^??>!4X~#4&jYi#z&qVBb{lYXFZ|0er
z5&MiRkm;`=52t8-iV%j|&+8$k{5{1!qV1>mCfRfRg(fv6r7xCnirQ2EhV6NM#q>hh
z7<q0t!_Of@YXk0IUWf5H+o(SCOkaX+U&x-<YjgBqAhBM+-R2p81p*p7Tt2Vs_#E>L
zH4cf}&34=mPeVp3Y|rbzcd)CP(nA4h-r1h%cOVJdi;Pqq4k(Xvi8kBA_OC(^w&(T0
zfV5}5s6F#PLWXp>{#quGXe-#ua0E)Y)4GT-souod{=p^^WZ0hRCBU2yt4>OXQNK~$
z%PZKQmWDLG!YOM18wjHq>ED$0pAQ?y=mzVsh!WWH_5gb-B8rxE19HNm?R-nxzq^7x
z`ytwVc0;<~qR(ffWjS!^Jwrp1#{-Wmnjg6Dk!_|$T7V;cjSC9cwpgtN9%sLCBrs6_
Hh5bJPU|+b4

literal 0
HcmV?d00001

diff --git a/tests/data/test-symtab/basic/single_variable.c b/tests/data/test-symtab/basic/single_variable.c
new file mode 100644
index 000000000000..620e156dccbc
--- /dev/null
+++ b/tests/data/test-symtab/basic/single_variable.c
@@ -0,0 +1 @@ 
+int exported_variable;
diff --git a/tests/data/test-symtab/basic/single_variable.so b/tests/data/test-symtab/basic/single_variable.so
new file mode 100755
index 0000000000000000000000000000000000000000..6ba3f4343c69b87a8ec280b6cc59b3db7fd33d8d
GIT binary patch
literal 16280
zcmeHOU1%It6uz5jH0`#DZT+cM><DSC=uXmDn^Z}=F-^LarmbxX3d%6MJG&X!oh>u7
zHc`+(5fl;oBz+LnzF5TvUj)S$i=}Vk&zn9-6qPC}5mYKl*K_8cGnt*874^Xv@1=Xs
z&pqF{_nv!a=7!$$<kZ3Go=iq?(Zn8sQvMpL$y39bF=Bw^#hB=W`ev~?v|Y8*)WI!l
zQpHq|U+kk7n@CPl9uiY-M_kySj$kNySVxq{!ZeP%3QQLbX}`FqoxY5Yp`0VixE|0U
z?lj>}6OQQ-vS-?dPM~1_;TX^XmINJ?TER551>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eOQDp|G8lR%F&c4-L5X+&`a(I1iTdU3ngi<2XJH
zSe!rO`P{Sww{o%QVZBl@p6MBAisMC|Y=<S~eM;JBK8$|_8sd2V?rtJH+a>WVzX}Z6
z@c8w-Y|*>mIS$fFh&O=2{>hxxg7MoTjbzXk3sc;m%!dtBO_M`Ct^_`5dm%-KkP6}N
zMIly__>Z71sYCNu2v6H6@{qLsybJzA!jD8q$t3aL5uVH=>&y<xz7uIA!}vIjp1qju
ydxT%41-l8_?tmZf2i{lseDm7J;3B_EN=5F78WSR%t<v#l@!$*P7fGTziT@Mgfijo?

literal 0
HcmV?d00001

diff --git a/tests/test-symtab.cc b/tests/test-symtab.cc
new file mode 100644
index 000000000000..62f8998af5d0
--- /dev/null
+++ b/tests/test-symtab.cc
@@ -0,0 +1,205 @@ 
+// -*- Mode: C++ -*-
+//
+// Copyright (C) 2020 Google, 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 2, 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: Matthias Maennich
+
+/// @file
+///
+/// This program tests symtab invariants through abg-corpus.
+
+#include <iostream>
+#include <limits>
+#include <vector>
+
+#include "abg-corpus.h"
+#include "abg-dwarf-reader.h"
+#include "abg-ir.h"
+#include "lib/catch.hpp"
+#include "test-utils.h"
+
+using namespace abigail;
+
+using dwarf_reader::create_read_context;
+using dwarf_reader::read_context_sptr;
+using dwarf_reader::read_corpus_from_elf;
+using ir::environment;
+using ir::environment_sptr;
+
+static const std::string test_data_dir =
+    std::string(abigail::tests::get_src_dir()) + "/tests/data/test-symtab/";
+
+dwarf_reader::status
+read_corpus(const std::string path, corpus_sptr& result)
+{
+  const std::string& absolute_path = test_data_dir + path;
+
+  environment_sptr	    env(new environment);
+  const std::vector<char**> debug_info_root_paths;
+  read_context_sptr	    ctxt =
+      create_read_context(absolute_path, debug_info_root_paths, env.get());
+
+  dwarf_reader::status status = dwarf_reader::STATUS_UNKNOWN;
+  result = read_corpus_from_elf(*ctxt, status);
+
+  REQUIRE(status != dwarf_reader::STATUS_UNKNOWN);
+  return status;
+}
+
+TEST_CASE("Symtab::Empty", "[symtab, basic]")
+{
+  const std::string	     binary = "basic/empty.so";
+  corpus_sptr		     corpus_ptr;
+  const dwarf_reader::status status = read_corpus(binary, corpus_ptr);
+  REQUIRE(corpus_ptr);
+
+  REQUIRE((status & dwarf_reader::STATUS_OK));
+
+  // TODO: Those two assertions are currently not met. Empty symtabs are
+  //       currently treated like the error case.
+  // REQUIRE((status & dwarf_reader::STATUS_OK));
+  // REQUIRE((status & dwarf_reader::STATUS_NO_SYMBOLS_FOUND));
+}
+
+TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]")
+{
+  const std::string	     binary = "basic/no_debug_info.so";
+  corpus_sptr		     corpus_ptr;
+  const dwarf_reader::status status = read_corpus(binary, corpus_ptr);
+  REQUIRE(corpus_ptr);
+
+  REQUIRE(status
+	  == (dwarf_reader::STATUS_OK
+	      | dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND));
+}
+
+// this value indicates in the following helper method, that we do not want to
+// assert for this particular value. In other words, N is a placeholder for an
+// arbitrary value.
+#define N std::numeric_limits<size_t>::max()
+
+corpus_sptr
+assert_symbol_count(const std::string& path,
+		    size_t	       function_symbols = 0,
+		    size_t	       variable_symbols = 0,
+		    size_t	       undefined_function_symbols = 0,
+		    size_t	       undefined_variable_symbols = 0)
+{
+  corpus_sptr		     corpus_ptr;
+  const dwarf_reader::status status = read_corpus(path, corpus_ptr);
+  REQUIRE(corpus_ptr);
+
+  REQUIRE(status == dwarf_reader::STATUS_OK);
+  const corpus& corpus = *corpus_ptr;
+
+  if (function_symbols != N)
+    {
+      CHECK(corpus.get_sorted_fun_symbols().size() == function_symbols);
+      CHECK(corpus.get_fun_symbol_map().size() == function_symbols);
+      CHECK(corpus.get_fun_symbol_map_sptr()->size() == function_symbols);
+    }
+  if (variable_symbols != N)
+    {
+      CHECK(corpus.get_sorted_var_symbols().size() == variable_symbols);
+      CHECK(corpus.get_var_symbol_map().size() == variable_symbols);
+      CHECK(corpus.get_var_symbol_map_sptr()->size() == variable_symbols);
+    }
+  if (undefined_variable_symbols != N)
+    {
+      CHECK(corpus.get_sorted_undefined_fun_symbols().size()
+	    == undefined_function_symbols);
+      CHECK(corpus.get_undefined_fun_symbol_map().size()
+	    == undefined_function_symbols);
+      CHECK(corpus.get_undefined_fun_symbol_map_sptr()->size()
+	    == undefined_function_symbols);
+    }
+  if (undefined_function_symbols != N)
+    {
+      CHECK(corpus.get_sorted_undefined_var_symbols().size()
+	    == undefined_variable_symbols);
+      CHECK(corpus.get_undefined_var_symbol_map().size()
+	    == undefined_variable_symbols);
+      CHECK(corpus.get_undefined_var_symbol_map_sptr()->size()
+	    == undefined_variable_symbols);
+    }
+
+  return corpus_ptr;
+}
+
+TEST_CASE("Symtab::SimpleSymtabs", "[symtab, basic]")
+{
+  GIVEN("a binary with no exported symbols")
+  {
+    // TODO: should pass, but does currently not as empty tables are treated
+    //       like the error case, but this is an edge case anyway.
+    // assert_symbol_count("empty.so");
+  }
+
+  GIVEN("a binary with a single exported function")
+  {
+    const std::string	   binary = "basic/single_function.so";
+    const corpus_sptr&	   corpus = assert_symbol_count(binary, 1, 0);
+    const elf_symbol_sptr& symbol =
+	corpus->lookup_function_symbol("exported_function");
+    REQUIRE(symbol);
+    CHECK(!corpus->lookup_variable_symbol("exported_function"));
+    CHECK(symbol == corpus->lookup_function_symbol(*symbol));
+    CHECK(symbol != corpus->lookup_variable_symbol(*symbol));
+  }
+
+  GIVEN("a binary with a single exported variable")
+  {
+    const std::string	   binary = "basic/single_variable.so";
+    const corpus_sptr&	   corpus = assert_symbol_count(binary, 0, 1);
+    const elf_symbol_sptr& symbol =
+	corpus->lookup_variable_symbol("exported_variable");
+    REQUIRE(symbol);
+    CHECK(!corpus->lookup_function_symbol("exported_variable"));
+    CHECK(symbol == corpus->lookup_variable_symbol(*symbol));
+    CHECK(symbol != corpus->lookup_function_symbol(*symbol));
+  }
+
+  GIVEN("a binary with one function and one variable exported")
+  {
+    const std::string  binary = "basic/one_function_one_variable.so";
+    const corpus_sptr& corpus = assert_symbol_count(binary, 1, 1);
+    CHECK(corpus->lookup_function_symbol("exported_function"));
+    CHECK(!corpus->lookup_variable_symbol("exported_function"));
+    CHECK(corpus->lookup_variable_symbol("exported_variable"));
+    CHECK(!corpus->lookup_function_symbol("exported_variable"));
+  }
+
+  GIVEN("a binary with a single undefined function")
+  {
+    const std::string  binary = "basic/single_undefined_function.so";
+    const corpus_sptr& corpus = assert_symbol_count(binary, 0, 0, 1, 0);
+  }
+
+  GIVEN("a binary with a single undefined variable")
+  {
+    const std::string  binary = "basic/single_undefined_variable.so";
+    const corpus_sptr& corpus = assert_symbol_count(binary, 0, 0, 0, 1);
+  }
+
+  GIVEN("a binary with one function and one variable undefined")
+  {
+    const std::string  binary = "basic/one_function_one_variable_undefined.so";
+    const corpus_sptr& corpus = assert_symbol_count(binary, 0, 0, 1, 1);
+  }
+}