summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/suites
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2018-06-04 09:59:21 +0200
committerYves-Alexis Perez <corsac@debian.org>2018-06-04 09:59:21 +0200
commit51a71ee15c1bcf0e82f363a16898f571e211f9c3 (patch)
tree2a03e117d072c55cfe2863d26b73e64d933e7ad8 /src/libstrongswan/tests/suites
parent7793611ee71b576dd9c66dee327349fa64e38740 (diff)
downloadvyos-strongswan-51a71ee15c1bcf0e82f363a16898f571e211f9c3.tar.gz
vyos-strongswan-51a71ee15c1bcf0e82f363a16898f571e211f9c3.zip
New upstream version 5.6.3
Diffstat (limited to 'src/libstrongswan/tests/suites')
-rw-r--r--src/libstrongswan/tests/suites/test_array.c2
-rw-r--r--src/libstrongswan/tests/suites/test_auth_cfg.c2
-rw-r--r--src/libstrongswan/tests/suites/test_bio_reader.c2
-rw-r--r--src/libstrongswan/tests/suites/test_bio_writer.c2
-rw-r--r--src/libstrongswan/tests/suites/test_chunk.c2
-rw-r--r--src/libstrongswan/tests/suites/test_crypto_factory.c2
-rw-r--r--src/libstrongswan/tests/suites/test_enum.c2
-rw-r--r--src/libstrongswan/tests/suites/test_enumerator.c2
-rw-r--r--src/libstrongswan/tests/suites/test_hashtable.c2
-rw-r--r--src/libstrongswan/tests/suites/test_host.c2
-rw-r--r--src/libstrongswan/tests/suites/test_iv_gen.c2
-rw-r--r--src/libstrongswan/tests/suites/test_linked_list.c2
-rw-r--r--src/libstrongswan/tests/suites/test_linked_list_enumerator.c2
-rw-r--r--src/libstrongswan/tests/suites/test_proposal.c114
-rw-r--r--src/libstrongswan/tests/suites/test_settings.c115
-rw-r--r--src/libstrongswan/tests/suites/test_threading.c52
-rw-r--r--src/libstrongswan/tests/suites/test_traffic_selector.c7
-rw-r--r--src/libstrongswan/tests/suites/test_utils.c2
-rw-r--r--src/libstrongswan/tests/suites/test_vectors.c2
19 files changed, 285 insertions, 33 deletions
diff --git a/src/libstrongswan/tests/suites/test_array.c b/src/libstrongswan/tests/suites/test_array.c
index eed8fba56..da2bfbb76 100644
--- a/src/libstrongswan/tests/suites/test_array.c
+++ b/src/libstrongswan/tests/suites/test_array.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG
diff --git a/src/libstrongswan/tests/suites/test_auth_cfg.c b/src/libstrongswan/tests/suites/test_auth_cfg.c
index d0fa8a045..9fc2bbd90 100644
--- a/src/libstrongswan/tests/suites/test_auth_cfg.c
+++ b/src/libstrongswan/tests/suites/test_auth_cfg.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_bio_reader.c b/src/libstrongswan/tests/suites/test_bio_reader.c
index d3b4b4358..f5387301e 100644
--- a/src/libstrongswan/tests/suites/test_bio_reader.c
+++ b/src/libstrongswan/tests/suites/test_bio_reader.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_bio_writer.c b/src/libstrongswan/tests/suites/test_bio_writer.c
index e74288eb7..97ebe7e05 100644
--- a/src/libstrongswan/tests/suites/test_bio_writer.c
+++ b/src/libstrongswan/tests/suites/test_bio_writer.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_chunk.c b/src/libstrongswan/tests/suites/test_chunk.c
index 9b2e48b0e..fbfb3ff9f 100644
--- a/src/libstrongswan/tests/suites/test_chunk.c
+++ b/src/libstrongswan/tests/suites/test_chunk.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2013 Tobias Brunner
* Copyright (C) 2008 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_crypto_factory.c b/src/libstrongswan/tests/suites/test_crypto_factory.c
index 94f45dada..f0c851f57 100644
--- a/src/libstrongswan/tests/suites/test_crypto_factory.c
+++ b/src/libstrongswan/tests/suites/test_crypto_factory.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_enum.c b/src/libstrongswan/tests/suites/test_enum.c
index 70bfdb2aa..dd6b86f8e 100644
--- a/src/libstrongswan/tests/suites/test_enum.c
+++ b/src/libstrongswan/tests/suites/test_enum.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_enumerator.c b/src/libstrongswan/tests/suites/test_enumerator.c
index b781ae9fd..924b34786 100644
--- a/src/libstrongswan/tests/suites/test_enumerator.c
+++ b/src/libstrongswan/tests/suites/test_enumerator.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2013 Tobias Brunner
* Copyright (C) 2007 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_hashtable.c b/src/libstrongswan/tests/suites/test_hashtable.c
index 8cc7bfe42..de5c3f22e 100644
--- a/src/libstrongswan/tests/suites/test_hashtable.c
+++ b/src/libstrongswan/tests/suites/test_hashtable.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010-2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_host.c b/src/libstrongswan/tests/suites/test_host.c
index 63f0eb20a..2a06dc61c 100644
--- a/src/libstrongswan/tests/suites/test_host.c
+++ b/src/libstrongswan/tests/suites/test_host.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_iv_gen.c b/src/libstrongswan/tests/suites/test_iv_gen.c
index 8b0a14b79..fa1c70940 100644
--- a/src/libstrongswan/tests/suites/test_iv_gen.c
+++ b/src/libstrongswan/tests/suites/test_iv_gen.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_linked_list.c b/src/libstrongswan/tests/suites/test_linked_list.c
index aa1e0429f..93e11c42e 100644
--- a/src/libstrongswan/tests/suites/test_linked_list.c
+++ b/src/libstrongswan/tests/suites/test_linked_list.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_linked_list_enumerator.c b/src/libstrongswan/tests/suites/test_linked_list_enumerator.c
index 48d6f40e6..19f381ef3 100644
--- a/src/libstrongswan/tests/suites/test_linked_list_enumerator.c
+++ b/src/libstrongswan/tests/suites/test_linked_list_enumerator.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_proposal.c b/src/libstrongswan/tests/suites/test_proposal.c
index 1a2f97d5f..938fa38aa 100644
--- a/src/libstrongswan/tests/suites/test_proposal.c
+++ b/src/libstrongswan/tests/suites/test_proposal.c
@@ -29,6 +29,8 @@ static struct {
{ PROTO_IKE, "aes128", NULL },
{ PROTO_IKE, "aes128-sha256", NULL },
{ PROTO_IKE, "aes128-sha256-modpnone", NULL },
+ { PROTO_IKE, "aes128-prfsha256", NULL },
+ { PROTO_IKE, "aes128-prfsha256-modp2048", NULL },
{ PROTO_IKE, "aes128-sha256-modp3072", "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_3072" },
{ PROTO_IKE, "aes128-sha256-prfsha384-modp3072", "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_384/MODP_3072" },
{ PROTO_IKE, "aes128gcm16-modp3072", NULL },
@@ -194,6 +196,106 @@ START_TEST(test_promote_dh_group_not_contained)
}
END_TEST
+START_TEST(test_unknown_transform_types_print)
+{
+ proposal_t *proposal;
+
+ proposal = proposal_create(PROTO_IKE, 0);
+ proposal->add_algorithm(proposal, 242, 42, 128);
+ assert_proposal_eq(proposal, "IKE:UNKNOWN_242_42_128");
+ proposal->destroy(proposal);
+
+ proposal = proposal_create_from_string(PROTO_IKE,
+ "aes128-sha256-ecp256");
+ proposal->add_algorithm(proposal, 242, 42, 128);
+ proposal->add_algorithm(proposal, 243, 1, 0);
+ assert_proposal_eq(proposal, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256/UNKNOWN_242_42_128/UNKNOWN_243_1");
+ proposal->destroy(proposal);
+}
+END_TEST
+
+START_TEST(test_unknown_transform_types_equals)
+{
+ proposal_t *self, *other;
+
+ self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other->add_algorithm(other, 242, 42, 0);
+ ck_assert(!self->equals(self, other));
+ ck_assert(!other->equals(other, self));
+ self->add_algorithm(self, 242, 42, 0);
+ ck_assert(self->equals(self, other));
+ ck_assert(other->equals(other, self));
+ other->destroy(other);
+ self->destroy(self);
+}
+END_TEST
+
+START_TEST(test_unknown_transform_types_select_fail)
+{
+ proposal_t *self, *other, *selected;
+
+ self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other->add_algorithm(other, 242, 42, 0);
+
+ selected = self->select(self, other, TRUE, FALSE);
+ ck_assert(!selected);
+ other->destroy(other);
+ self->destroy(self);
+}
+END_TEST
+
+START_TEST(test_unknown_transform_types_select_fail_subtype)
+{
+ proposal_t *self, *other, *selected;
+
+ self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ self->add_algorithm(self, 242, 8, 0);
+ other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other->add_algorithm(other, 242, 42, 0);
+
+ selected = self->select(self, other, TRUE, FALSE);
+ ck_assert(!selected);
+ other->destroy(other);
+ self->destroy(self);
+}
+END_TEST
+
+START_TEST(test_unknown_transform_types_select_success)
+{
+ proposal_t *self, *other, *selected;
+
+ self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ self->add_algorithm(self, 242, 42, 128);
+ other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
+ other->add_algorithm(other, 242, 42, 128);
+ other->add_algorithm(other, 242, 1, 0);
+
+ selected = self->select(self, other, TRUE, FALSE);
+ ck_assert(selected);
+ assert_proposal_eq(selected, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256/UNKNOWN_242_42_128");
+ selected->destroy(selected);
+ other->destroy(other);
+ self->destroy(self);
+}
+END_TEST
+
+START_TEST(test_chacha20_poly1305_key_length)
+{
+ proposal_t *proposal;
+ uint16_t alg, ks;
+
+ proposal = proposal_create_from_string(PROTO_IKE, "chacha20poly1305-prfsha256-ecp256");
+ proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM, &alg, &ks);
+ ck_assert_int_eq(alg, ENCR_CHACHA20_POLY1305);
+ ck_assert_int_eq(ks, 0);
+ assert_proposal_eq(proposal, "IKE:CHACHA20_POLY1305/PRF_HMAC_SHA2_256/ECP_256");
+ proposal->destroy(proposal);
+}
+END_TEST
+
+
Suite *proposal_suite_create()
{
Suite *s;
@@ -216,5 +318,17 @@ Suite *proposal_suite_create()
tcase_add_test(tc, test_promote_dh_group_not_contained);
suite_add_tcase(s, tc);
+ tc = tcase_create("unknown transform types");
+ tcase_add_test(tc, test_unknown_transform_types_print);
+ tcase_add_test(tc, test_unknown_transform_types_equals);
+ tcase_add_test(tc, test_unknown_transform_types_select_fail);
+ tcase_add_test(tc, test_unknown_transform_types_select_fail_subtype);
+ tcase_add_test(tc, test_unknown_transform_types_select_success);
+ suite_add_tcase(s, tc);
+
+ tc = tcase_create("chacha20/poly1305");
+ tcase_add_test(tc, test_chacha20_poly1305_key_length);
+ suite_add_tcase(s, tc);
+
return s;
}
diff --git a/src/libstrongswan/tests/suites/test_settings.c b/src/libstrongswan/tests/suites/test_settings.c
index 9d0a6dea1..0759f7013 100644
--- a/src/libstrongswan/tests/suites/test_settings.c
+++ b/src/libstrongswan/tests/suites/test_settings.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -1109,6 +1109,12 @@ START_TEST(test_valid)
"}\n");
ck_assert(chunk_write(contents, path, 0022, TRUE));
ck_assert(settings->load_files(settings, path, FALSE));
+
+ contents = chunk_from_str(
+ "equals = a setting with = and { character");
+ ck_assert(chunk_write(contents, path, 0022, TRUE));
+ ck_assert(settings->load_files(settings, path, FALSE));
+ verify_string("a setting with = and { character", "equals");
}
END_TEST
@@ -1148,12 +1154,110 @@ START_TEST(test_invalid)
ck_assert(!settings->load_files(settings, path, FALSE));
contents = chunk_from_str(
- "only = a single setting = per line");
+ "\"unexpected\" = string");
ck_assert(chunk_write(contents, path, 0022, TRUE));
ck_assert(!settings->load_files(settings, path, FALSE));
}
END_TEST
+START_SETUP(setup_crlf_config)
+{
+ chunk_t inc1 = chunk_from_str(
+ "main {\r\n"
+ " key1 = n1\r\n"
+ " key2 = n2\n"
+ " key3 = val3\n"
+ " none = \n"
+ " sub1 {\n"
+ " key3 = value\n"
+ " }\n"
+ " sub2 {\n"
+ " sub3 = val3\n"
+ " }\n"
+ " include " include2 "\n"
+ "}");
+ chunk_t inc2 = chunk_from_str(
+ "key2 = v2\n"
+ "sub1 {\n"
+ " key = val\n"
+ "}");
+ ck_assert(chunk_write(inc1, include1, 0022, TRUE));
+ ck_assert(chunk_write(inc2, include2, 0022, TRUE));
+}
+END_SETUP
+
+START_TEST(test_crlf)
+{
+ chunk_t contents = chunk_from_str(
+ "main {\r\n"
+ " key1 = val1\r\n"
+ " none =\r\n"
+ " sub1 {\r\n"
+ " key2 = v2\r\n"
+ " # key2 = v3\r\n"
+ " sub1 {\r\n"
+ " key = val\r\n"
+ " }\r\n"
+ " }\r\n"
+ "}");
+
+ create_settings(contents);
+
+ verify_string("val1", "main.key1");
+ verify_string("v2", "main.sub1.key2");
+ verify_string("val", "main.sub1.sub1.key");
+ verify_null("main.none");
+}
+END_TEST
+
+START_TEST(test_crlf_string)
+{
+ chunk_t contents = chunk_from_str(
+ "main {\r\n"
+ " key1 = \"new\r\nline\"\r\n"
+ " key2 = \"joi\\\r\nned\"\r\n"
+ " none =\r\n"
+ " sub1 {\r\n"
+ " key2 = v2\r\n"
+ " sub1 {\r\n"
+ " key = val\r\n"
+ " }\r\n"
+ " }\r\n"
+ "}");
+
+ create_settings(contents);
+
+ verify_string("new\nline", "main.key1");
+ verify_string("joined", "main.key2");
+ verify_string("v2", "main.sub1.key2");
+ verify_string("val", "main.sub1.sub1.key");
+ verify_null("main.none");
+}
+END_TEST
+
+START_TEST(test_crlf_include)
+{
+ chunk_t contents = chunk_from_str(
+ "main {\r\n"
+ " key1 = val1\r\n"
+ " none =\r\n"
+ " sub1 {\r\n"
+ " key2 = v2\r\n"
+ " sub1 {\r\n"
+ " key = val\r\n"
+ " }\r\n"
+ " }\r\n"
+ "}");
+
+ create_settings(contents);
+
+ verify_string("val1", "main.key1");
+ verify_string("v2", "main.sub1.key2");
+ verify_string("val", "main.sub1.sub1.key");
+ verify_null("main.none");
+}
+END_TEST
+
Suite *settings_suite_create()
{
Suite *s;
@@ -1241,5 +1345,12 @@ Suite *settings_suite_create()
tcase_add_test(tc, test_invalid);
suite_add_tcase(s, tc);
+ tc = tcase_create("crlf");
+ tcase_add_checked_fixture(tc, setup_crlf_config, teardown_include_config);
+ tcase_add_test(tc, test_crlf);
+ tcase_add_test(tc, test_crlf_string);
+ tcase_add_test(tc, test_crlf_include);
+ suite_add_tcase(s, tc);
+
return s;
}
diff --git a/src/libstrongswan/tests/suites/test_threading.c b/src/libstrongswan/tests/suites/test_threading.c
index 9a9fdd8e9..26e60db0d 100644
--- a/src/libstrongswan/tests/suites/test_threading.c
+++ b/src/libstrongswan/tests/suites/test_threading.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2013 Tobias Brunner
+ * Copyright (C) 2013-2018 Tobias Brunner
* Copyright (C) 2008 Martin Willi
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -27,6 +27,36 @@
#include <threading/semaphore.h>
#include <threading/thread_value.h>
+#ifdef WIN32
+/* when running on AppVeyor the wait functions seem to frequently trigger a bit
+ * early, allow this if the difference is within 5ms. */
+static inline void time_is_at_least(timeval_t *expected, timeval_t *actual)
+{
+ if (!timercmp(actual, expected, >))
+ {
+ timeval_t diff;
+
+ timersub(expected, actual, &diff);
+ if (!diff.tv_sec && diff.tv_usec <= 5000)
+ {
+ warn("allow timer event %dus too early on Windows (expected: %u.%u, "
+ "actual: %u.%u)", diff.tv_usec, expected->tv_sec,
+ expected->tv_usec, actual->tv_sec, actual->tv_usec);
+ return;
+ }
+ fail("expected: %u.%u, actual: %u.%u", expected->tv_sec,
+ expected->tv_usec, actual->tv_sec, actual->tv_usec);
+ }
+}
+#else /* WIN32 */
+static inline void time_is_at_least(timeval_t *expected, timeval_t *actual)
+{
+ ck_assert_msg(timercmp(actual, expected, >), "expected: %u.%u, actual: "
+ "%u.%u", expected->tv_sec, expected->tv_usec, actual->tv_sec,
+ actual->tv_usec);
+}
+#endif /* WIN32 */
+
/*******************************************************************************
* recursive mutex test
*/
@@ -380,8 +410,7 @@ START_TEST(test_condvar_timed)
time_monotonic(&end);
mutex->unlock(mutex);
timersub(&end, &start, &end);
- ck_assert_msg(timercmp(&end, &diff, >), "end: %u.%u, diff: %u.%u",
- end.tv_sec, end.tv_usec, diff.tv_sec, diff.tv_usec);
+ time_is_at_least(&diff, &end);
thread = thread_create(condvar_run, NULL);
@@ -419,8 +448,7 @@ START_TEST(test_condvar_timed_abs)
}
time_monotonic(&end);
mutex->unlock(mutex);
- ck_assert_msg(timercmp(&end, &diff, >), "end: %u.%u, diff: %u.%u",
- end.tv_sec, end.tv_usec, abso.tv_sec, abso.tv_usec);
+ time_is_at_least(&diff, &end);
thread = thread_create(condvar_run, NULL);
@@ -704,8 +732,7 @@ START_TEST(test_rwlock_condvar_timed)
rwlock->unlock(rwlock);
time_monotonic(&end);
timersub(&end, &start, &end);
- ck_assert_msg(timercmp(&end, &diff, >), "end: %u.%u, diff: %u.%u",
- end.tv_sec, end.tv_usec, diff.tv_sec, diff.tv_usec);
+ time_is_at_least(&diff, &end);
thread = thread_create(rwlock_condvar_run, NULL);
@@ -743,8 +770,7 @@ START_TEST(test_rwlock_condvar_timed_abs)
}
rwlock->unlock(rwlock);
time_monotonic(&end);
- ck_assert_msg(timercmp(&end, &abso, >), "end: %u.%u, abso: %u.%u",
- end.tv_sec, end.tv_usec, abso.tv_sec, abso.tv_usec);
+ time_is_at_least(&abso, &end);
thread = thread_create(rwlock_condvar_run, NULL);
@@ -866,8 +892,7 @@ START_TEST(test_semaphore_timed)
ck_assert(semaphore->timed_wait(semaphore, diff.tv_usec / 1000));
time_monotonic(&end);
timersub(&end, &start, &end);
- ck_assert_msg(timercmp(&end, &diff, >), "end: %u.%u, diff: %u.%u",
- end.tv_sec, end.tv_usec, diff.tv_sec, diff.tv_usec);
+ time_is_at_least(&diff, &end);
thread = thread_create(semaphore_run, NULL);
@@ -889,8 +914,7 @@ START_TEST(test_semaphore_timed_abs)
timeradd(&start, &diff, &abso);
ck_assert(semaphore->timed_wait_abs(semaphore, abso));
time_monotonic(&end);
- ck_assert_msg(timercmp(&end, &abso, >), "end: %u.%u, abso: %u.%u",
- end.tv_sec, end.tv_usec, abso.tv_sec, abso.tv_usec);
+ time_is_at_least(&abso, &end);
thread = thread_create(semaphore_run, NULL);
diff --git a/src/libstrongswan/tests/suites/test_traffic_selector.c b/src/libstrongswan/tests/suites/test_traffic_selector.c
index 93361f9bf..137c337dc 100644
--- a/src/libstrongswan/tests/suites/test_traffic_selector.c
+++ b/src/libstrongswan/tests/suites/test_traffic_selector.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2015 Martin Willi
* Copyright (C) 2015 revosec AG
@@ -72,10 +72,13 @@ START_TEST(test_create_from_cidr)
verify("10.1.0.1/32[udp]", "10.1.0.1/32[17]",
traffic_selector_create_from_cidr("10.1.0.1/32", IPPROTO_UDP,
0, 65535));
+ verify("10.1.0.1/32[0/domain]", "10.1.0.1/32[0/53]",
+ traffic_selector_create_from_cidr("10.1.0.1/32", 0,
+ 53, 53));
verify("10.1.0.1/32[udp/1234-1235]", "10.1.0.1/32[17/1234-1235]",
traffic_selector_create_from_cidr("10.1.0.1/32", IPPROTO_UDP,
1234, 1235));
- verify("10.1.0.0/16[OPAQUE]", NULL,
+ verify("10.1.0.0/16[0/OPAQUE]", NULL,
traffic_selector_create_from_cidr("10.1.0.0/16", 0, 65535, 0));
verify(NULL, NULL,
diff --git a/src/libstrongswan/tests/suites/test_utils.c b/src/libstrongswan/tests/suites/test_utils.c
index b423d7d2d..00f000a6a 100644
--- a/src/libstrongswan/tests/suites/test_utils.c
+++ b/src/libstrongswan/tests/suites/test_utils.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013-2015 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/libstrongswan/tests/suites/test_vectors.c b/src/libstrongswan/tests/suites/test_vectors.c
index a35342837..971b331b2 100644
--- a/src/libstrongswan/tests/suites/test_vectors.c
+++ b/src/libstrongswan/tests/suites/test_vectors.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 Tobias Brunner
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2013 Martin Willi
* Copyright (C) 2013 revosec AG