Message ID | 20190510232235.8724-2-paul.elder@ideasonboard.com |
---|---|
State | Rejected |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Fri, May 10, 2019 at 07:22:35PM -0400, Paul Elder wrote: > Add tests to test the the LibLoader class for loading struct > IPAModuleInfo of a given symbol from a .so library. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > This *should* Just Work (TM). > > test/load-so/libfoo.so.32 | Bin 0 -> 15344 bytes > test/load-so/libfoo.so.64 | Bin 0 -> 16320 bytes You should not add binaries, but instead add the source code for these modules, and rules to compile them. Let's put these in test/ipa/ > test/load-so/load-so.cpp | 79 ++++++++++++++++++++++++++++++++++++++ > test/load-so/meson.build | 19 +++++++++ > test/meson.build | 1 + > 5 files changed, 99 insertions(+) > create mode 100755 test/load-so/libfoo.so.32 > create mode 100755 test/load-so/libfoo.so.64 > create mode 100644 test/load-so/load-so.cpp > create mode 100644 test/load-so/meson.build > > diff --git a/test/load-so/libfoo.so.32 b/test/load-so/libfoo.so.32 > new file mode 100755 > index 0000000000000000000000000000000000000000..8633f992f256d3f6fc50e8658caf39d3cf267e54 > GIT binary patch > literal 15344 > zcmeHOZ)_Y#6`%7tjh$TGBsDEGiMkC=nxJNJTGzNlsB8OdC&*3{#}R@EZP&MZzH9Gp > z&F#9_B@#)kNJ$S%E<%C|gdzpOhav=OgrEp$xqwonppZ{Ud`X3Z9ARiG3PdRC@%zp0 > z*lX89fcgQ@ywltF-n=(&X5P&HyPfy>f#JbaDkT)8MOsigyh(^I(D{!<nl538R<T=b > z6I-QT*^?efN7zgO^`tjY^2D#9fVeKHHz34#5jtYBe)ESRKOUjgBt#Z?M_eDQ$UvWg > zo_Gy1k$U<dj=`V84#-5MJA6HKGY_C{j1NIaRQe;(Lwpy|KZi65eX@VIQAT8aG%IO4 > zD8eF!4jmIWKKuRebnd@=Z+`pbSN?eX!QXX#`}!{G=#Tb{OKYFCNsbTvdf?gM%*M8b > zFQ2G)f9V9o6~I0yFu>%L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(KYF3JP3q| > z)mO%f!b<;_fzKkmx;Fund2Y%9uMY(5B@=(ea{}#npCNLKntE=a9g+Vz^J-5!-hYVm > z;Hd*EDNl0?$hx%SeTm3t90jx`902lpg?7AO5qbWrc3DnjZW*6%$n!o%>;#`|7ou>1 > zyj#&uI)NiAW?4jgJ}dG1OS?XxMH?W?*)H!E%I+EP>?@zu<n;@KGswq4JHlsx%Fdw8 > zDm#eMC%+9SI}3$GwyS_V@ib7`@j6a?lm#(Blu*M_+41^L<ny8e)xQ@|Ksy;10}L>e > z@W&#;i$G<U%zKnd9F)IrCG2?LCVoK~CG5Tjp7%<|mG?K94+&lY{Ski*<Wm6cWR4v+ > zU8=TFBzelO134G8<Nb*Fo!7uCTT;gFB#`5v9iIypVYfOiw7r_JlMAJD={5z;a=X7x > z*cleW2fGe75Q7oZH$d4w+vWW*yKlK~G*MM}za<Yh5@^Tw1O?P7lyep<o`l^bob%lR > lLz3g>THsn{n+mRU3Gpk{7z!1;8GO?2>)k@UsVXJx{s9y{&E^0A > > literal 0 > HcmV?d00001 > > diff --git a/test/load-so/libfoo.so.64 b/test/load-so/libfoo.so.64 > new file mode 100755 > index 0000000000000000000000000000000000000000..adaef585ec27dce37a505f93780134fb787c4e67 > GIT binary patch > literal 16320 > zcmeHOU2Ggz6~4P`H=Edroi;5dsg!BtKvSg~lMvS-O|$;Z202LywgiZ1GWLwUo9<7v > zGj8n?z#;-_RY8$J0*UvkNIcO#RDHoAC`Cd-sRSYqfGk2K2LVkUK<SH@bLO6Jc4s`U > zA_S;{xz^5i&v(x`_s-cnckg=d`TFSiSUQzbC>iyfV(IyA&E%zFc|a-zc{QLm)Aez+ > z%hzpdHm$4OmqwrxzuZSVYl|GkBQhi)+L`uU8f;9(@UH>>SnPnUb`OziHmCKo&xP^X > zjF$6)uuBuoc0FR(BX+=L=?|FIZu~LwI0x844EAbT0sVU-?)mpTo9mrVXoV<39|*h8 > zksXioK?}luR{Gm0F8AgBfFk<$w}U$4aGf|ksownSt=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5e)Xr*mvfMW8bjHJ^;8#ZLNiU > zw3Y%1yjO)i_6tC)K^Q;ufSm8fdtb=GzCr?JNN3UU3$1Lba2xCm*a<F+BKk-CaQ{`Y > z9}>M4u>(Sn?P*nB7r%MpI41ah5v<R$PUCw4srW_QLsY!iZM8SVF2F!jSFrp8zZS92 > zO9K%13pbE~-;UVhb07Ez7z(0a&{rb%*lz*xJqP;H`~R-k<NZ^HXbN^lCLEeYOZ|{4 > ztOEOu@?D`H?f*v+d+hUomtZJ}xPg9yD!exe<`?oB`N5_V)rSoHDe2HD;lLjI#_k8S > z|0UV-+(ZA^Un1XlS>lKLM!$F;zd^RF0(<O3Zyg|#%99#`E9`;4rj}NFl^4}MjfRK- > z*a3e}4XyS@UTYd+-z(#Xy@870Z9?{i@niox@+qx=`xbS-FVq=V>BU`0cTD*O_V_;o > zcnqf%G54UucwYL)I>P_I*iSFqH`Wz?J}`Ew1|{FGtKUIK(h?E<?Q)#`uXqDa<(`J% > H8nyo?p;1&7 > > literal 0 > HcmV?d00001 > > diff --git a/test/load-so/load-so.cpp b/test/load-so/load-so.cpp > new file mode 100644 > index 0000000..e54ac4d > --- /dev/null > +++ b/test/load-so/load-so.cpp > @@ -0,0 +1,79 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * Copyright (C) 2019, Google Inc. > + * > + * load-so.cpp - loading .so tests > + */ > + > +#include <iostream> > + > +#include "lib_loader.h" > + > +#include "test.h" > + > +using namespace std; > +using namespace libcamera; > + > +class LibLoaderTest : public Test > +{ > +protected: > + int init() > + { > + cout << "!!! make sure to run this test from the build directory" << endl; Does it run correctly with 'ninja test' ? > + > + ll32 = new LibLoader("test/load-so/libfoo.so.32"); > + ll64 = new LibLoader("test/load-so/libfoo.so.64"); With the rework of the API in patch 1/2 this will become a new IPAModule(), and I think it should be moved to the run function that will just test .isValid() and verify the contents of the IPAModuleInfo (as the symbol load API will become private). > + > + return 0; > + } > + > + int run_test(LibLoader *ll, const std::string &symbol) > + { > + cout << "running lib loader test: " << symbol << endl; > + int ret = ll->loadIPAModuleInfo(symbol); > + > + bool loaded = ll->isLoaded(); > + > + if (ret < 0 && !loaded) { > + cout << "failed to load" << endl; > + return TestFail; > + } > + > + if ((ret < 0 && loaded) || (ret >= 0 && !loaded)) { > + cout << "CRITICAL: isLoaded() and return value disagree!" << endl; > + return TestFail; > + } > + > + struct LibLoader::IPAModuleInfo info = ll->getIPAModuleInfo(); > + cout << "loaded!" << endl; > + cout << "name = " << info.name << ", version = " << info.version << endl; > + return TestPass; > + } > + > + int run() > + { > + cout << endl > + << "testing 32-bit so: asdf from .rodata, hjkl from .data" << endl; > + run_test(ll32, "asdf"); > + run_test(ll32, "hjkl"); > + > + cout << endl > + << "testing 64-bit so: asdf from .rodata, hjkl from .data" << endl; > + run_test(ll64, "asdf"); > + run_test(ll64, "hjkl"); > + > + return TestPass; > + } > + > + void cleanup() > + { > + delete ll32; > + delete ll64; > + } > + > +private: > + LibLoader *ll32; > + LibLoader *ll64; > +}; > + > +TEST_REGISTER(LibLoaderTest) > diff --git a/test/load-so/meson.build b/test/load-so/meson.build > new file mode 100644 > index 0000000..376665b > --- /dev/null > +++ b/test/load-so/meson.build > @@ -0,0 +1,19 @@ > +load_so_test = [ > + ['load-so', 'load-so.cpp'], > +] > + > +foreach t : load_so_test > + exe = executable(t[0], t[1], > + link_with : test_libraries, > + include_directories : test_includes_internal) > + > + test(t[0], exe, suite: 'load-so', is_parallel: false) > +endforeach > + > +configure_file(input : 'libfoo.so.32', > + output : 'libfoo.so.32', > + command: ['cp', '@INPUT@', '@OUTPUT@']) > + > +configure_file(input : 'libfoo.so.64', > + output : 'libfoo.so.64', > + command: ['cp', '@INPUT@', '@OUTPUT@']) > diff --git a/test/meson.build b/test/meson.build > index d501f2b..a5937c2 100644 > --- a/test/meson.build > +++ b/test/meson.build > @@ -1,6 +1,7 @@ > subdir('libtest') > > subdir('camera') > +subdir('load-so') > subdir('media_device') > subdir('pipeline') > subdir('v4l2_device')
diff --git a/test/load-so/libfoo.so.32 b/test/load-so/libfoo.so.32 new file mode 100755 index 0000000000000000000000000000000000000000..8633f992f256d3f6fc50e8658caf39d3cf267e54 GIT binary patch literal 15344 zcmeHOZ)_Y#6`%7tjh$TGBsDEGiMkC=nxJNJTGzNlsB8OdC&*3{#}R@EZP&MZzH9Gp z&F#9_B@#)kNJ$S%E<%C|gdzpOhav=OgrEp$xqwonppZ{Ud`X3Z9ARiG3PdRC@%zp0 z*lX89fcgQ@ywltF-n=(&X5P&HyPfy>f#JbaDkT)8MOsigyh(^I(D{!<nl538R<T=b z6I-QT*^?efN7zgO^`tjY^2D#9fVeKHHz34#5jtYBe)ESRKOUjgBt#Z?M_eDQ$UvWg zo_Gy1k$U<dj=`V84#-5MJA6HKGY_C{j1NIaRQe;(Lwpy|KZi65eX@VIQAT8aG%IO4 zD8eF!4jmIWKKuRebnd@=Z+`pbSN?eX!QXX#`}!{G=#Tb{OKYFCNsbTvdf?gM%*M8b zFQ2G)f9V9o6~I0yFu>%L0J;S@n2>jXXB!F(FdVA_1B?wkxLJrE&@Cb(J_Tx77zZkD z7War_kcFY-HdL@D%6`QTLZ=$qwy+P5jo7YN^(Klz=vBu?`b&Pr8*|1>UZh)FW9OzF zJ726grQ)-mZ~`|k3Qs*<5_#VjlhtA+%!^WSJZA>J*)4{K5BBxj51aeUN0#_b_DeL$ zICGTIuSq<GQWc}%{$eX<B8<y66^nPW&Pm7wuCW%-mY5n=Brig~1LMC*iphGL6cc=l z6cuihV&XEeU(W@pK}SGGKu17FKu17FKu17FKu17FKu6%eJOW2&7h4vF(8*Kvzu}d- zHv4v?(K!8T*wnZ(d$Hwsz40>NY8&VIjznmj&)`@fd*d2R8|QE0ke_D(p|-7~o}XX- zEnGw4sh@onzUQ9L;)QDNIUXOo6mG9Qw-~i`_p!6rXBXR#u*prY*XP1rV!l3iVHf=^ zoRjsBqdu&TCVk8<Ht)Ig+O4Lu_1FGzf9f~Cz7@9DzIdB1uZ9~itiwkdSK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?d00001 diff --git a/test/load-so/libfoo.so.64 b/test/load-so/libfoo.so.64 new file mode 100755 index 0000000000000000000000000000000000000000..adaef585ec27dce37a505f93780134fb787c4e67 GIT binary patch literal 16320 zcmeHOU2Ggz6~4P`H=Edroi;5dsg!BtKvSg~lMvS-O|$;Z202LywgiZ1GWLwUo9<7v zGj8n?z#;-_RY8$J0*UvkNIcO#RDHoAC`Cd-sRSYqfGk2K2LVkUK<SH@bLO6Jc4s`U zA_S;{xz^5i&v(x`_s-cnckg=d`TFSiSUQzbC>iyfV(IyA&E%zFc|a-zc{QLm)Aez+ z%hzpdHm$4OmqwrxzuZSVYl|GkBQhi)+L`uU8f;9(@UH>>SnPnUb`OziHmCKo&xP^X zjF$6)uuBuoc0FR(BX+=L=?|FIZu~LwI0x844EAbT0sVU-?)mpTo9mrVXoV<39|*h8 zksXioK?}luR{Gm0F8AgBfFk<$w}U$4aGf|ksownSt=+|r-}N22mdP)@<Gyj{!f$Wz zSh$_X#deI@A(cg)M74=tOYSQj+g87S>3aY7E-@EZc)UhT!!&UZ$MD>T5yS7_fFC1% zPmI1v+{3C<wQtvr`$XqUgxl3)DxcRx8+S-$l3v@@wxDzH$~0#ywW{fQR^2mAWuBZk zW!g^NnJu}VQ=d3BT&`7}32UnC=(hM4b9&w~XG&G8Tzc72mTS+b;)NH=YNl3G7we^} zH>1j>sp*_s%k`@h<0prP&4amvxx@b0^i)jKd%=IYaP0zBF(2l3mNqMuR-Uv6&xy!% zbAIW@^CSGSI56^>z;gik)^W{aE{K_0Y2oqcaocJO4`0mRZQ(KZnZMt{`|ApmRC@A0 z`14HPzm}705`iQFNd%GzBoRm=kVGJfKoWuf#|RWI|0P>^wf#2-lq!64*-JNW7B2rh zdp!t6<M1D;sj>G@bnV)mry9#eZojkAptAQTB+p!hLE*}=dwt~VO8cJ~j@<ViCHGa* zVfULGD_y%6S@*gi>0k5p55LW@Z>?}`EmK&!Te!A*ypXz4cz4a)K@LX6LAJ3n)3tk~ zX}@^vt7N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 b/test/load-so/load-so.cpp @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * load-so.cpp - loading .so tests + */ + +#include <iostream> + +#include "lib_loader.h" + +#include "test.h" + +using namespace std; +using namespace libcamera; + +class LibLoaderTest : public Test +{ +protected: + int init() + { + cout << "!!! make sure to run this test from the build directory" << endl; + + ll32 = new LibLoader("test/load-so/libfoo.so.32"); + ll64 = new LibLoader("test/load-so/libfoo.so.64"); + + return 0; + } + + int run_test(LibLoader *ll, const std::string &symbol) + { + cout << "running lib loader test: " << symbol << endl; + int ret = ll->loadIPAModuleInfo(symbol); + + bool loaded = ll->isLoaded(); + + if (ret < 0 && !loaded) { + cout << "failed to load" << endl; + return TestFail; + } + + if ((ret < 0 && loaded) || (ret >= 0 && !loaded)) { + cout << "CRITICAL: isLoaded() and return value disagree!" << endl; + return TestFail; + } + + struct LibLoader::IPAModuleInfo info = ll->getIPAModuleInfo(); + cout << "loaded!" << endl; + cout << "name = " << info.name << ", version = " << info.version << endl; + return TestPass; + } + + int run() + { + cout << endl + << "testing 32-bit so: asdf from .rodata, hjkl from .data" << endl; + run_test(ll32, "asdf"); + run_test(ll32, "hjkl"); + + cout << endl + << "testing 64-bit so: asdf from .rodata, hjkl from .data" << endl; + run_test(ll64, "asdf"); + run_test(ll64, "hjkl"); + + return TestPass; + } + + void cleanup() + { + delete ll32; + delete ll64; + } + +private: + LibLoader *ll32; + LibLoader *ll64; +}; + +TEST_REGISTER(LibLoaderTest) diff --git a/test/load-so/meson.build b/test/load-so/meson.build new file mode 100644 index 0000000..376665b --- /dev/null +++ b/test/load-so/meson.build @@ -0,0 +1,19 @@ +load_so_test = [ + ['load-so', 'load-so.cpp'], +] + +foreach t : load_so_test + exe = executable(t[0], t[1], + link_with : test_libraries, + include_directories : test_includes_internal) + + test(t[0], exe, suite: 'load-so', is_parallel: false) +endforeach + +configure_file(input : 'libfoo.so.32', + output : 'libfoo.so.32', + command: ['cp', '@INPUT@', '@OUTPUT@']) + +configure_file(input : 'libfoo.so.64', + output : 'libfoo.so.64', + command: ['cp', '@INPUT@', '@OUTPUT@']) diff --git a/test/meson.build b/test/meson.build index d501f2b..a5937c2 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,6 +1,7 @@ subdir('libtest') subdir('camera') +subdir('load-so') subdir('media_device') subdir('pipeline') subdir('v4l2_device')
Add tests to test the the LibLoader class for loading struct IPAModuleInfo of a given symbol from a .so library. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- This *should* Just Work (TM). test/load-so/libfoo.so.32 | Bin 0 -> 15344 bytes test/load-so/libfoo.so.64 | Bin 0 -> 16320 bytes test/load-so/load-so.cpp | 79 ++++++++++++++++++++++++++++++++++++++ test/load-so/meson.build | 19 +++++++++ test/meson.build | 1 + 5 files changed, 99 insertions(+) create mode 100755 test/load-so/libfoo.so.32 create mode 100755 test/load-so/libfoo.so.64 create mode 100644 test/load-so/load-so.cpp create mode 100644 test/load-so/meson.build