Fix UnitTest Compilation and Travis Error.

This commit is contained in:
Phenom 2017-02-20 16:15:31 +01:00
parent cda3c744af
commit 8325c72153
7 changed files with 17 additions and 51 deletions

View File

@ -13,7 +13,7 @@ matrix:
before_install: before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential checkinstall cmake libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libcv-dev libopencv-highgui-dev libhighgui-dev libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev pkg-config protobuf-compiler python-dev qtmobility-dev; fi - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential checkinstall cmake libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libcv-dev libopencv-highgui-dev libhighgui-dev libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev pkg-config protobuf-compiler python-dev qtmobility-dev gdb ; fi
# - if [ $TRAVIS_OS_NAME == osx ]; then xcode-select --install ; fi # - if [ $TRAVIS_OS_NAME == osx ]; then xcode-select --install ; fi

View File

@ -335,38 +335,3 @@ void tearDown(){
} }
bool operator ==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r)
{
if(!(l.signSet == r.signSet)) return false;
if(!(l.keys == r.keys)) return false;
if(l.mGroupFlags != r.mGroupFlags) return false;
if(l.mPublishTs != r.mPublishTs) return false;
if(l.mAuthorId != r.mAuthorId) return false;
if(l.mGroupName != r.mGroupName) return false;
if(l.mGroupId != r.mGroupId) return false;
if(l.mGroupStatus != r.mGroupStatus) return false;
if(l.mPop != r.mPop) return false;
if(l.mMsgCount != r.mMsgCount) return false;
if(l.mSubscribeFlags != r.mSubscribeFlags) return false;
return true;
}
bool operator ==(const RsGxsMsgMetaData& l, const RsGxsMsgMetaData& r)
{
if(!(l.signSet == r.signSet)) return false;
if(l.mGroupId != r.mGroupId) return false;
if(l.mAuthorId != r.mAuthorId) return false;
if(l.mParentId != r.mParentId) return false;
if(l.mOrigMsgId != r.mOrigMsgId) return false;
if(l.mThreadId != r.mThreadId) return false;
if(l.mMsgId != r.mMsgId) return false;
if(l.mMsgName != r.mMsgName) return false;
if(l.mPublishTs != r.mPublishTs) return false;
if(l.mMsgFlags != r.mMsgFlags) return false;
return true;
}

View File

@ -98,7 +98,7 @@ void init_item(RsGxsGrpMetaData* metaGrp)
randString(SHORT_STR, metaGrp->mGroupName); randString(SHORT_STR, metaGrp->mGroupName);
randString(SHORT_STR, metaGrp->mServiceString); randString(SHORT_STR, metaGrp->mServiceString);
init_item(metaGrp->signSet); init_item(metaGrp->signSet);// This is not stored in db.
init_item(metaGrp->keys); init_item(metaGrp->keys);
metaGrp->mPublishTs = rand()%3452; metaGrp->mPublishTs = rand()%3452;
@ -115,9 +115,10 @@ void init_item(RsGxsGrpMetaData* metaGrp)
metaGrp->mGroupStatus = rand()%313; metaGrp->mGroupStatus = rand()%313;
metaGrp->mRecvTS = rand()%313; metaGrp->mRecvTS = rand()%313;
metaGrp->mOriginator = RsPeerId::random() ; metaGrp->mOriginator = RsPeerId::random();
metaGrp->mInternalCircle = RsGxsCircleId::random() ; metaGrp->mInternalCircle = RsGxsCircleId::random();
metaGrp->mHash = RsFileHash::random() ; metaGrp->mHash = RsFileHash::random();
metaGrp->mGrpSize = 0;// This was calculated on db read.
} }
void init_item(RsGxsMsgMetaData* metaMsg) void init_item(RsGxsMsgMetaData* metaMsg)

View File

@ -107,6 +107,11 @@ void test_groupStoreAndRetrieve(){
RsGxsGrpMetaData *l_Meta = mit->second, RsGxsGrpMetaData *l_Meta = mit->second,
*r_Meta = grpMetaR[grpId]; *r_Meta = grpMetaR[grpId];
// assign signSet and mGrpSize
// to right as these values are not stored in db
r_Meta->signSet = l_Meta->signSet;
r_Meta->mGrpSize = l_Meta->mGrpSize;
if(!(*l_Meta == *r_Meta)) if(!(*l_Meta == *r_Meta))
{ {
grpMetaMatch = false; grpMetaMatch = false;

View File

@ -81,6 +81,7 @@ void GxsTestStats::testServiceStatistics()
RsDummyGrp* dgrp2 = new RsDummyGrp(); RsDummyGrp* dgrp2 = new RsDummyGrp();
init(*dgrp1); init(*dgrp1);
init(*dgrp2);
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = 45000; opts.mReqType = 45000;
uint32_t token; uint32_t token;

View File

@ -110,7 +110,7 @@ namespace rs_nxs_test
bool loadReputation(const RsGxsId &id, const std::list<RsPeerId>& peers); bool loadReputation(const RsGxsId &id, const std::list<RsPeerId>& peers);
bool getReputation(const RsGxsId &id, GixsReputation &rep); bool getReputation(const RsGxsId &id, GixsReputation &rep);
virtual RsReputations::ReputationLevel overallReputationLevel(const RsGxsId&) { return RsReputations::REPUTATION_NEUTRAL ; } virtual RsReputations::ReputationLevel overallReputationLevel(const RsGxsId&,uint32_t */*identity_flags*/=NULL) { return RsReputations::REPUTATION_NEUTRAL ; }
private: private:

View File

@ -68,14 +68,11 @@ void init_item(RsTlvSecurityKeySet& ks)
randString(SHORT_STR, ks.groupId); randString(SHORT_STR, ks.groupId);
for(int i=1; i<n; i++) for(int i=1; i<n; i++)
{ {
RsGxsId pub_str; RsTlvPublicRSAKey pub_key;
RsGxsId pri_str; RsTlvPrivateRSAKey pri_key;
pub_str = RsGxsId::random();
pri_str = RsGxsId::random();
RsTlvPublicRSAKey& pub_key = ks.public_keys[pub_str];
RsTlvPrivateRSAKey& pri_key = ks.private_keys[pri_str];
GxsSecurity::generateKeyPair(pub_key, pri_key); GxsSecurity::generateKeyPair(pub_key, pri_key);
ks.public_keys[pub_key.keyId] = pub_key;
ks.private_keys[pri_key.keyId] = pri_key;
} }
} }
@ -95,8 +92,6 @@ bool operator==(const RsTlvSecurityKeySet& l, const RsTlvSecurityKeySet& r)
return true; return true;
} }
bool operator==(const RsTlvPublicRSAKey& sk1, const RsTlvPublicRSAKey& sk2) bool operator==(const RsTlvPublicRSAKey& sk1, const RsTlvPublicRSAKey& sk2)
{ {
@ -209,7 +204,6 @@ void init_item(RsTlvKeySignatureSet &kss)
} }
} }
bool operator==(const RsTlvImage& img1, const RsTlvImage& img2) bool operator==(const RsTlvImage& img1, const RsTlvImage& img2)
{ {
if(img1.image_type != img2.image_type) return false; if(img1.image_type != img2.image_type) return false;