2009-05-06 15:42:59 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2008-03-03 19:30:12 +08:00
|
|
|
#include <iostream>
|
2009-05-06 15:42:59 +08:00
|
|
|
|
2006-02-17 21:35:04 +08:00
|
|
|
#include <cppunit/CompilerOutputter.h>
|
|
|
|
#include <cppunit/extensions/TestFactoryRegistry.h>
|
|
|
|
#include <cppunit/ui/text/TestRunner.h>
|
|
|
|
|
2009-05-06 15:42:59 +08:00
|
|
|
#include "Platform.h"
|
|
|
|
#include "SocketCore.h"
|
2010-12-02 21:38:36 +08:00
|
|
|
#include "util.h"
|
2013-05-02 10:30:42 +08:00
|
|
|
#include "console.h"
|
2013-07-05 20:08:03 +08:00
|
|
|
#include "LogFactory.h"
|
|
|
|
#include "prefs.h"
|
2009-05-06 15:42:59 +08:00
|
|
|
|
2015-12-27 17:39:47 +08:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2013-05-02 10:30:42 +08:00
|
|
|
aria2::global::initConsole(false);
|
2008-06-16 19:59:34 +08:00
|
|
|
aria2::Platform platform;
|
|
|
|
|
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
// Set locale to C to prevent the messages to be localized.
|
2015-12-27 17:39:47 +08:00
|
|
|
setlocale(LC_CTYPE, "C");
|
|
|
|
setlocale(LC_MESSAGES, "C");
|
2008-06-16 19:59:34 +08:00
|
|
|
#endif // ENABLE_NLS
|
|
|
|
|
2009-05-06 15:42:59 +08:00
|
|
|
// By default, SocketCore uses AF_UNSPEC for getaddrinfo hints to
|
|
|
|
// resolve address. Sometime SocketCore::bind() and
|
Fix various typos
Found via `codespell -q 3 -S "./deps,./ChangeLog.old,./LICENSE.OpenSSL,./doc/manual-src/pt,./doc/sphinx_themes/sphinx_rtd_theme/locale" -L ans,anull,clen,dependant,filetest,fo,hel,nd,orign,padd,parm,servent,tennant,worl,windows`
2024-01-15 00:22:28 +08:00
|
|
|
// SocketCore::establishConnection() use difference protocol family
|
2009-05-06 15:42:59 +08:00
|
|
|
// 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);
|
2009-12-24 22:59:47 +08:00
|
|
|
// If AI_ADDRCONFIG is set, tests fail if IPv4 address is not
|
|
|
|
// configured.
|
|
|
|
aria2::setDefaultAIFlags(0);
|
2010-12-02 21:38:36 +08:00
|
|
|
// Create output directory
|
|
|
|
aria2::util::mkdirs(A2_TEST_OUT_DIR);
|
2009-05-06 15:42:59 +08:00
|
|
|
|
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);
|
|
|
|
|
2015-12-27 17:39:47 +08:00
|
|
|
runner.setOutputter(
|
|
|
|
new CppUnit::CompilerOutputter(&runner.result(), std::cerr));
|
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;
|
|
|
|
}
|