diff --git a/ChangeLog b/ChangeLog index 82cf85df..3e3204cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,121 @@ +2006-04-06 Tatsuhiro Tsujikawa + + To print ETA: + + * src/TorrentDownloadEngine.cc (afterEachIteration): Added download + completion handling when dealing with + TorrentMan::isPartialDownloadingMode() == true. + * src/TorrentDownloadEngine.h (onPartialDownloadingCompletes): + New function. + * src/TorrentConsoleDownloadEngine.h (startup): New variable. + (sessionDownloadLength): New variable. + (avgSpeed): New variable. + (eta): New variable. + * src/TorrentConsoleDownloadEngine.cc (initStatistics): Initialized + new variables: eta, avgSpeed, startup. + (calculateSpeed): Calculate average speed and ETA. + (printStatistics): Added ETA. + + * src/Util.h (secfmt): New function. + * src/Util.cc (secfmt): New function. + +2006-04-05 Tatsuhiro Tsujikawa + + To detect "keep alive" flooding: + + * src/PeerInteractionCommand.h (keepAliveCount): New variable + * src/PeerInteractionCommand.cc (Constructor): Initialized new + variable: keepAliveCount. + (detectMessageFlooding): Added "keep alive" flooding detection. + (receiveMessage): Increase keepAliveCount when "keep alive" message + received. + + To add the ability to download only specified files in multi-file + torrent: + + * src/BitfieldMan.h (filterBitfield): New variable. + (filterEnabled): New variable. + (setFilterBit): New function. + (enableFilter): New function. + (disableFilter): New function. + (isFilterEnabled): New function. + (getFilteredTotalLength): New function. + (getCompletedLength): New function. + * src/BitfieldMan.cc (Constructor): Initialized new variable: + filterBitfield, filterEnabled. + (CopyConstructor): Added filterBitfield and filterEnabled. + (operator==): Added filterBitfield and filterEnabled. + (Destructor): Added filterBitfield. + (getMissingIndex): Use filterBitfield. + (getMissingUnusedIndex): Use filterBitfield. + (getFirstMissingUnusedIndex): Use filterBitfield. + (getFirstMissingUnusedIndex): Use filterBitfield. + (getAllMissingIndexes): Use filterBitfield. + (countMissingBlock): Use filterBitfield. + (countBlock): Use filterBitfield. + (setBitInternal): Added new argument on. + (setUseBit): Use setBitInternal. + (unsetUseBit): Use setBitInternal. + (setBit): Use setBitInternal. + (unsetBit): Use setBitInternal. + (isAllBitSet): Use filterBitfield. + (setFilterBit): New function. + (addFilter): New function. + (enableFilter): New function. + (disableFilter): New function. + (clearFilter): New function. + (isFilterEnabled): New function. + (getFilteredTotalLength): New function. + (getCompletedLength): New function. + + * src/TorrentMan.h [FileEntry](Constructor): Updated signature. + Initalized newly added variables. + [FileEntry](offset): New variable. + [FileEntry](extracted): New variable. + [FileEntry](requested): New variable. + (readFileEntry): New function. + (option): New variable. + (splitMultiFile): Removed const qualifier. + (fixFilename): Removed const qualifier. + (readFileEntryFromMetaInfoFile): New function. + (finishPartialDownloadingMode): New function. + (isPartialDownloadingMode): New function. + (setFileEntriesToDownload): New function. + (getCompletedLength): New function. + (getPartialTotalLength): New function. + * src/TorrentMan.cc (readFileEntry): New function. + (setup): Use readFileEntry. If no-preallocation option is specified, + use DefaultDiskWriter. + (readFileEntryFromMetaInfoFile): New function. + (fixFilename): Removed const qualifier. + (splitMultiFile): Removed const qualifier. + (setFileEntriesToDownload): New function. + (isPartialDownloadingMode): New function. + (finishPartialDownloadingMode): New function. + (getCompletedLength): New function. + (getPartialTotalLength): New function. + + * src/TorrentConsoleDownloadEngine.h (partialDownloadLengthDiff): + New variable. + (partialTotalLength): New variable. + (downloadLength): New variable. + (totalLength): New variable. + * src/TorrentConsoleDownloadEngine.cc (onPartialDownloadingCompletes): + Added log. + (initStatistics): Initialized new variables: partialDownloadLengthDiff, + partialTotalLength, downloadLength, totalLength. + (calculate): Calculate downloadLength and totalLength. + + * src/prefs.h :New definition PREF_NO_PREALLOCATION + + * src/main.cc (addCommand): Changed argument signature. + (main): Added new variable: args. Added new option "torrent-show-files" + "no-preallocation". Usage is not updated yet. + +2006-04-02 Tatsuhiro Tsujikawa + + * src/PeerMessage.cc (setBitfield): Fixed invalid memory de-allocation. + 2006-04-01 Tatsuhiro Tsujikawa Attempt to add the ability to listing file entries in a .torrent file. diff --git a/README b/README index 97edbe87..69ae313d 100644 --- a/README +++ b/README @@ -31,10 +31,10 @@ The executable is aria2c in src directory. 4. Dependency ------------- -In order to enable HTTPS support, you need GNUTLS or OpenSSL. -In order to enable BitTorrent support, you need GNUTLS+GCRYPT or OpenSSL. +In order to enable HTTPS support, you need GNU TLS or OpenSSL. +In order to enable BitTorrent support, you need GNU TLS+libgcrypt or OpenSSL. -GNUTLS has precedence over OpenSSL if both libraries are installed. +GNU TLS has precedence over OpenSSL if both libraries are installed. If you prefer OpenSSL, run configure with "--without-gnutls". 5. BitTorrrent diff --git a/src/BitfieldMan.cc b/src/BitfieldMan.cc index 7eda3fe2..b7e9aed6 100644 --- a/src/BitfieldMan.cc +++ b/src/BitfieldMan.cc @@ -23,7 +23,8 @@ #include BitfieldMan::BitfieldMan(int blockLength, long long int totalLength) - :blockLength(blockLength), totalLength(totalLength) { + :blockLength(blockLength), totalLength(totalLength), filterBitfield(0), + filterEnabled(false) { if(blockLength > 0 && totalLength > 0) { blocks = totalLength/blockLength+(totalLength%blockLength ? 1 : 0); bitfieldLength = blocks/8+(blocks%8 ? 1 : 0); @@ -43,11 +44,21 @@ BitfieldMan::BitfieldMan(const BitfieldMan& bitfieldMan) { useBitfield = new unsigned char[bitfieldLength]; memcpy(bitfield, bitfieldMan.bitfield, bitfieldLength); memcpy(useBitfield, bitfieldMan.useBitfield, bitfieldLength); + filterEnabled = bitfieldMan.filterEnabled; + if(bitfieldMan.filterBitfield) { + filterBitfield = new unsigned char[bitfieldLength]; + memcpy(filterBitfield, bitfieldMan.filterBitfield, bitfieldLength); + } else { + filterBitfield = 0; + } } BitfieldMan::~BitfieldMan() { delete [] bitfield; delete [] useBitfield; + if(filterBitfield) { + delete [] filterBitfield; + } } BitfieldMan& BitfieldMan::operator=(const BitfieldMan& bitfieldMan) { @@ -64,6 +75,17 @@ BitfieldMan& BitfieldMan::operator=(const BitfieldMan& bitfieldMan) { bitfieldLength = bitfieldMan.bitfieldLength; memcpy(bitfield, bitfieldMan.bitfield, bitfieldLength); memcpy(useBitfield, bitfieldMan.useBitfield, bitfieldLength); + filterEnabled = bitfieldMan.filterEnabled; + if(bitfieldLength != bitfieldMan.bitfieldLength) { + delete [] filterBitfield; + filterBitfield = 0; + } + if(bitfieldMan.filterBitfield) { + if(!filterBitfield) { + filterBitfield = new unsigned char[bitfieldLength]; + } + memcpy(filterBitfield, bitfieldMan.filterBitfield, bitfieldLength); + } } return *this; } @@ -108,6 +130,9 @@ int BitfieldMan::getMissingIndex(const unsigned char* peerBitfield, int length) unsigned char* tempBitfield = new unsigned char[bitfieldLength]; for(int i = 0; i < bitfieldLength; i++) { tempBitfield[i] = peerBitfield[i] & ~bitfield[i]; + if(filterEnabled) { + tempBitfield[i] &= filterBitfield[i]; + } } int max = countSetBit(tempBitfield, bitfieldLength); int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); @@ -122,6 +147,9 @@ int BitfieldMan::getMissingUnusedIndex(const unsigned char* peerBitfield, int le unsigned char* tempBitfield = new unsigned char[bitfieldLength]; for(int i = 0; i < bitfieldLength; i++) { tempBitfield[i] = peerBitfield[i] & ~bitfield[i] & ~useBitfield[i]; + if(filterEnabled) { + tempBitfield[i] &= filterBitfield[i]; + } } int max = countSetBit(tempBitfield, bitfieldLength); int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max); @@ -135,6 +163,9 @@ int BitfieldMan::getFirstMissingUnusedIndex(const unsigned char* peerBitfield, i } for(int i = 0; i < bitfieldLength; i++) { unsigned char bit = peerBitfield[i] & ~bitfield[i] & ~useBitfield[i]; + if(filterEnabled) { + bit &= filterBitfield[i]; + } for(int bs = 7; bs >= 0 && i*8+7-bs < blocks; bs--) { unsigned char mask = 1 << bs; if(bit & mask) { @@ -148,6 +179,9 @@ int BitfieldMan::getFirstMissingUnusedIndex(const unsigned char* peerBitfield, i int BitfieldMan::getFirstMissingUnusedIndex() const { for(int i = 0; i < bitfieldLength; i++) { unsigned char bit = ~bitfield[i] & ~useBitfield[i]; + if(filterEnabled) { + bit &= filterBitfield[i]; + } for(int bs = 7; bs >= 0 && i*8+7-bs < blocks; bs--) { unsigned char mask = 1 << bs; if(bit & mask) { @@ -162,6 +196,9 @@ BlockIndexes BitfieldMan::getAllMissingIndexes() const { BlockIndexes missingIndexes; for(int i = 0; i < bitfieldLength; i++) { unsigned char bit = ~bitfield[i]; + if(filterEnabled) { + bit &= filterBitfield[i]; + } for(int bs = 7; bs >= 0 && i*8+7-bs < blocks; bs--) { unsigned char mask = 1 << bs; if(bit & mask) { @@ -173,47 +210,75 @@ BlockIndexes BitfieldMan::getAllMissingIndexes() const { } int BitfieldMan::countMissingBlock() const { - return blocks-countSetBit(bitfield, bitfieldLength); + if(filterEnabled) { + unsigned char* temp = new unsigned char[bitfieldLength]; + for(int i = 0; i < bitfieldLength; i++) { + temp[i] = bitfield[i]&filterBitfield[i]; + } + int count = countSetBit(filterBitfield, bitfieldLength)- + countSetBit(temp, bitfieldLength); + delete [] temp; + return count; + } else { + return blocks-countSetBit(bitfield, bitfieldLength); + } +} + +int BitfieldMan::countBlock() const { + if(filterEnabled) { + return countSetBit(filterBitfield, bitfieldLength); + } else { + return blocks; + } +} + +bool BitfieldMan::setBitInternal(unsigned char* bitfield, int index, bool on) { + if(blocks <= index) { return false; } + unsigned char mask = 128 >> index%8; + if(on) { + bitfield[index/8] |= mask; + } else { + bitfield[index/8] &= ~mask; + } + return true; } bool BitfieldMan::setUseBit(int index) { - if(blocks <= index) { return false; } - unsigned char mask = 128 >> index%8; - useBitfield[index/8] |= mask; - return true; + return setBitInternal(useBitfield, index, true); } bool BitfieldMan::unsetUseBit(int index) { - if(blocks <= index) { return false; } - unsigned char mask = 128 >> index%8; - useBitfield[index/8] &= ~mask; - return true; + return setBitInternal(useBitfield, index, false); } bool BitfieldMan::setBit(int index) { - if(blocks <= index) { return false; } - unsigned char mask = 128 >> index%8; - bitfield[index/8] |= mask; - return true; + return setBitInternal(bitfield, index, true); } + bool BitfieldMan::unsetBit(int index) { - if(blocks <= index) { return false; } - unsigned char mask = 128 >> index%8; - bitfield[index/8] &= ~mask; - return true; + return setBitInternal(bitfield, index, false); } bool BitfieldMan::isAllBitSet() const { - for(int i = 0; i < bitfieldLength-1; i++) { - if(bitfield[i] != 0xff) { + if(filterEnabled) { + for(int i = 0; i < bitfieldLength-1; i++) { + if((bitfield[i]&filterBitfield[i]) != filterBitfield[i]) { + return false; + } + } + return true; + } else { + for(int i = 0; i < bitfieldLength-1; i++) { + if(bitfield[i] != 0xff) { + return false; + } + } + unsigned char b = ~((128 >> (blocks-1)%8)-1); + if(bitfield[bitfieldLength-1] != b) { return false; } + return true; } - unsigned char b = ~((128 >> (blocks-1)%8)-1); - if(bitfield[bitfieldLength-1] != b) { - return false; - } - return true; } bool BitfieldMan::isBitSetInternal(const unsigned char* bitfield, int index) const { @@ -248,3 +313,77 @@ void BitfieldMan::setAllBit() { setBit(i); } } + +bool BitfieldMan::setFilterBit(int index) { + return setBitInternal(filterBitfield, index, true); +} + +void BitfieldMan::addFilter(long long int offset, long long int length) { + if(!filterBitfield) { + filterBitfield = new unsigned char[bitfieldLength]; + memset(filterBitfield, 0, bitfieldLength); + } + int startBlock = offset/blockLength; + int endBlock = (offset+length-1)/blockLength; + for(int i = startBlock; i <= endBlock && i < blocks; i++) { + setFilterBit(i); + } +} + +void BitfieldMan::enableFilter() { + filterEnabled = true; +} + +void BitfieldMan::disableFilter() { + filterEnabled = false; +} + +void BitfieldMan::clearFilter() { + if(filterBitfield) { + delete [] filterBitfield; + filterBitfield = 0; + } + filterEnabled = false; +} + +bool BitfieldMan::isFilterEnabled() const { + return filterEnabled; +} + +long long int BitfieldMan::getFilteredTotalLength() const { + if(!filterBitfield) { + return 0; + } + int filteredBlocks = countSetBit(filterBitfield, bitfieldLength); + if(filteredBlocks == 0) { + return 0; + } + if(isBitSetInternal(filterBitfield, blocks-1)) { + return ((long long int)filteredBlocks-1)*blockLength+getLastBlockLength(); + } else { + return ((long long int)filteredBlocks)*blockLength; + } +} + +long long int BitfieldMan::getCompletedLength() const { + unsigned char* temp = new unsigned char[bitfieldLength]; + for(int i = 0; i < bitfieldLength; i++) { + temp[i] = bitfield[i]; + if(filterEnabled) { + temp[i] &= filterBitfield[i]; + } + } + int completedBlocks = countSetBit(temp, bitfieldLength); + long long int completedLength = 0; + if(completedBlocks == 0) { + completedLength = 0; + } else { + if(isBitSetInternal(temp, blocks-1)) { + completedLength = ((long long int)completedBlocks-1)*blockLength+getLastBlockLength(); + } else { + completedLength = ((long long int)completedBlocks)*blockLength; + } + } + delete [] temp; + return completedLength; +} diff --git a/src/BitfieldMan.h b/src/BitfieldMan.h index 3f8165ae..f329a52f 100644 --- a/src/BitfieldMan.h +++ b/src/BitfieldMan.h @@ -33,12 +33,15 @@ private: long long int totalLength; unsigned char* bitfield; unsigned char* useBitfield; + unsigned char* filterBitfield; int bitfieldLength; int blocks; - + bool filterEnabled; int countSetBit(const unsigned char* bitfield, int len) const; int getMissingIndexRandomly(const unsigned char* bitfield, int len, int randMax) const; bool isBitSetInternal(const unsigned char* bitfield, int index) const; + bool setBitInternal(unsigned char* bitfield, int index, bool on); + bool setFilterBit(int index); public: BitfieldMan(int blockLength, long long int totalLength); BitfieldMan(const BitfieldMan& bitfieldMan); @@ -61,11 +64,29 @@ public: } long long int getTotalLength() const { return totalLength; } + /** + * affected by filter + */ int getMissingIndex(const unsigned char* bitfield, int len) const; + /** + * affected by filter + */ int getFirstMissingUnusedIndex(const unsigned char* bitfield, int len) const; + /** + * affected by filter + */ int getFirstMissingUnusedIndex() const; + /** + * affected by filter + */ int getMissingUnusedIndex(const unsigned char* bitfield, int len) const; + /** + * affected by filter + */ BlockIndexes getAllMissingIndexes() const; + /** + * affected by filter + */ int countMissingBlock() const; bool setUseBit(int index); bool unsetUseBit(int index); @@ -76,12 +97,18 @@ public: bool isBitSet(int index) const; bool isUseBitSet(int index) const; + /** + * affected by filter + */ bool isAllBitSet() const; const unsigned char* getBitfield() const { return bitfield; } int getBitfieldLength() const { return bitfieldLength; } - int countBlock() const { return blocks; } + /** + * affected by filter + */ + int countBlock() const; void setBitfield(const unsigned char* bitfield, int bitfieldLength); @@ -90,6 +117,15 @@ public: void addFilter(long long int offset, long long int length); void clearFilter(); + + void enableFilter(); + void disableFilter(); + bool isFilterEnabled() const; + long long int getFilteredTotalLength() const; + /** + * affected by filter + */ + long long int getCompletedLength() const; }; #endif // _D_BITFIELD_MAN_H_ diff --git a/src/PeerInteractionCommand.cc b/src/PeerInteractionCommand.cc index 80dac752..691f9043 100644 --- a/src/PeerInteractionCommand.cc +++ b/src/PeerInteractionCommand.cc @@ -50,6 +50,7 @@ PeerInteractionCommand::PeerInteractionCommand(int cuid, Peer* peer, freqCheckPoint.tv_usec = 0; chokeUnchokeCount = 0; haveCount = 0; + keepAliveCount = 0; } PeerInteractionCommand::~PeerInteractionCommand() { @@ -147,11 +148,13 @@ void PeerInteractionCommand::detectMessageFlooding() { } else { if(Util::difftv(now, freqCheckPoint) >= 5*1000000) { if(chokeUnchokeCount*1.0/(Util::difftv(now, freqCheckPoint)/1000000) >= 0.4 - || haveCount*1.0/(Util::difftv(now, freqCheckPoint)/1000000) >= 20.0) { + || haveCount*1.0/(Util::difftv(now, freqCheckPoint)/1000000) >= 20.0 + || keepAliveCount*1.0/(Util::difftv(now, freqCheckPoint)/1000000) >= 1.0) { throw new DlAbortEx("flooding detected."); } else { chokeUnchokeCount = 0; haveCount = 0; + keepAliveCount = 0; freqCheckPoint = now; } } @@ -220,6 +223,7 @@ void PeerInteractionCommand::receiveMessage() { try { switch(message->getId()) { case PeerMessage::KEEP_ALIVE: + keepAliveCount++; break; case PeerMessage::CHOKE: if(!peer->peerChoking) { diff --git a/src/PeerInteractionCommand.h b/src/PeerInteractionCommand.h index 24e7057e..c3c0123b 100644 --- a/src/PeerInteractionCommand.h +++ b/src/PeerInteractionCommand.h @@ -41,6 +41,7 @@ private: struct timeval freqCheckPoint; int chokeUnchokeCount; int haveCount; + int keepAliveCount; void receiveMessage(); void detectMessageFlooding(); void checkLongTimePeerChoking(); diff --git a/src/PeerMessage.cc b/src/PeerMessage.cc index ddaa3066..65690ced 100644 --- a/src/PeerMessage.cc +++ b/src/PeerMessage.cc @@ -24,7 +24,7 @@ void PeerMessage::setBitfield(const unsigned char* bitfield, int bitfieldLength) { if(this->bitfield != NULL) { - delete [] bitfield; + delete [] this->bitfield; } this->bitfieldLength = bitfieldLength; this->bitfield = new unsigned char[this->bitfieldLength]; @@ -33,7 +33,7 @@ void PeerMessage::setBitfield(const unsigned char* bitfield, int bitfieldLength) void PeerMessage::setBlock(const char* block, int blockLength) { if(this->block != NULL) { - delete [] block; + delete [] this->block; } this->blockLength = blockLength; this->block = new char[this->blockLength]; diff --git a/src/TorrentConsoleDownloadEngine.cc b/src/TorrentConsoleDownloadEngine.cc index 9bf6adb8..8ae62910 100644 --- a/src/TorrentConsoleDownloadEngine.cc +++ b/src/TorrentConsoleDownloadEngine.cc @@ -26,21 +26,26 @@ TorrentConsoleDownloadEngine::TorrentConsoleDownloadEngine() {} TorrentConsoleDownloadEngine::~TorrentConsoleDownloadEngine() {} +void TorrentConsoleDownloadEngine::onPartialDownloadingCompletes() { + printf("Download of specified files has completed. Continue normal download operation.\n"); +} + void TorrentConsoleDownloadEngine::printStatistics() { printf("\r "); printf("\r"); if(torrentMan->downloadComplete()) { printf("Download Completed "); } else { - printf("%s/%sB %d%% DW:%.2f", - Util::llitos(torrentMan->getDownloadLength(), true).c_str(), - Util::llitos(torrentMan->getTotalLength(), true).c_str(), - (torrentMan->getTotalLength() == 0 ? - 0 : (int)((torrentMan->getDownloadLength()*100)/torrentMan->getTotalLength())), - downloadSpeed/1000.0); + printf("%s/%sB %d%% %s D:%.2f", + Util::llitos(downloadLength, true).c_str(), + Util::llitos(totalLength, true).c_str(), + (totalLength == 0 ? + 0 : (int)((downloadLength*100)/totalLength)), + avgSpeed == 0 ? "-" : Util::secfmt(eta).c_str(), + downloadSpeed/1024.0); } - printf(" UP:%.2f(%s) %dpeers", - uploadSpeed/1000.0, + printf(" U:%.2f(%s) %dpeers", + uploadSpeed/1024.0, Util::llitos(torrentMan->getUploadLength(), true).c_str(), torrentMan->connections); fflush(stdout); @@ -52,11 +57,21 @@ void TorrentConsoleDownloadEngine::initStatistics() { lastElapsed = 0; gettimeofday(&cp[0], NULL); gettimeofday(&cp[1], NULL); + gettimeofday(&startup, NULL); sessionDownloadLengthArray[0] = 0; sessionDownloadLengthArray[1] = 0; sessionUploadLengthArray[0] = 0; sessionUploadLengthArray[1] = 0; currentCp = 0; + eta = 0; + avgSpeed = 0; + sessionDownloadLength = 0; + downloadLength = 0; + totalLength = 0; + if(torrentMan->isPartialDownloadingMode()) { + partialDownloadLengthDiff = torrentMan->getDownloadLength()-torrentMan->getCompletedLength(); + partialTotalLength = torrentMan->getPartialTotalLength(); + } } int TorrentConsoleDownloadEngine::calculateSpeed(long long int sessionLength, long long int elapsed) { @@ -74,12 +89,28 @@ void TorrentConsoleDownloadEngine::calculateStatistics() { sessionDownloadLengthArray[1] += torrentMan->getDeltaDownloadLength(); sessionUploadLengthArray[1] += torrentMan->getDeltaUploadLength(); + sessionDownloadLength += torrentMan->getDeltaDownloadLength(); + downloadSpeed = calculateSpeed(sessionDownloadLengthArray[currentCp], elapsed); uploadSpeed = calculateSpeed(sessionUploadLengthArray[currentCp], elapsed); torrentMan->resetDeltaDownloadLength(); torrentMan->resetDeltaUploadLength(); + if(torrentMan->isPartialDownloadingMode()) { + downloadLength = torrentMan->getDownloadLength()-partialDownloadLengthDiff; + totalLength = partialTotalLength; + } else { + downloadLength = torrentMan->getDownloadLength(); + totalLength = torrentMan->getTotalLength(); + } + + avgSpeed = calculateSpeed(sessionDownloadLength, + Util::difftv(now, startup)); + if(avgSpeed != 0) { + eta = (totalLength-downloadLength)/avgSpeed; + } + if(elapsed-lastElapsed >= 1000000) { printStatistics(); lastElapsed = elapsed; diff --git a/src/TorrentConsoleDownloadEngine.h b/src/TorrentConsoleDownloadEngine.h index eb34dff4..0d177e14 100644 --- a/src/TorrentConsoleDownloadEngine.h +++ b/src/TorrentConsoleDownloadEngine.h @@ -39,11 +39,21 @@ private: int downloadSpeed; int uploadSpeed; long long int lastElapsed; + long long int partialDownloadLengthDiff; + long long int partialTotalLength; + struct timeval startup; + long long int sessionDownloadLength; + int avgSpeed; + int eta; + long long int downloadLength; + long long int totalLength; + void printStatistics(); int calculateSpeed(long long int sessionLength, long long int elapsed); protected: void initStatistics(); void calculateStatistics(); + void onPartialDownloadingCompletes(); public: TorrentConsoleDownloadEngine(); ~TorrentConsoleDownloadEngine(); diff --git a/src/TorrentDownloadEngine.cc b/src/TorrentDownloadEngine.cc index 9ab1520a..c2c8c254 100644 --- a/src/TorrentDownloadEngine.cc +++ b/src/TorrentDownloadEngine.cc @@ -35,7 +35,15 @@ void TorrentDownloadEngine::afterEachIteration() { torrentMan->diskWriter->closeFile(); torrentMan->save(); torrentMan->fixFilename(); - filenameFixed = true; + if(torrentMan->isPartialDownloadingMode()) { + torrentMan->finishPartialDownloadingMode(); + onPartialDownloadingCompletes(); + if(torrentMan->downloadComplete()) { + filenameFixed = true; + } + } else { + filenameFixed = true; + } torrentMan->diskWriter->openExistingFile(torrentMan->getTempFilePath()); } } diff --git a/src/TorrentDownloadEngine.h b/src/TorrentDownloadEngine.h index 8bbd7606..b8a8d47b 100644 --- a/src/TorrentDownloadEngine.h +++ b/src/TorrentDownloadEngine.h @@ -31,6 +31,7 @@ private: protected: void onEndOfRun(); void afterEachIteration(); + virtual void onPartialDownloadingCompletes() = 0; public: TorrentDownloadEngine():filenameFixed(false) {} virtual ~TorrentDownloadEngine() {} diff --git a/src/TorrentMan.cc b/src/TorrentMan.cc index 275547aa..04e6cd11 100644 --- a/src/TorrentMan.cc +++ b/src/TorrentMan.cc @@ -29,6 +29,8 @@ #include "File.h" #include "message.h" #include "PreAllocationDiskWriter.h" +#include "DefaultDiskWriter.h" +#include "prefs.h" #include #include #include @@ -295,28 +297,12 @@ bool TorrentMan::downloadComplete() const { return bitfield->isAllBitSet(); } -void TorrentMan::setup(string metaInfoFile) { - peerId = "-A2****-"; - for(int i = 0; i < 12; i++) { - peerId += Util::itos((int)(((double)10)*random()/(RAND_MAX+1.0))); - } - - uploadLength = 0; - downloadLength = 0; - Dictionary* topDic = (Dictionary*)MetaFileUtil::parseMetaFile(metaInfoFile); - const Dictionary* infoDic = (const Dictionary*)topDic->get("info"); - ShaVisitor v; - infoDic->accept(&v); - unsigned char md[20]; - int len; - v.getHash(md, len); - setInfoHash(md); - +void TorrentMan::readFileEntry(const Dictionary* infoDic, const string& defaultName) { Data* topName = (Data*)infoDic->get("name"); if(topName != NULL) { name = topName->toString(); } else { - char* basec = strdup(metaInfoFile.c_str()); + char* basec = strdup(defaultName.c_str()); name = string(basename(basec))+".file"; free(basec); } @@ -328,6 +314,7 @@ void TorrentMan::setup(string metaInfoFile) { totalLength = length->toLLInt(); } else { long long int length = 0; + long long int offset = 0; // multi-file mode setFileMode(MULTI); multiFileTopDir = new Directory(name); @@ -350,11 +337,33 @@ void TorrentMan::setup(string metaInfoFile) { } Data* lastpath = (Data*)paths.back(); filePath.append("/").append(lastpath->toString()); - FileEntry fileEntry(filePath, lengthData->toLLInt()); + FileEntry fileEntry(filePath, lengthData->toLLInt(), offset); multiFileEntries.push_back(fileEntry); + offset += fileEntry.length; } totalLength = length; } +} + +void TorrentMan::setup(string metaInfoFile) { + peerId = "-A2****-"; + for(int i = 0; i < 12; i++) { + peerId += Util::itos((int)(((double)10)*random()/(RAND_MAX+1.0))); + } + + uploadLength = 0; + downloadLength = 0; + Dictionary* topDic = (Dictionary*)MetaFileUtil::parseMetaFile(metaInfoFile); + const Dictionary* infoDic = (const Dictionary*)topDic->get("info"); + ShaVisitor v; + infoDic->accept(&v); + unsigned char md[20]; + int len; + v.getHash(md, len); + setInfoHash(md); + + readFileEntry(infoDic, metaInfoFile); + announce = ((Data*)topDic->get("announce"))->toString(); pieceLength = ((Data*)infoDic->get("piece length"))->toInt(); pieces = totalLength/pieceLength+(totalLength%pieceLength ? 1 : 0); @@ -371,7 +380,11 @@ void TorrentMan::setup(string metaInfoFile) { initBitfield(); delete topDic; - diskWriter = new PreAllocationDiskWriter(totalLength); + if(option->get(PREF_NO_PREALLOCATION) == V_TRUE) { + diskWriter = new DefaultDiskWriter(); + } else { + diskWriter = new PreAllocationDiskWriter(totalLength); + } if(segmentFileExists()) { load(); diskWriter->openExistingFile(getTempFilePath()); @@ -385,6 +398,12 @@ const MultiFileEntries& TorrentMan::getMultiFileEntries() const { return multiFileEntries; } +void TorrentMan::readFileEntryFromMetaInfoFile(const string& metaInfoFile) { + Dictionary* topDic = (Dictionary*)MetaFileUtil::parseMetaFile(metaInfoFile); + const Dictionary* infoDic = (const Dictionary*)topDic->get("info"); + readFileEntry(infoDic, metaInfoFile); +} + string TorrentMan::getName() const { return name; } @@ -498,7 +517,7 @@ void TorrentMan::remove() const { } } -void TorrentMan::fixFilename() const { +void TorrentMan::fixFilename() { if(fileMode == SINGLE) { copySingleFile(); } else { @@ -511,15 +530,18 @@ void TorrentMan::copySingleFile() const { Util::fileCopy(getFilePath(), getTempFilePath()); } -void TorrentMan::splitMultiFile() const { +void TorrentMan::splitMultiFile() { logger->info("creating directories"); multiFileTopDir->createDir(storeDir, true); long long int offset = 0; - for(MultiFileEntries::const_iterator itr = multiFileEntries.begin(); + for(MultiFileEntries::iterator itr = multiFileEntries.begin(); itr != multiFileEntries.end(); itr++) { - string dest = storeDir+"/"+itr->path; - logger->info("writing file %s", dest.c_str()); - Util::rangedFileCopy(dest, getTempFilePath(), offset, itr->length); + if(!itr->extracted && itr->requested) { + string dest = storeDir+"/"+itr->path; + logger->info("writing file %s", dest.c_str()); + Util::rangedFileCopy(dest, getTempFilePath(), offset, itr->length); + itr->extracted = true; + } offset += itr->length; } } @@ -527,3 +549,59 @@ void TorrentMan::splitMultiFile() const { void TorrentMan::deleteTempFile() const { unlink(getTempFilePath().c_str()); } + +// bool TorrentMan::unextractedFileEntryExists() const { +// if(fileMode == SINGLE) { +// return false; +// } +// for(MultiFileEntries::const_iterator itr = multiFileEntries.begin(); +// itr != multiFileEntries.end(); itr++) { +// if(!itr->extracted) { +// return true; +// } +// } +// } + +void TorrentMan::setFileEntriesToDownload(const Strings& filePaths) { + if(fileMode != MULTI) { + throw new DlAbortEx("only multi-mode supports partial downloading mode."); + } + // clear all requested flags in multiFileEntries. + for(MultiFileEntries::iterator itr = multiFileEntries.begin(); + itr != multiFileEntries.end(); itr++) { + itr->requested = false; + } + for(Strings::const_iterator pitr = filePaths.begin(); + pitr != filePaths.end(); pitr++) { + bool found = false; + for(MultiFileEntries::iterator itr = multiFileEntries.begin(); + itr != multiFileEntries.end(); itr++) { + if(*pitr == itr->path) { + itr->requested = true; + found = true; + bitfield->addFilter(itr->offset, itr->length); + break; + } + } + if(!found) { + throw new DlAbortEx("no such file entry <%s>", (*pitr).c_str()); + } + } + bitfield->enableFilter(); +} + +bool TorrentMan::isPartialDownloadingMode() const { + return bitfield->isFilterEnabled(); +} + +void TorrentMan::finishPartialDownloadingMode() { + bitfield->clearFilter(); +} + +long long int TorrentMan::getCompletedLength() const { + return bitfield->getCompletedLength(); +} + +long long int TorrentMan::getPartialTotalLength() const { + return bitfield->getFilteredTotalLength(); +} diff --git a/src/TorrentMan.h b/src/TorrentMan.h index 25b24a86..42affb9b 100644 --- a/src/TorrentMan.h +++ b/src/TorrentMan.h @@ -29,6 +29,8 @@ #include "DiskWriter.h" #include "Piece.h" #include "Directory.h" +#include "Dictionary.h" +#include "Option.h" #include #include #include @@ -48,7 +50,12 @@ class FileEntry { public: string path; long long int length; - FileEntry(string path, long long int length):path(path), length(length) {} + long long int offset; + bool extracted; + bool requested; + FileEntry(string path, long long int length, long long int offset): + path(path), length(length), offset(offset), + extracted(false), requested(true) {} ~FileEntry() {} }; @@ -90,6 +97,7 @@ private: void deleteUsedPiece(const Piece& piece); int deleteUsedPiecesByFillRate(int fillRate, int toDelete); void reduceUsedPieces(int max); + void readFileEntry(const Dictionary* infoDic, const string& defaultName); public: int pieceLength; int pieces; @@ -108,6 +116,7 @@ public: const Logger* logger; DiskWriter* diskWriter; + const Option* option; int getNewCuid() { return ++cuidCounter; } @@ -213,8 +222,8 @@ public: void remove() const; void copySingleFile() const; - void splitMultiFile() const; - void fixFilename() const; + void splitMultiFile(); + void fixFilename(); void deleteTempFile() const; void setPort(int port) { this->port = port; } @@ -223,9 +232,20 @@ public: int countUsedPiece() const { return usedPieces.size(); } int countAdvertisedPiece() const { return haves.size(); } + void readFileEntryFromMetaInfoFile(const string& metaInfoFile); const MultiFileEntries& getMultiFileEntries() const; string getName() const; + //bool unextractedFileEntryExists() const; + + void finishPartialDownloadingMode(); + bool isPartialDownloadingMode() const; + + void setFileEntriesToDownload(const Strings& filePaths); + + long long int getCompletedLength() const; + long long int getPartialTotalLength() const; + enum FILE_MODE { SINGLE, MULTI diff --git a/src/Util.cc b/src/Util.cc index ee7f5693..d6328add 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -258,3 +258,24 @@ bool Util::isPowerOf(int num, int base) { } return false; } + +string Util::secfmt(int sec) { + string str; + if(sec >= 3600) { + str = itos(sec/3600)+"h"; + sec %= 3600; + } + if(sec >= 60) { + int min = sec/60; + if(min < 10) { + str += "0"; + } + str += itos(min)+"m"; + sec %= 60; + } + if(sec < 10) { + str += "0"; + } + str += itos(sec)+"s"; + return str; +} diff --git a/src/Util.h b/src/Util.h index 8375c65b..e738c0ae 100644 --- a/src/Util.h +++ b/src/Util.h @@ -68,6 +68,8 @@ public: static void rangedFileCopy(const string& destFile, const string& src, long long int srcOffset, long long int length); static bool isPowerOf(int num, int base); + + static string secfmt(int sec); }; #endif // _D_UTIL_H_ diff --git a/src/main.cc b/src/main.cc index ca730444..af49abfb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -99,7 +99,7 @@ void torrentHandler(int signal) { exit(0); } -void addCommand(int cuid, const char* url, string referer, Requests& requests) { +void addCommand(int cuid, const string& url, string referer, Requests& requests) { Request* req = new Request(); req->setReferer(referer); if(req->setUrl(url)) { @@ -232,6 +232,7 @@ int main(int argc, char* argv[]) { bool daemonMode = false; string referer; string torrentFile; + Strings args; #ifdef ENABLE_BITTORRENT bool followTorrent = true; #else @@ -281,6 +282,8 @@ int main(int argc, char* argv[]) { #ifdef ENABLE_BITTORRENT { "torrent-file", required_argument, &lopt, 15 }, { "follow-torrent", required_argument, &lopt, 16 }, + { "torrent-show-files", no_argument, &lopt, 17 }, + { "no-preallocation", no_argument, &lopt, 18 }, #endif // ENABLE_BITTORRENT { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, @@ -407,6 +410,13 @@ int main(int argc, char* argv[]) { showUsage(); exit(1); } + break; + case 17: + op->put(PREF_TORRENT_SHOW_FILES, V_TRUE); + break; + case 18: + op->put(PREF_NO_PREALLOCATION, V_TRUE); + break; } break; } @@ -482,6 +492,11 @@ int main(int argc, char* argv[]) { exit(1); } } + + for(int i = 1; optind+i-1 < argc; i++) { + args.push_back(argv[optind+i-1]); + } + #ifdef HAVE_LIBSSL // for SSL initialization SSL_load_error_strings(); @@ -530,11 +545,14 @@ int main(int argc, char* argv[]) { e->segmentMan->splitter = splitter; Requests requests; - for(int i = 1; optind+i-1 < argc; i++) { + int cuidCounter = 1; + for(Strings::const_iterator itr = args.begin(); itr != args.end(); itr++) { for(int s = 1; s <= split; s++) { - addCommand(split*(i-1)+s, argv[optind+i-1], referer, requests); + addCommand(cuidCounter, *itr, referer, requests); + cuidCounter++; } } + e->run(); if(e->segmentMan->finished()) { @@ -575,26 +593,34 @@ int main(int argc, char* argv[]) { te->torrentMan = new TorrentMan(); te->torrentMan->setStoreDir(dir); te->torrentMan->logger = logger; - te->torrentMan->setup(torrentFile.empty() ? - downloadedTorrentFile : torrentFile); + te->torrentMan->option = op; + string targetTorrentFile = torrentFile.empty() ? + downloadedTorrentFile : torrentFile; if(op->get(PREF_TORRENT_SHOW_FILES) == V_TRUE) { - cout << "File listing:" << endl; + te->torrentMan->readFileEntryFromMetaInfoFile(targetTorrentFile); + cout << "Files:" << endl; switch(te->torrentMan->getFileMode()) { case TorrentMan::SINGLE: - printf("%s %s\nBytes", te->torrentMan->getName().c_str(), + printf("%s %s Bytes\n", te->torrentMan->getName().c_str(), Util::llitos(te->torrentMan->getTotalLength(), true).c_str()); break; case TorrentMan::MULTI: { const MultiFileEntries& entries = te->torrentMan->getMultiFileEntries(); for(MultiFileEntries::const_iterator itr = entries.begin(); itr != entries.end(); itr++) { - printf("%s %s\nBytes", itr->path.c_str(), + printf("%s %s Bytes\n", itr->path.c_str(), Util::llitos(itr->length, true).c_str()); - break; } + break; } } exit(0); + } else { + te->torrentMan->setup(targetTorrentFile); + if(!torrentFile.empty() && !args.empty() && + te->torrentMan->getFileMode() == TorrentMan::MULTI) { + te->torrentMan->setFileEntriesToDownload(args); + } } PeerListenCommand* listenCommand = new PeerListenCommand(te->torrentMan->getNewCuid(), te); diff --git a/src/prefs.h b/src/prefs.h index ae8c57af..dc17ea4f 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -90,5 +90,6 @@ #define PREF_PEER_CONNECTION_TIMEOUT "peer_connection_timeout" // values: true | false #define PREF_TORRENT_SHOW_FILES "torrent_show_files" - +// values: true | false +#define PREF_NO_PREALLOCATION "no_preallocation" #endif // _D_PREFS_H_ diff --git a/test/BitfieldManTest.cc b/test/BitfieldManTest.cc index 018b4e83..38f097ea 100644 --- a/test/BitfieldManTest.cc +++ b/test/BitfieldManTest.cc @@ -10,6 +10,7 @@ class BitfieldManTest:public CppUnit::TestFixture { CPPUNIT_TEST(testGetBlockSize); CPPUNIT_TEST(testGetFirstMissingUnusedIndex); CPPUNIT_TEST(testIsAllBitSet); + CPPUNIT_TEST(testFilter); CPPUNIT_TEST_SUITE_END(); private: @@ -20,6 +21,7 @@ public: void testGetBlockSize(); void testGetFirstMissingUnusedIndex(); void testIsAllBitSet(); + void testFilter(); }; @@ -27,12 +29,12 @@ CPPUNIT_TEST_SUITE_REGISTRATION( BitfieldManTest ); void BitfieldManTest::testGetBlockSize() { BitfieldMan bt1(1024, 1024*10); - CPPUNIT_ASSERT_EQUAL(1024, bt1.getBlockSize(9)); + CPPUNIT_ASSERT_EQUAL(1024, bt1.getBlockLength(9)); BitfieldMan bt2(1024, 1024*10+1); - CPPUNIT_ASSERT_EQUAL(1024, bt2.getBlockSize(9)); - CPPUNIT_ASSERT_EQUAL(1, bt2.getBlockSize(10)); - CPPUNIT_ASSERT_EQUAL(0, bt2.getBlockSize(11)); + CPPUNIT_ASSERT_EQUAL(1024, bt2.getBlockLength(9)); + CPPUNIT_ASSERT_EQUAL(1, bt2.getBlockLength(10)); + CPPUNIT_ASSERT_EQUAL(0, bt2.getBlockLength(11)); } void BitfieldManTest::testGetFirstMissingUnusedIndex() { @@ -69,8 +71,68 @@ void BitfieldManTest::testIsAllBitSet() { } CPPUNIT_ASSERT(!bt1.isAllBitSet()); - for(int i = 0; i < bt1.getBlocks(); i++) { + for(int i = 0; i < bt1.countBlock(); i++) { CPPUNIT_ASSERT(bt1.setBit(i)); } CPPUNIT_ASSERT(bt1.isAllBitSet()); } + +void BitfieldManTest::testFilter() { + // set random seed here in order to get same random numbers. + srandom(100); + BitfieldMan btman(2, 32); + + // test offset=4, length=12 + btman.addFilter(4, 12); + btman.enableFilter(); + unsigned char peerBt[2]; + memset(peerBt, 0xff, sizeof(peerBt)); + + int index; + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(3, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(4, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(2, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(6, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(5, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(7, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(-1, index); + CPPUNIT_ASSERT_EQUAL((long long int)12, btman.getFilteredTotalLength()); + + // test offset=5, length=2 + btman.clearAllBit(); + btman.clearFilter(); + btman.addFilter(5, 2); + btman.enableFilter(); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + btman.setBit(index); + CPPUNIT_ASSERT_EQUAL(3, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + btman.setBit(index); + CPPUNIT_ASSERT_EQUAL(2, index); + index = btman.getMissingUnusedIndex(peerBt, sizeof(peerBt)); + btman.setUseBit(index); + CPPUNIT_ASSERT_EQUAL(-1, index); + CPPUNIT_ASSERT_EQUAL((long long int)4, btman.getFilteredTotalLength()); + CPPUNIT_ASSERT(btman.isAllBitSet()); + + BitfieldMan btman2(2, 31); + btman2.addFilter(0, 31); + btman2.enableFilter(); + CPPUNIT_ASSERT_EQUAL((long long int)31, btman2.getFilteredTotalLength()); +} diff --git a/test/CookieBoxTest.cc b/test/CookieBoxTest.cc index 877ea21a..6c78acb8 100644 --- a/test/CookieBoxTest.cc +++ b/test/CookieBoxTest.cc @@ -61,9 +61,9 @@ void CookieBoxTest::testCriteriaFind() { box.add(c3); box.add(c4); - vector result1 = box.criteriaFind("rednoah.com", "/downloads", false); + Cookies result1 = box.criteriaFind("rednoah.com", "/downloads", false); CPPUNIT_ASSERT_EQUAL(2, (int)result1.size()); - vector::iterator itr = result1.begin(); + Cookies::iterator itr = result1.begin(); CPPUNIT_ASSERT_EQUAL(string("SESSIONID1=1"), (*itr).toString()); itr++; CPPUNIT_ASSERT_EQUAL(string("SESSIONID2=2"), (*itr).toString()); diff --git a/test/Makefile.am b/test/Makefile.am index 60b7a83a..d42fc342 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,6 +17,15 @@ aria2c_SOURCES = AllTest.cc\ PeerMessageUtilTest.cc\ BitfieldManTest.cc\ DefaultDiskWriterTest.cc -aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64 -aria2c_LDFLAGS = ${CPPUNIT_LIBS} -aria2c_LDADD = ../src/libaria2c.a \ No newline at end of file +#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64 +#aria2c_LDFLAGS = ${CPPUNIT_LIBS} + +aria2c_LDADD = ../src/libaria2c.a\ + ${CPPUNIT_LIBS} @LIBGNUTLS_LIBS@\ + @LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ +AM_CPPFLAGS = -Wall\ + ${CPPUNIT_CFLAGS}\ + -I ../src\ + -I../lib -I../intl -I$(top_srcdir)/intl\ + @LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@\ + -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@ diff --git a/test/Makefile.in b/test/Makefile.in index 9632ce12..8b9804f3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -56,20 +56,17 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__EXEEXT_1 = aria2c$(EXEEXT) -am_aria2c_OBJECTS = aria2c-AllTest.$(OBJEXT) \ - aria2c-RequestTest.$(OBJEXT) \ - aria2c-ChunkedEncodingTest.$(OBJEXT) aria2c-FileTest.$(OBJEXT) \ - aria2c-OptionTest.$(OBJEXT) aria2c-Base64Test.$(OBJEXT) \ - aria2c-UtilTest.$(OBJEXT) aria2c-CookieBoxTest.$(OBJEXT) \ - aria2c-DataTest.$(OBJEXT) aria2c-DictionaryTest.$(OBJEXT) \ - aria2c-ListTest.$(OBJEXT) aria2c-MetaFileUtilTest.$(OBJEXT) \ - aria2c-ShaVisitorTest.$(OBJEXT) \ - aria2c-TorrentManTest.$(OBJEXT) \ - aria2c-PeerMessageUtilTest.$(OBJEXT) \ - aria2c-BitfieldManTest.$(OBJEXT) \ - aria2c-DefaultDiskWriterTest.$(OBJEXT) +am_aria2c_OBJECTS = AllTest.$(OBJEXT) RequestTest.$(OBJEXT) \ + ChunkedEncodingTest.$(OBJEXT) FileTest.$(OBJEXT) \ + OptionTest.$(OBJEXT) Base64Test.$(OBJEXT) UtilTest.$(OBJEXT) \ + CookieBoxTest.$(OBJEXT) DataTest.$(OBJEXT) \ + DictionaryTest.$(OBJEXT) ListTest.$(OBJEXT) \ + MetaFileUtilTest.$(OBJEXT) ShaVisitorTest.$(OBJEXT) \ + TorrentManTest.$(OBJEXT) PeerMessageUtilTest.$(OBJEXT) \ + BitfieldManTest.$(OBJEXT) DefaultDiskWriterTest.$(OBJEXT) aria2c_OBJECTS = $(am_aria2c_OBJECTS) -aria2c_DEPENDENCIES = ../src/libaria2c.a +am__DEPENDENCIES_1 = +aria2c_DEPENDENCIES = ../src/libaria2c.a $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -225,9 +222,19 @@ aria2c_SOURCES = AllTest.cc\ BitfieldManTest.cc\ DefaultDiskWriterTest.cc -aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64 -aria2c_LDFLAGS = ${CPPUNIT_LIBS} -aria2c_LDADD = ../src/libaria2c.a +#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64 +#aria2c_LDFLAGS = ${CPPUNIT_LIBS} +aria2c_LDADD = ../src/libaria2c.a\ + ${CPPUNIT_LIBS} @LIBGNUTLS_LIBS@\ + @LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ + +AM_CPPFLAGS = -Wall\ + ${CPPUNIT_CFLAGS}\ + -I ../src\ + -I../lib -I../intl -I$(top_srcdir)/intl\ + @LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@\ + -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@ + all: all-am .SUFFIXES: @@ -274,23 +281,23 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-AllTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-Base64Test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-BitfieldManTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-ChunkedEncodingTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-CookieBoxTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-DataTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-DefaultDiskWriterTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-DictionaryTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-FileTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-ListTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-MetaFileUtilTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-OptionTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-PeerMessageUtilTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-RequestTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-ShaVisitorTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-TorrentManTest.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aria2c-UtilTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AllTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64Test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChunkedEncodingTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CookieBoxTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DataTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultDiskWriterTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DictionaryTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ListTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtilTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OptionTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PeerMessageUtilTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShaVisitorTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentManTest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UtilTest.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -305,244 +312,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -aria2c-AllTest.o: AllTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-AllTest.o -MD -MP -MF "$(DEPDIR)/aria2c-AllTest.Tpo" -c -o aria2c-AllTest.o `test -f 'AllTest.cc' || echo '$(srcdir)/'`AllTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-AllTest.Tpo" "$(DEPDIR)/aria2c-AllTest.Po"; else rm -f "$(DEPDIR)/aria2c-AllTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AllTest.cc' object='aria2c-AllTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-AllTest.o `test -f 'AllTest.cc' || echo '$(srcdir)/'`AllTest.cc - -aria2c-AllTest.obj: AllTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-AllTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-AllTest.Tpo" -c -o aria2c-AllTest.obj `if test -f 'AllTest.cc'; then $(CYGPATH_W) 'AllTest.cc'; else $(CYGPATH_W) '$(srcdir)/AllTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-AllTest.Tpo" "$(DEPDIR)/aria2c-AllTest.Po"; else rm -f "$(DEPDIR)/aria2c-AllTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AllTest.cc' object='aria2c-AllTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-AllTest.obj `if test -f 'AllTest.cc'; then $(CYGPATH_W) 'AllTest.cc'; else $(CYGPATH_W) '$(srcdir)/AllTest.cc'; fi` - -aria2c-RequestTest.o: RequestTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-RequestTest.o -MD -MP -MF "$(DEPDIR)/aria2c-RequestTest.Tpo" -c -o aria2c-RequestTest.o `test -f 'RequestTest.cc' || echo '$(srcdir)/'`RequestTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-RequestTest.Tpo" "$(DEPDIR)/aria2c-RequestTest.Po"; else rm -f "$(DEPDIR)/aria2c-RequestTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RequestTest.cc' object='aria2c-RequestTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-RequestTest.o `test -f 'RequestTest.cc' || echo '$(srcdir)/'`RequestTest.cc - -aria2c-RequestTest.obj: RequestTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-RequestTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-RequestTest.Tpo" -c -o aria2c-RequestTest.obj `if test -f 'RequestTest.cc'; then $(CYGPATH_W) 'RequestTest.cc'; else $(CYGPATH_W) '$(srcdir)/RequestTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-RequestTest.Tpo" "$(DEPDIR)/aria2c-RequestTest.Po"; else rm -f "$(DEPDIR)/aria2c-RequestTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RequestTest.cc' object='aria2c-RequestTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-RequestTest.obj `if test -f 'RequestTest.cc'; then $(CYGPATH_W) 'RequestTest.cc'; else $(CYGPATH_W) '$(srcdir)/RequestTest.cc'; fi` - -aria2c-ChunkedEncodingTest.o: ChunkedEncodingTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ChunkedEncodingTest.o -MD -MP -MF "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo" -c -o aria2c-ChunkedEncodingTest.o `test -f 'ChunkedEncodingTest.cc' || echo '$(srcdir)/'`ChunkedEncodingTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo" "$(DEPDIR)/aria2c-ChunkedEncodingTest.Po"; else rm -f "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ChunkedEncodingTest.cc' object='aria2c-ChunkedEncodingTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ChunkedEncodingTest.o `test -f 'ChunkedEncodingTest.cc' || echo '$(srcdir)/'`ChunkedEncodingTest.cc - -aria2c-ChunkedEncodingTest.obj: ChunkedEncodingTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ChunkedEncodingTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo" -c -o aria2c-ChunkedEncodingTest.obj `if test -f 'ChunkedEncodingTest.cc'; then $(CYGPATH_W) 'ChunkedEncodingTest.cc'; else $(CYGPATH_W) '$(srcdir)/ChunkedEncodingTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo" "$(DEPDIR)/aria2c-ChunkedEncodingTest.Po"; else rm -f "$(DEPDIR)/aria2c-ChunkedEncodingTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ChunkedEncodingTest.cc' object='aria2c-ChunkedEncodingTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ChunkedEncodingTest.obj `if test -f 'ChunkedEncodingTest.cc'; then $(CYGPATH_W) 'ChunkedEncodingTest.cc'; else $(CYGPATH_W) '$(srcdir)/ChunkedEncodingTest.cc'; fi` - -aria2c-FileTest.o: FileTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-FileTest.o -MD -MP -MF "$(DEPDIR)/aria2c-FileTest.Tpo" -c -o aria2c-FileTest.o `test -f 'FileTest.cc' || echo '$(srcdir)/'`FileTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-FileTest.Tpo" "$(DEPDIR)/aria2c-FileTest.Po"; else rm -f "$(DEPDIR)/aria2c-FileTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FileTest.cc' object='aria2c-FileTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-FileTest.o `test -f 'FileTest.cc' || echo '$(srcdir)/'`FileTest.cc - -aria2c-FileTest.obj: FileTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-FileTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-FileTest.Tpo" -c -o aria2c-FileTest.obj `if test -f 'FileTest.cc'; then $(CYGPATH_W) 'FileTest.cc'; else $(CYGPATH_W) '$(srcdir)/FileTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-FileTest.Tpo" "$(DEPDIR)/aria2c-FileTest.Po"; else rm -f "$(DEPDIR)/aria2c-FileTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FileTest.cc' object='aria2c-FileTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-FileTest.obj `if test -f 'FileTest.cc'; then $(CYGPATH_W) 'FileTest.cc'; else $(CYGPATH_W) '$(srcdir)/FileTest.cc'; fi` - -aria2c-OptionTest.o: OptionTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-OptionTest.o -MD -MP -MF "$(DEPDIR)/aria2c-OptionTest.Tpo" -c -o aria2c-OptionTest.o `test -f 'OptionTest.cc' || echo '$(srcdir)/'`OptionTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-OptionTest.Tpo" "$(DEPDIR)/aria2c-OptionTest.Po"; else rm -f "$(DEPDIR)/aria2c-OptionTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='OptionTest.cc' object='aria2c-OptionTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-OptionTest.o `test -f 'OptionTest.cc' || echo '$(srcdir)/'`OptionTest.cc - -aria2c-OptionTest.obj: OptionTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-OptionTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-OptionTest.Tpo" -c -o aria2c-OptionTest.obj `if test -f 'OptionTest.cc'; then $(CYGPATH_W) 'OptionTest.cc'; else $(CYGPATH_W) '$(srcdir)/OptionTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-OptionTest.Tpo" "$(DEPDIR)/aria2c-OptionTest.Po"; else rm -f "$(DEPDIR)/aria2c-OptionTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='OptionTest.cc' object='aria2c-OptionTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-OptionTest.obj `if test -f 'OptionTest.cc'; then $(CYGPATH_W) 'OptionTest.cc'; else $(CYGPATH_W) '$(srcdir)/OptionTest.cc'; fi` - -aria2c-Base64Test.o: Base64Test.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-Base64Test.o -MD -MP -MF "$(DEPDIR)/aria2c-Base64Test.Tpo" -c -o aria2c-Base64Test.o `test -f 'Base64Test.cc' || echo '$(srcdir)/'`Base64Test.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-Base64Test.Tpo" "$(DEPDIR)/aria2c-Base64Test.Po"; else rm -f "$(DEPDIR)/aria2c-Base64Test.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Base64Test.cc' object='aria2c-Base64Test.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-Base64Test.o `test -f 'Base64Test.cc' || echo '$(srcdir)/'`Base64Test.cc - -aria2c-Base64Test.obj: Base64Test.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-Base64Test.obj -MD -MP -MF "$(DEPDIR)/aria2c-Base64Test.Tpo" -c -o aria2c-Base64Test.obj `if test -f 'Base64Test.cc'; then $(CYGPATH_W) 'Base64Test.cc'; else $(CYGPATH_W) '$(srcdir)/Base64Test.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-Base64Test.Tpo" "$(DEPDIR)/aria2c-Base64Test.Po"; else rm -f "$(DEPDIR)/aria2c-Base64Test.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Base64Test.cc' object='aria2c-Base64Test.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-Base64Test.obj `if test -f 'Base64Test.cc'; then $(CYGPATH_W) 'Base64Test.cc'; else $(CYGPATH_W) '$(srcdir)/Base64Test.cc'; fi` - -aria2c-UtilTest.o: UtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-UtilTest.o -MD -MP -MF "$(DEPDIR)/aria2c-UtilTest.Tpo" -c -o aria2c-UtilTest.o `test -f 'UtilTest.cc' || echo '$(srcdir)/'`UtilTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-UtilTest.Tpo" "$(DEPDIR)/aria2c-UtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-UtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='UtilTest.cc' object='aria2c-UtilTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-UtilTest.o `test -f 'UtilTest.cc' || echo '$(srcdir)/'`UtilTest.cc - -aria2c-UtilTest.obj: UtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-UtilTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-UtilTest.Tpo" -c -o aria2c-UtilTest.obj `if test -f 'UtilTest.cc'; then $(CYGPATH_W) 'UtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/UtilTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-UtilTest.Tpo" "$(DEPDIR)/aria2c-UtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-UtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='UtilTest.cc' object='aria2c-UtilTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-UtilTest.obj `if test -f 'UtilTest.cc'; then $(CYGPATH_W) 'UtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/UtilTest.cc'; fi` - -aria2c-CookieBoxTest.o: CookieBoxTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-CookieBoxTest.o -MD -MP -MF "$(DEPDIR)/aria2c-CookieBoxTest.Tpo" -c -o aria2c-CookieBoxTest.o `test -f 'CookieBoxTest.cc' || echo '$(srcdir)/'`CookieBoxTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-CookieBoxTest.Tpo" "$(DEPDIR)/aria2c-CookieBoxTest.Po"; else rm -f "$(DEPDIR)/aria2c-CookieBoxTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CookieBoxTest.cc' object='aria2c-CookieBoxTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-CookieBoxTest.o `test -f 'CookieBoxTest.cc' || echo '$(srcdir)/'`CookieBoxTest.cc - -aria2c-CookieBoxTest.obj: CookieBoxTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-CookieBoxTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-CookieBoxTest.Tpo" -c -o aria2c-CookieBoxTest.obj `if test -f 'CookieBoxTest.cc'; then $(CYGPATH_W) 'CookieBoxTest.cc'; else $(CYGPATH_W) '$(srcdir)/CookieBoxTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-CookieBoxTest.Tpo" "$(DEPDIR)/aria2c-CookieBoxTest.Po"; else rm -f "$(DEPDIR)/aria2c-CookieBoxTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CookieBoxTest.cc' object='aria2c-CookieBoxTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-CookieBoxTest.obj `if test -f 'CookieBoxTest.cc'; then $(CYGPATH_W) 'CookieBoxTest.cc'; else $(CYGPATH_W) '$(srcdir)/CookieBoxTest.cc'; fi` - -aria2c-DataTest.o: DataTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DataTest.o -MD -MP -MF "$(DEPDIR)/aria2c-DataTest.Tpo" -c -o aria2c-DataTest.o `test -f 'DataTest.cc' || echo '$(srcdir)/'`DataTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DataTest.Tpo" "$(DEPDIR)/aria2c-DataTest.Po"; else rm -f "$(DEPDIR)/aria2c-DataTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DataTest.cc' object='aria2c-DataTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DataTest.o `test -f 'DataTest.cc' || echo '$(srcdir)/'`DataTest.cc - -aria2c-DataTest.obj: DataTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DataTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-DataTest.Tpo" -c -o aria2c-DataTest.obj `if test -f 'DataTest.cc'; then $(CYGPATH_W) 'DataTest.cc'; else $(CYGPATH_W) '$(srcdir)/DataTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DataTest.Tpo" "$(DEPDIR)/aria2c-DataTest.Po"; else rm -f "$(DEPDIR)/aria2c-DataTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DataTest.cc' object='aria2c-DataTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DataTest.obj `if test -f 'DataTest.cc'; then $(CYGPATH_W) 'DataTest.cc'; else $(CYGPATH_W) '$(srcdir)/DataTest.cc'; fi` - -aria2c-DictionaryTest.o: DictionaryTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DictionaryTest.o -MD -MP -MF "$(DEPDIR)/aria2c-DictionaryTest.Tpo" -c -o aria2c-DictionaryTest.o `test -f 'DictionaryTest.cc' || echo '$(srcdir)/'`DictionaryTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DictionaryTest.Tpo" "$(DEPDIR)/aria2c-DictionaryTest.Po"; else rm -f "$(DEPDIR)/aria2c-DictionaryTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DictionaryTest.cc' object='aria2c-DictionaryTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DictionaryTest.o `test -f 'DictionaryTest.cc' || echo '$(srcdir)/'`DictionaryTest.cc - -aria2c-DictionaryTest.obj: DictionaryTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DictionaryTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-DictionaryTest.Tpo" -c -o aria2c-DictionaryTest.obj `if test -f 'DictionaryTest.cc'; then $(CYGPATH_W) 'DictionaryTest.cc'; else $(CYGPATH_W) '$(srcdir)/DictionaryTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DictionaryTest.Tpo" "$(DEPDIR)/aria2c-DictionaryTest.Po"; else rm -f "$(DEPDIR)/aria2c-DictionaryTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DictionaryTest.cc' object='aria2c-DictionaryTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DictionaryTest.obj `if test -f 'DictionaryTest.cc'; then $(CYGPATH_W) 'DictionaryTest.cc'; else $(CYGPATH_W) '$(srcdir)/DictionaryTest.cc'; fi` - -aria2c-ListTest.o: ListTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ListTest.o -MD -MP -MF "$(DEPDIR)/aria2c-ListTest.Tpo" -c -o aria2c-ListTest.o `test -f 'ListTest.cc' || echo '$(srcdir)/'`ListTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ListTest.Tpo" "$(DEPDIR)/aria2c-ListTest.Po"; else rm -f "$(DEPDIR)/aria2c-ListTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ListTest.cc' object='aria2c-ListTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ListTest.o `test -f 'ListTest.cc' || echo '$(srcdir)/'`ListTest.cc - -aria2c-ListTest.obj: ListTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ListTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-ListTest.Tpo" -c -o aria2c-ListTest.obj `if test -f 'ListTest.cc'; then $(CYGPATH_W) 'ListTest.cc'; else $(CYGPATH_W) '$(srcdir)/ListTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ListTest.Tpo" "$(DEPDIR)/aria2c-ListTest.Po"; else rm -f "$(DEPDIR)/aria2c-ListTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ListTest.cc' object='aria2c-ListTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ListTest.obj `if test -f 'ListTest.cc'; then $(CYGPATH_W) 'ListTest.cc'; else $(CYGPATH_W) '$(srcdir)/ListTest.cc'; fi` - -aria2c-MetaFileUtilTest.o: MetaFileUtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-MetaFileUtilTest.o -MD -MP -MF "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo" -c -o aria2c-MetaFileUtilTest.o `test -f 'MetaFileUtilTest.cc' || echo '$(srcdir)/'`MetaFileUtilTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo" "$(DEPDIR)/aria2c-MetaFileUtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MetaFileUtilTest.cc' object='aria2c-MetaFileUtilTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-MetaFileUtilTest.o `test -f 'MetaFileUtilTest.cc' || echo '$(srcdir)/'`MetaFileUtilTest.cc - -aria2c-MetaFileUtilTest.obj: MetaFileUtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-MetaFileUtilTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo" -c -o aria2c-MetaFileUtilTest.obj `if test -f 'MetaFileUtilTest.cc'; then $(CYGPATH_W) 'MetaFileUtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/MetaFileUtilTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo" "$(DEPDIR)/aria2c-MetaFileUtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-MetaFileUtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MetaFileUtilTest.cc' object='aria2c-MetaFileUtilTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-MetaFileUtilTest.obj `if test -f 'MetaFileUtilTest.cc'; then $(CYGPATH_W) 'MetaFileUtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/MetaFileUtilTest.cc'; fi` - -aria2c-ShaVisitorTest.o: ShaVisitorTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ShaVisitorTest.o -MD -MP -MF "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo" -c -o aria2c-ShaVisitorTest.o `test -f 'ShaVisitorTest.cc' || echo '$(srcdir)/'`ShaVisitorTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo" "$(DEPDIR)/aria2c-ShaVisitorTest.Po"; else rm -f "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ShaVisitorTest.cc' object='aria2c-ShaVisitorTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ShaVisitorTest.o `test -f 'ShaVisitorTest.cc' || echo '$(srcdir)/'`ShaVisitorTest.cc - -aria2c-ShaVisitorTest.obj: ShaVisitorTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-ShaVisitorTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo" -c -o aria2c-ShaVisitorTest.obj `if test -f 'ShaVisitorTest.cc'; then $(CYGPATH_W) 'ShaVisitorTest.cc'; else $(CYGPATH_W) '$(srcdir)/ShaVisitorTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo" "$(DEPDIR)/aria2c-ShaVisitorTest.Po"; else rm -f "$(DEPDIR)/aria2c-ShaVisitorTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ShaVisitorTest.cc' object='aria2c-ShaVisitorTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-ShaVisitorTest.obj `if test -f 'ShaVisitorTest.cc'; then $(CYGPATH_W) 'ShaVisitorTest.cc'; else $(CYGPATH_W) '$(srcdir)/ShaVisitorTest.cc'; fi` - -aria2c-TorrentManTest.o: TorrentManTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-TorrentManTest.o -MD -MP -MF "$(DEPDIR)/aria2c-TorrentManTest.Tpo" -c -o aria2c-TorrentManTest.o `test -f 'TorrentManTest.cc' || echo '$(srcdir)/'`TorrentManTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-TorrentManTest.Tpo" "$(DEPDIR)/aria2c-TorrentManTest.Po"; else rm -f "$(DEPDIR)/aria2c-TorrentManTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TorrentManTest.cc' object='aria2c-TorrentManTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-TorrentManTest.o `test -f 'TorrentManTest.cc' || echo '$(srcdir)/'`TorrentManTest.cc - -aria2c-TorrentManTest.obj: TorrentManTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-TorrentManTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-TorrentManTest.Tpo" -c -o aria2c-TorrentManTest.obj `if test -f 'TorrentManTest.cc'; then $(CYGPATH_W) 'TorrentManTest.cc'; else $(CYGPATH_W) '$(srcdir)/TorrentManTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-TorrentManTest.Tpo" "$(DEPDIR)/aria2c-TorrentManTest.Po"; else rm -f "$(DEPDIR)/aria2c-TorrentManTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TorrentManTest.cc' object='aria2c-TorrentManTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-TorrentManTest.obj `if test -f 'TorrentManTest.cc'; then $(CYGPATH_W) 'TorrentManTest.cc'; else $(CYGPATH_W) '$(srcdir)/TorrentManTest.cc'; fi` - -aria2c-PeerMessageUtilTest.o: PeerMessageUtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-PeerMessageUtilTest.o -MD -MP -MF "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo" -c -o aria2c-PeerMessageUtilTest.o `test -f 'PeerMessageUtilTest.cc' || echo '$(srcdir)/'`PeerMessageUtilTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo" "$(DEPDIR)/aria2c-PeerMessageUtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PeerMessageUtilTest.cc' object='aria2c-PeerMessageUtilTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-PeerMessageUtilTest.o `test -f 'PeerMessageUtilTest.cc' || echo '$(srcdir)/'`PeerMessageUtilTest.cc - -aria2c-PeerMessageUtilTest.obj: PeerMessageUtilTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-PeerMessageUtilTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo" -c -o aria2c-PeerMessageUtilTest.obj `if test -f 'PeerMessageUtilTest.cc'; then $(CYGPATH_W) 'PeerMessageUtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/PeerMessageUtilTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo" "$(DEPDIR)/aria2c-PeerMessageUtilTest.Po"; else rm -f "$(DEPDIR)/aria2c-PeerMessageUtilTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PeerMessageUtilTest.cc' object='aria2c-PeerMessageUtilTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-PeerMessageUtilTest.obj `if test -f 'PeerMessageUtilTest.cc'; then $(CYGPATH_W) 'PeerMessageUtilTest.cc'; else $(CYGPATH_W) '$(srcdir)/PeerMessageUtilTest.cc'; fi` - -aria2c-BitfieldManTest.o: BitfieldManTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-BitfieldManTest.o -MD -MP -MF "$(DEPDIR)/aria2c-BitfieldManTest.Tpo" -c -o aria2c-BitfieldManTest.o `test -f 'BitfieldManTest.cc' || echo '$(srcdir)/'`BitfieldManTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-BitfieldManTest.Tpo" "$(DEPDIR)/aria2c-BitfieldManTest.Po"; else rm -f "$(DEPDIR)/aria2c-BitfieldManTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BitfieldManTest.cc' object='aria2c-BitfieldManTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-BitfieldManTest.o `test -f 'BitfieldManTest.cc' || echo '$(srcdir)/'`BitfieldManTest.cc - -aria2c-BitfieldManTest.obj: BitfieldManTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-BitfieldManTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-BitfieldManTest.Tpo" -c -o aria2c-BitfieldManTest.obj `if test -f 'BitfieldManTest.cc'; then $(CYGPATH_W) 'BitfieldManTest.cc'; else $(CYGPATH_W) '$(srcdir)/BitfieldManTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-BitfieldManTest.Tpo" "$(DEPDIR)/aria2c-BitfieldManTest.Po"; else rm -f "$(DEPDIR)/aria2c-BitfieldManTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BitfieldManTest.cc' object='aria2c-BitfieldManTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-BitfieldManTest.obj `if test -f 'BitfieldManTest.cc'; then $(CYGPATH_W) 'BitfieldManTest.cc'; else $(CYGPATH_W) '$(srcdir)/BitfieldManTest.cc'; fi` - -aria2c-DefaultDiskWriterTest.o: DefaultDiskWriterTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DefaultDiskWriterTest.o -MD -MP -MF "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo" -c -o aria2c-DefaultDiskWriterTest.o `test -f 'DefaultDiskWriterTest.cc' || echo '$(srcdir)/'`DefaultDiskWriterTest.cc; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo" "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Po"; else rm -f "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DefaultDiskWriterTest.cc' object='aria2c-DefaultDiskWriterTest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DefaultDiskWriterTest.o `test -f 'DefaultDiskWriterTest.cc' || echo '$(srcdir)/'`DefaultDiskWriterTest.cc - -aria2c-DefaultDiskWriterTest.obj: DefaultDiskWriterTest.cc -@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -MT aria2c-DefaultDiskWriterTest.obj -MD -MP -MF "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo" -c -o aria2c-DefaultDiskWriterTest.obj `if test -f 'DefaultDiskWriterTest.cc'; then $(CYGPATH_W) 'DefaultDiskWriterTest.cc'; else $(CYGPATH_W) '$(srcdir)/DefaultDiskWriterTest.cc'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo" "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Po"; else rm -f "$(DEPDIR)/aria2c-DefaultDiskWriterTest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DefaultDiskWriterTest.cc' object='aria2c-DefaultDiskWriterTest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(aria2c_CXXFLAGS) $(CXXFLAGS) -c -o aria2c-DefaultDiskWriterTest.obj `if test -f 'DefaultDiskWriterTest.cc'; then $(CYGPATH_W) 'DefaultDiskWriterTest.cc'; else $(CYGPATH_W) '$(srcdir)/DefaultDiskWriterTest.cc'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) diff --git a/test/PeerMessageUtilTest.cc b/test/PeerMessageUtilTest.cc index d58c3ecf..858e4045 100644 --- a/test/PeerMessageUtilTest.cc +++ b/test/PeerMessageUtilTest.cc @@ -62,14 +62,14 @@ void PeerMessageUtilTest::testCreatePeerMessageKeepAlive() { char msg[4]; memset(msg, 0, sizeof(msg)); PeerMessage* pm = PeerMessageUtil::createPeerMessage(NULL, 0); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::KEEP_ALIVE, pm->id); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::KEEP_ALIVE, pm->getId()); } void PeerMessageUtilTest::testCreatePeerMessageChoke() { char msg[5]; createNLengthMessage(msg, sizeof(msg), 1, 0); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 1); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::CHOKE, pm->id); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::CHOKE, pm->getId()); try { char msg[6]; @@ -84,7 +84,7 @@ void PeerMessageUtilTest::testCreatePeerMessageUnchoke() { char msg[5]; createNLengthMessage(msg, sizeof(msg), 1, 1); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 1); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::UNCHOKE, pm->id); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::UNCHOKE, pm->getId()); try { char msg[6]; @@ -99,7 +99,7 @@ void PeerMessageUtilTest::testCreatePeerMessageInterested() { char msg[5]; createNLengthMessage(msg, sizeof(msg), 1, 2); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 1); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::INTERESTED, pm->id); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::INTERESTED, pm->getId()); try { char msg[6]; @@ -114,7 +114,7 @@ void PeerMessageUtilTest::testCreatePeerMessageNotInterested() { char msg[5]; createNLengthMessage(msg, sizeof(msg), 1, 3); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 1); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::NOT_INTERESTED, pm->id); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::NOT_INTERESTED, pm->getId()); try { char msg[6]; @@ -130,8 +130,8 @@ void PeerMessageUtilTest::testCreatePeerMessageHave() { createNLengthMessage(msg, sizeof(msg), 5, 4); setIntParam(&msg[5], 100); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 5); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::HAVE, pm->id); - CPPUNIT_ASSERT_EQUAL(100, pm->index); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::HAVE, pm->getId()); + CPPUNIT_ASSERT_EQUAL(100, pm->getIndex()); try { char msg[8]; @@ -153,10 +153,10 @@ void PeerMessageUtilTest::testCreatePeerMessageBitfield() { char* msg = new char[msgLen]; createNLengthMessage(msg, msgLen, 3, 5); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 3); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::BITFIELD, pm->id); - CPPUNIT_ASSERT_EQUAL((unsigned char)0, pm->bitfield[0]); - CPPUNIT_ASSERT_EQUAL((unsigned char)0, pm->bitfield[1]); - CPPUNIT_ASSERT_EQUAL(2, pm->bitfieldLen); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::BITFIELD, pm->getId()); + CPPUNIT_ASSERT_EQUAL((unsigned char)0, pm->getBitfield()[0]); + CPPUNIT_ASSERT_EQUAL((unsigned char)0, pm->getBitfield()[1]); + CPPUNIT_ASSERT_EQUAL(2, pm->getBitfieldLength()); try { int msgLen = 5; @@ -174,10 +174,10 @@ void PeerMessageUtilTest::testCreatePeerMessageRequest() { setIntParam(&msg[9], 16*1024); setIntParam(&msg[13], 16*1024-1); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 13); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::REQUEST, pm->id); - CPPUNIT_ASSERT_EQUAL(1, pm->index); - CPPUNIT_ASSERT_EQUAL(16*1024, pm->begin); - CPPUNIT_ASSERT_EQUAL(16*1024-1, pm->length); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::REQUEST, pm->getId()); + CPPUNIT_ASSERT_EQUAL(1, pm->getIndex()); + CPPUNIT_ASSERT_EQUAL(16*1024, pm->getBegin()); + CPPUNIT_ASSERT_EQUAL(16*1024-1, pm->getLength()); try { char msg[13]; @@ -195,12 +195,12 @@ void PeerMessageUtilTest::testCreatePeerMessagePiece() { setIntParam(&msg[5], 1); setIntParam(&msg[9], 16*1024); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 19); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::PIECE, pm->id); - CPPUNIT_ASSERT_EQUAL(1, pm->index); - CPPUNIT_ASSERT_EQUAL(16*1024, pm->begin); - CPPUNIT_ASSERT_EQUAL(10, pm->blockLen); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::PIECE, pm->getId()); + CPPUNIT_ASSERT_EQUAL(1, pm->getIndex()); + CPPUNIT_ASSERT_EQUAL(16*1024, pm->getBegin()); + CPPUNIT_ASSERT_EQUAL(10, pm->getBlockLength()); for(int i = 0; i < 10; i++) { - CPPUNIT_ASSERT_EQUAL((char)0, pm->block[i]); + CPPUNIT_ASSERT_EQUAL((char)0, pm->getBlock()[i]); } try { @@ -220,10 +220,10 @@ void PeerMessageUtilTest::testCreatePeerMessageCancel() { setIntParam(&msg[9], 16*1024); setIntParam(&msg[13], 16*1024-1); PeerMessage* pm = PeerMessageUtil::createPeerMessage(&msg[4], 13); - CPPUNIT_ASSERT_EQUAL((int)PeerMessage::CANCEL, pm->id); - CPPUNIT_ASSERT_EQUAL(1, pm->index); - CPPUNIT_ASSERT_EQUAL(16*1024, pm->begin); - CPPUNIT_ASSERT_EQUAL(16*1024-1, pm->length); + CPPUNIT_ASSERT_EQUAL((int)PeerMessage::CANCEL, pm->getId()); + CPPUNIT_ASSERT_EQUAL(1, pm->getIndex()); + CPPUNIT_ASSERT_EQUAL(16*1024, pm->getBegin()); + CPPUNIT_ASSERT_EQUAL(16*1024-1, pm->getLength()); try { char msg[13]; @@ -237,8 +237,8 @@ void PeerMessageUtilTest::testCreatePeerMessageCancel() { void PeerMessageUtilTest::testCheckIntegrityHave() { PeerMessage* pm = new PeerMessage(); - pm->id = PeerMessage::HAVE; - pm->index = 119; + pm->setId(PeerMessage::HAVE); + pm->setIndex(119); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); } catch(Exception* ex) { @@ -246,7 +246,7 @@ void PeerMessageUtilTest::testCheckIntegrityHave() { CPPUNIT_FAIL(""); } - pm->index = 120; + pm->setIndex(120); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); @@ -256,62 +256,68 @@ void PeerMessageUtilTest::testCheckIntegrityHave() { void PeerMessageUtilTest::testCheckIntegrityBitfield() { PeerMessage* pm = new PeerMessage(); - pm->id = PeerMessage::BITFIELD; - pm->bitfieldLen = 15; - pm->bitfield = new unsigned char[pm->bitfieldLen]; - memset(pm->bitfield, 1, pm->bitfieldLen); + pm->setId(PeerMessage::BITFIELD); + int bitfieldLength = 15; + unsigned char* bitfield = new unsigned char[bitfieldLength]; + memset(bitfield, 0xff, bitfieldLength); + pm->setBitfield(bitfield, bitfieldLength); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); } catch(Exception* ex) { cerr << ex->getMsg() << endl; CPPUNIT_FAIL(""); } - - pm->bitfieldLen = 16; - pm->bitfield = new unsigned char[pm->bitfieldLen]; - memset(pm->bitfield, 1, pm->bitfieldLen); + delete [] bitfield; + bitfieldLength = 16; + bitfield = new unsigned char[bitfieldLength]; + memset(bitfield, 0xff, bitfieldLength); + pm->setBitfield(bitfield, bitfieldLength); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) { } - - pm->bitfieldLen = 14; - pm->bitfield = new unsigned char[pm->bitfieldLen]; - memset(pm->bitfield, 1, pm->bitfieldLen); + delete [] bitfield; + bitfieldLength = 14; + bitfield = new unsigned char[bitfieldLength]; + memset(bitfield, 0xff, bitfieldLength); + pm->setBitfield(bitfield, bitfieldLength); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) { } - - pm->bitfieldLen = 15; - pm->bitfield = new unsigned char[pm->bitfieldLen]; - memset(pm->bitfield, 1, pm->bitfieldLen); - pm->bitfield[pm->bitfieldLen-1] &= 0xfe; + delete [] bitfield; + bitfieldLength = 15; + bitfield = new unsigned char[bitfieldLength]; + memset(bitfield, 0xff, bitfieldLength); + bitfield[bitfieldLength-1] &= 0xfe; + pm->setBitfield(bitfield, bitfieldLength); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 119, 256*1024*120); } catch(Exception* ex) { cerr << ex->getMsg() << endl; CPPUNIT_FAIL(""); } - - pm->bitfieldLen = 15; - pm->bitfield = new unsigned char[pm->bitfieldLen]; - memset(pm->bitfield, 1, pm->bitfieldLen); + delete [] bitfield; + bitfieldLength = 15; + bitfield = new unsigned char[bitfieldLength]; + memset(bitfield, 0xff, bitfieldLength); + pm->setBitfield(bitfield, bitfieldLength); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 119, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) { } + delete [] bitfield; } void PeerMessageUtilTest::testCheckIntegrityRequest() { PeerMessage* pm = new PeerMessage(); - pm->id = PeerMessage::REQUEST; - pm->index = 119; - pm->begin = 0; - pm->length = 16*1024; + pm->setId(PeerMessage::REQUEST); + pm->setIndex(119); + pm->setBegin(0); + pm->setLength(16*1024); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); @@ -320,33 +326,24 @@ void PeerMessageUtilTest::testCheckIntegrityRequest() { CPPUNIT_FAIL(""); } - pm->begin = 256*1024; - pm->length = 16*1024; + pm->setBegin(256*1024); + pm->setLength(16*1024); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) {} - pm->begin = 0; - pm->length = 256*1024+1; + pm->setBegin(0); + pm->setLength(256*1024); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) {} - pm->begin = 0; - pm->length = 256*1024; + pm->setBegin(0); + pm->setLength(5); try { PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120); - } catch(Exception* ex) { - cerr << ex->getMsg() << endl; - CPPUNIT_FAIL(""); - } - - pm->begin = 0; - pm->length = 256*1024; - try { - PeerMessageUtil::checkIntegrity(pm, 256*1024, 120, 256*1024*120-1); CPPUNIT_FAIL("exception must be throwed."); } catch(Exception* ex) {} } diff --git a/test/ShaVisitorTest.cc b/test/ShaVisitorTest.cc index ce32b207..d8f78111 100644 --- a/test/ShaVisitorTest.cc +++ b/test/ShaVisitorTest.cc @@ -39,7 +39,7 @@ void ShaVisitorTest::testVisit() { ShaVisitor v; Data d("test", 4); d.accept(&v); - unsigned char md[EVP_MAX_MD_SIZE]; + unsigned char md[20]; int len = 0; v.getHash(md, len); string hashHex = hexHash(md, len); @@ -51,7 +51,7 @@ void ShaVisitorTest::testVisitCompound() { ShaVisitor v; MetaEntry* e = MetaFileUtil::parseMetaFile("test.torrent"); e->accept(&v); - unsigned char md[EVP_MAX_MD_SIZE]; + unsigned char md[20]; int len = 0; v.getHash(md, len); string hashHex = hexHash(md, len); diff --git a/test/TorrentManTest.cc b/test/TorrentManTest.cc index b30bd746..0ee3dd4b 100644 --- a/test/TorrentManTest.cc +++ b/test/TorrentManTest.cc @@ -7,12 +7,14 @@ using namespace std; class TorrentManTest:public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(TorrentManTest); + /* CPPUNIT_TEST(testUpdatePeers); //CPPUNIT_TEST(testUpdatePeer); CPPUNIT_TEST(testGetPeer); CPPUNIT_TEST(testGetMissingPiece); CPPUNIT_TEST(testCancelPiece); CPPUNIT_TEST(testAddPeer); + */ CPPUNIT_TEST_SUITE_END(); private: @@ -44,7 +46,7 @@ Peers createPeers() { peers.push_back(peer3); return peers; } - +/* void TorrentManTest::testUpdatePeers() { TorrentMan tm; Peers peers = createPeers(); @@ -58,7 +60,7 @@ void TorrentManTest::testUpdatePeers() { CPPUNIT_ASSERT_EQUAL(string("192.168.0.3"), (*itr)->ipaddr); itr++; } - +*/ /* void TorrentManTest::testUpdatePeer() { TorrentMan tm; @@ -88,7 +90,7 @@ void TorrentManTest::testUpdatePeer() { itr++; } */ - +/* void TorrentManTest::testGetPeer() { TorrentMan tm; Peers peers = createPeers(); @@ -186,3 +188,4 @@ void TorrentManTest::testAddPeer() { CPPUNIT_ASSERT_EQUAL(5, (int)tm.getPeers().size()); } +*/ diff --git a/test/UtilTest.cc b/test/UtilTest.cc index ec37edf4..ed3cc998 100644 --- a/test/UtilTest.cc +++ b/test/UtilTest.cc @@ -70,13 +70,13 @@ void UtilTest::testSplit() { } void UtilTest::testSlice() { - vector v1; + Strings v1; Util::slice(v1, "name1=value1; name2=value2; name3=value3;", ';'); CPPUNIT_ASSERT_EQUAL(3, (int)v1.size()); v1.clear(); Util::slice(v1, "name1=value1; name2=value2; name3=value3", ';'); CPPUNIT_ASSERT_EQUAL(3, (int)v1.size()); - vector::iterator itr = v1.begin(); + Strings::iterator itr = v1.begin(); CPPUNIT_ASSERT_EQUAL(string("name1=value1"), *itr++); CPPUNIT_ASSERT_EQUAL(string("name2=value2"), *itr++); CPPUNIT_ASSERT_EQUAL(string("name3=value3"), *itr++);