build_tests: build_tests.gpr
@$(GPRBUILD) -p $< $(BUILD_OPTS) $(TEST_OPTS)
-check-tkm: build_tests
+check: build_tests
+ if test -z "${TESTS_TKM}"; then \
+ echo -e >&2 \
+ "\nSome TKM tests are not enabled, by deafult, because they have" \
+ "\nto be run as root and require a running TKM daemon. They may" \
+ "\nbe enabled by defining the TESTS_TKM environment variable.\n"; \
+ fi
@LD_LIBRARY_PATH=$(LIBPT) obj/tests
-check:
- @echo "TKM tests are not run automatically because they have to be run as root" >&2
- @echo "and require a properly configured TKM daemon to be running." >&2
- @echo "They can be run from '$(abs_builddir)' with 'make check-tkm'" >&2
-
install: build_charon
$(INSTALL) -m 755 obj/charon-tkm $(DESTDIR)$(ipsecdir)
aead_t * const aead = keymat->keymat_v2.keymat.get_aead(&keymat->keymat_v2.keymat, TRUE);
fail_if(!aead, "AEAD is NULL");
- fail_if(aead->get_key_size(aead) != 96, "Key size mismatch %d",
+ fail_if(aead->get_key_size(aead) != 1, "Key size mismatch %d",
aead->get_key_size(aead));
fail_if(aead->get_block_size(aead) != 16, "Block size mismatch %d",
aead->get_block_size(aead));
{ .suite = NULL, }
};
-static bool tkm_initialized = false;
+static bool tkm_initialized, use_tkm;
static bool test_runner_init(bool init)
{
bool result = TRUE;
- if (init)
+ if (init && use_tkm)
{
+ int level = LEVEL_SILENT;
+ char *verbosity;
+
libcharon_init();
- lib->settings->set_int(lib->settings,
- "test-runner.filelog.stdout.default", 0);
+ verbosity = getenv("TESTS_VERBOSITY");
+ if (verbosity)
+ {
+ level = atoi(verbosity);
+ }
+ lib->settings->set_int(lib->settings, "%s.filelog.stderr.default",
+ lib->settings->get_int(lib->settings, "%s.filelog.stderr.default",
+ level, lib->ns), lib->ns);
charon->load_loggers(charon);
/* Register TKM specific plugins */
static plugin_feature_t features[] = {
+ PLUGIN_PROVIDE(CUSTOM, "tkm"),
PLUGIN_REGISTER(NONCE_GEN, tkm_nonceg_create),
PLUGIN_PROVIDE(NONCE_GEN),
PLUGIN_CALLBACK(kernel_ipsec_register, tkm_kernel_ipsec_create),
{
bool result;
+ use_tkm = getenv("TESTS_TKM") != NULL;
+
/* disable leak detective because of how tkm_init/deinit is called, which
* does not work otherwise due to limitations of the external libraries */
setenv("LEAK_DETECTIVE_DISABLE", "1", 1);
TEST_SUITE(make_id_manager_tests)
TEST_SUITE(make_chunk_map_tests)
TEST_SUITE(make_utility_tests)
-TEST_SUITE(make_nonceg_tests)
-TEST_SUITE(make_diffie_hellman_tests)
-TEST_SUITE(make_keymat_tests)
+TEST_SUITE_DEPEND(make_nonceg_tests, CUSTOM, "tkm")
+TEST_SUITE_DEPEND(make_diffie_hellman_tests, CUSTOM, "tkm")
+TEST_SUITE_DEPEND(make_keymat_tests, CUSTOM, "tkm")
TEST_SUITE(make_kernel_sad_tests)