summaryrefslogtreecommitdiffstats
path: root/src/auth/test-main.c
blob: 762c34bc3510314290d7bb467af4f16fedf4787b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "auth-settings.h"
#include "test-common.h"
#include "test-auth.h"
#include "password-scheme.h"
#include "passdb.h"

int main(int argc, const char *argv[])
{
	const char *match = "";
	int ret;
	static const struct named_test test_functions[] = {
		TEST_NAMED(test_auth_request_var_expand)
		TEST_NAMED(test_auth_request_fields)
		TEST_NAMED(test_db_dict_parse_cache_key)
		TEST_NAMED(test_username_filter)
#if defined(BUILTIN_LUA)
		TEST_NAMED(test_db_lua)
#endif
		{ NULL, NULL }
	};

	password_schemes_init();
	passdbs_init();
	passdb_mock_mod_init();

	if (argc > 2 && strcasecmp(argv[1], "--match") == 0)
		match = argv[2];

	ret = test_run_named(test_functions, match);

	passdb_mock_mod_deinit();
	password_schemes_deinit();
	passdbs_deinit();

	return ret;
}