From 1596bfac04ec4ea200c37a851ebf7ded44db5807 Mon Sep 17 00:00:00 2001 From: Jason Hiser <jdhiser@gmail.com> Date: Fri, 27 Jul 2018 16:14:36 +0000 Subject: [PATCH] added tests, fixed missing (pure virtual destructor?) --- include/ehp.hpp | 3 ++- test/.SConscript.swp | Bin 0 -> 12288 bytes test/SConscript | 28 ++++++++++++++++++++++++++++ test/SConstruct | 8 ++++++++ test/test.cpp | 28 ++++++++++++++++++++++++++++ test/test.sh | 15 +++++++++++++++ 6 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 test/.SConscript.swp create mode 100644 test/SConscript create mode 100644 test/SConstruct create mode 100644 test/test.cpp create mode 100755 test/test.sh diff --git a/include/ehp.hpp b/include/ehp.hpp index 5b45e41..827ce82 100644 --- a/include/ehp.hpp +++ b/include/ehp.hpp @@ -5,6 +5,7 @@ #include <map> #include <memory> #include <set> +#include <vector> namespace EHP @@ -19,7 +20,7 @@ class EHProgramInstruction_t EHProgramInstruction_t() {} EHProgramInstruction_t(const EHProgramInstruction_t&) {} public: - virtual ~EHProgramInstruction_t() =0; + virtual ~EHProgramInstruction_t() {} virtual void print(uint64_t &pc, int64_t caf=1) const=0; virtual bool isNop() const =0; virtual bool isRestoreState() const =0; diff --git a/test/.SConscript.swp b/test/.SConscript.swp new file mode 100644 index 0000000000000000000000000000000000000000..eef29b8ac294ec8ad6a66478367019c3786f5abb GIT binary patch literal 12288 zcmeI2J#W)M7{{M<>rg;+Md&btZMBY@0-}qD5MCNoqzLm;sS@BMm&C|#vd<`8%7TPg z82JFOAZ9)Qd<9@*<`eKT^S6Ddh@nW`B0VSle7@)2p8I8r&cls+{afO4`y!#7BKq3f z+dI2DA+bXAcs$!0SMmRpSWW{+$<b`SdFiO32law(84q(AMM2?4;qcn_z*VwPuHQ?O zVw8uOI%)~-V*_m9I0i~Jakf_I!e(cqntt9mCst42J<duzhYhd+Hoykh02^QfY=8~0 zfdw_7vKBo>?n^rVGrDg5Q|l&IY=8~00XDz}*Z><~18jf|umLu}2H3y?8VGQ~{{?sb zk4_+Y-2eai|NrYG(NFLLd<WmaXYdJp1RubA@D{uQufZ$u61)J<!2#F@3fu%spatGx zuV<hDIjHu22p#|~Y=8~00XDz}*Z><~18jf|umLu(fCg@(NLA*EWrj(if+#X=qN{Qe zl##M@$R_>b#rraO((X4SEu-D8J`i_}b%DwzJoJb`o=)>1wv6h-@wS{x3=w`7h02<Q zku2<WvD3dY=-%1(ny79yasM#r+eoL`wVP!!8C$*G-RnEu8@}*_A)G>uz0ulQrz4#E zNFGm_=V>mSNgT|b`n~YbITeQ8tfMpRMQI|f-eB-o5~D230yV>y%cg14vYcgv#C)%A z>0oo_Dqhd5x(<87WE7QSNqVJvBGo7M8Wrd;^ntueWs`<Y{Wwc=WtoUoKLAl!2Si%X EZ^d%4-2eap literal 0 HcmV?d00001 diff --git a/test/SConscript b/test/SConscript new file mode 100644 index 0000000..4473aa9 --- /dev/null +++ b/test/SConscript @@ -0,0 +1,28 @@ +import os + + + +Import('env') +myenv=env.Clone() + +files="test.cpp" + +cpppath=''' + ../include + ''' + +LIBPATH=''' + ../lib + ''' + +LIBS=''' + ehp + ''' +myenv=myenv.Clone(CPPPATH=Split(cpppath)) +myenv.Append(CXXFLAGS = " -std=c++11 -Wall -Werror -fmax-errors=1 -g ") + +lib=myenv.Program("test.exe", Split(files), LIBPATH=Split(LIBPATH), LIBS=Split(LIBS)) +install=myenv.Install("../lib/", lib) +Default(install) + +Return('install') diff --git a/test/SConstruct b/test/SConstruct new file mode 100644 index 0000000..b5b7b78 --- /dev/null +++ b/test/SConstruct @@ -0,0 +1,8 @@ + + + +env=Environment() +Export('env') +lib=SConscript("SConscript") + +Return('lib') diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 0000000..c23a3cb --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,28 @@ + + +#include <ehp.hpp> +#include <iostream> + +using namespace std; +using namespace EHP; + +void usage(int argc, char* argv[]) +{ + cout<<"Usage: "<<argv[0]<<" <program to print eh info>"<<endl; + exit(1); +} + + +int main(int argc, char* argv[]) +{ + + if(argc!=2) + { + usage(argc,argv); + } + + auto ehp = EHFrameParser_t::factory(argv[1]); + ehp->print(); + + return 0; +} diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..b64713c --- /dev/null +++ b/test/test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +cleanup() +{ + echo "Test failed" + exit 1 +} + +scons || cleanup +./test.exe ./test.exe || cleanup +./test.exe /bin/ls || cleanup +./test.exe /bin/bash || cleanup + +echo "test passed" +exit 0 -- GitLab