*/
char sid[MAXBUF];
+ /** True if we have been told to run the testsuite from the commandline,
+ * rather than entering the mainloop.
+ */
+ bool TestSuite;
+
/** Construct a new ServerConfig
*/
ServerConfig(InspIRCd* Instance);
I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList,
I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed,
- I_OnText, I_OnReadConfig, I_OnDownloadFile, I_OnPassCompare,
+ I_OnText, I_OnReadConfig, I_OnDownloadFile, I_OnPassCompare, I_OnRunTestSuite,
I_END
};
* @param user The user who's buffer is now empty.
*/
virtual void OnBufferFlushed(User* user);
+
+ /** Add test suite hooks here. These are used for testing functionality of a module
+ * via the --testsuite debugging parameter.
+ */
+ virtual void OnRunTestSuite();
};
#ifndef __TESTSUITE_H__
#define __TESTSUITE_H__
+class InspIRCd;
+
+class TestSuite : public Extensible
+{
+ public:
+ TestSuite(InspIRCd* ServerInstance);
+ ~TestSuite();
+};
+
#endif
int found_ports = 0;
FailedPortList pl;
- int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_root = 0; /* flag variables */
+ int do_version = 0, do_nofork = 0, do_debug = 0,
+ do_nolog = 0, do_root = 0, do_testsuite = 0; /* flag variables */
char c = 0;
memset(&server, 0, sizeof(server));
{ "nolog", no_argument, &do_nolog, 1 },
{ "runasroot", no_argument, &do_root, 1 },
{ "version", no_argument, &do_version, 1 },
+ { "testsuite", no_argument, &do_testsuite, 1 },
{ 0, 0, 0, 0 }
};
break;
default:
/* Unknown parameter! DANGER, INTRUDER.... err.... yeah. */
- printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>] [--runasroot] [--version] [--config <config>]\n", argv[0]);
+ printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n\
+ [--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0]);
Exit(EXIT_STATUS_ARGV);
break;
}
/* Set the finished argument values */
Config->nofork = do_nofork;
Config->forcedebug = do_debug;
- Config->writelog = !do_nolog;
+ Config->writelog = !do_nolog;
+ Config->TestSuite = do_testsuite;
if (!this->OpenLog(argv, argc))
{
int InspIRCd::Run()
{
+ /* See if we're supposed to be running the test suite rather than entering the mainloop */
+ if (Config->TestSuite)
+ {
+ TestSuite* ts = new TestSuite(this);
+ delete ts;
+ Exit(0);
+ }
+
while (true)
{
#ifndef WIN32
void Module::OnGarbageCollect() { }
void Module::OnBufferFlushed(User*) { }
void Module::OnText(User*, void*, int, const std::string&, char, CUList&) { }
+void Module::OnRunTestSuite() { }
ModuleManager::ModuleManager(InspIRCd* Ins) : ModCount(0), Instance(Ins)
#include "inspircd.h"
#include "testsuite.h"
+TestSuite::TestSuite(InspIRCd* ServerInstance)
+{
+ FOREACH_MOD(I_OnRunTestSuite, OnRunTestSuite());
+}
+
+TestSuite::~TestSuite()
+{
+}
+
/* $Core: libIRCDtestsuite */