tests: send1: load modules in a predictable order

So that tags are added in the same order every time.

# wanted: @time=2017-07-14T02:40:00.000Z;account=test :LChanPeon!username@example.test TEST #placeholder :Hello World!
#   seen: @account=test;time=2017-07-14T02:40:00.000Z :LChanPeon!username@example.test TEST #placeholder :Hello World!
This commit is contained in:
Simon Arlott 2017-08-06 11:05:03 +01:00
parent 4e9035f2f1
commit 692fbac66d
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24
3 changed files with 19 additions and 3 deletions

View file

@ -23,11 +23,11 @@
#include <unistd.h> #include <unistd.h>
#include "tap/basic.h" #include "tap/basic.h"
#include "stdinc.h" #include "ircd_util.h"
#include "ircd_defs.h"
#include "defaults.h" #include "defaults.h"
#include "client.h" #include "client.h"
#include "ircd_util.h" #include "modules.h"
#define MSG "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__ #define MSG "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__
@ -97,6 +97,17 @@ void ircd_util_init(const char *name)
is_int(0, charybdis_main(ARRAY_SIZE(argv) - 1, argv), MSG); is_int(0, charybdis_main(ARRAY_SIZE(argv) - 1, argv), MSG);
} }
void ircd_util_reload_module(const char *name)
{
struct module *mod = findmodule_byname(name);
if (ok(mod != NULL, MSG)) {
if (ok(unload_one_module(name, false), MSG)) {
ok(load_one_module(name, mod->origin, mod->core), MSG);
}
}
}
void ircd_util_free(void) void ircd_util_free(void)
{ {
} }

View file

@ -29,4 +29,5 @@
#define TEST_ME_ID "0AA" #define TEST_ME_ID "0AA"
void ircd_util_init(const char *name); void ircd_util_init(const char *name);
void ircd_util_reload_module(const char *name);
void ircd_util_free(void); void ircd_util_free(void);

View file

@ -2682,6 +2682,10 @@ int main(int argc, char *argv[])
ircd_util_init(__FILE__); ircd_util_init(__FILE__);
client_util_init(); client_util_init();
// Load modules in a predictable order so that tags are added in the same order every time
ircd_util_reload_module("cap_account_tag");
ircd_util_reload_module("cap_server_time");
CAP_ACCOUNT_TAG = capability_get(cli_capindex, "account-tag", NULL); CAP_ACCOUNT_TAG = capability_get(cli_capindex, "account-tag", NULL);
ok(CAP_ACCOUNT_TAG != 0, "CAP_ACCOUNT_TAG missing; " MSG); ok(CAP_ACCOUNT_TAG != 0, "CAP_ACCOUNT_TAG missing; " MSG);