aria2/test/AllTest.cc

54 lines
1.5 KiB
C++
Raw Normal View History

#include "common.h"
#include <iostream>
2006-02-17 21:35:04 +08:00
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include "Platform.h"
#include "SocketCore.h"
#include "util.h"
#include "console.h"
2013-07-05 20:08:03 +08:00
#include "LogFactory.h"
#include "prefs.h"
int main(int argc, char* argv[])
{
aria2::global::initConsole(false);
aria2::Platform platform;
#ifdef ENABLE_NLS
// Set locale to C to prevent the messages to be localized.
setlocale(LC_CTYPE, "C");
setlocale(LC_MESSAGES, "C");
#endif // ENABLE_NLS
// By default, SocketCore uses AF_UNSPEC for getaddrinfo hints to
// resolve address. Sometime SocketCore::bind() and
// SocketCore::establishConnection() use difference protocol family
// and latter cannot connect to former. To avoid this situation, we
// limit protocol family to AF_INET for unit tests.
aria2::SocketCore::setProtocolFamily(AF_INET);
// If AI_ADDRCONFIG is set, tests fail if IPv4 address is not
// configured.
aria2::setDefaultAIFlags(0);
// Create output directory
aria2::util::mkdirs(A2_TEST_OUT_DIR);
2013-07-05 20:08:03 +08:00
aria2::LogFactory::setConsoleLogLevel(aria2::V_DEBUG);
aria2::LogFactory::reconfigure();
2006-02-17 21:35:04 +08:00
CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
CppUnit::TextUi::TestRunner runner;
runner.addTest(suite);
runner.setOutputter(
new CppUnit::CompilerOutputter(&runner.result(), std::cerr));
2007-06-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> * src/AbstractCommand.cc (execute): Changed log level of MSG_RESTARTING_DOWNLOAD and MSG_MAX_TRY from error to info. Added MSG_DOWNLOAD_ABORTED after MSG_MAX_TRY. * src/message.h (MSG_TORRENT_DOWNLOAD_ABORTED): New definition. (MSG_DOWNLOAD_ABORTED): Added %s. (MSG_RESTARTING_DOWNLOAD): Added %s. (MSG_DOWNLOAD_ALREADY_COMPLETED): Updated. * src/PeerAbstractCommand.cc (execute): MSG_DOWNLOAD_ABORTED -> MSG_TORRENT_DOWNLOAD_ABORTED * src/Request.h (cookieBox): Made ShardHandle. * src/RequestGroup.h, src/RequestGroup.cc (createNextCommandWithAdj): New function. * src/FileAllocationCommand.cc (executeInternal): Use createNextCommandWithAdj(). * src/CheckIntegrityCommand.cc (executeInternal): Use createNextCommandWithAdj(). Added --load-cookies command-option. * src/OptionHandlerFactory.cc (createOptionHandlers): Added PREF_LOAD_COOKIES. * src/CookieBox.h, src/CookieBox.cc: Rwritten using CookieParser. Now aria2 can handle cookie's expiration date. * src/Cookie.h (expires): Changed its type to time_t. * src/main.cc: Added --load-cookies command-line option. * src/prefs.h (PREF_LOAD_COOKIES): New definition. * src/Util.h, src/Util.cc (httpGMT): New function. * src/Request.cc (Request): Initialize cookieBox using CookieBoxFactory. * src/CookieBoxFactory.h, src/CookieBoxFactory.cc: New class. * src/CookieParser.h, src/CookieParser.cc: New class. * src/main.cc: Chagned the default value of --metalink-servers to 5. * src/HttpResponseCommand.cc (handleOtherEncoding): Call RequestGroup::shouldCancelDownloadForSafety
2007-06-10 15:55:43 +08:00
2006-02-17 21:35:04 +08:00
// Run the tests.
bool successfull = runner.run();
return successfull ? 0 : 1;
}