diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-01-06 18:01:06 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-01-06 18:23:40 +0100 |
commit | 94e10f15e51ead788d9947e966878ebfdc95b7ce (patch) | |
tree | a2360ea86e3b34e8d2e85a2edca18f4a100504d6 | |
parent | d62a6ec3f9949d79bb634a5da030361d6681d531 (diff) | |
download | strongswan-94e10f15e51ead788d9947e966878ebfdc95b7ce.tar.bz2 strongswan-94e10f15e51ead788d9947e966878ebfdc95b7ce.tar.xz |
test-asn1: Fix skipping of >2038 tests on i386
The two constants overflow time_t on i386 (they also produced a compiler
warning without type suffix) so the comparison with TIME_32_BIT_SIGNED_MAX
did not work as intended.
Fixes #477.
-rw-r--r-- | src/libstrongswan/tests/suites/test_asn1.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/libstrongswan/tests/suites/test_asn1.c b/src/libstrongswan/tests/suites/test_asn1.c index 1cd81e0f1..cea2bdc37 100644 --- a/src/libstrongswan/tests/suites/test_asn1.c +++ b/src/libstrongswan/tests/suites/test_asn1.c @@ -454,25 +454,25 @@ START_TEST(test_asn1_to_time) } testdata_t; testdata_t test[] = { - { 352980, 0x18, "197001050203Z" }, - { 352984, 0x18, "19700105020304Z" }, - { 352980, 0x17, "7001050203Z" }, - { 347580, 0x17, "7001050203+0130" }, - { 358380, 0x17, "7001050203-0130" }, - { 352984, 0x17, "700105020304Z" }, - { 347584, 0x17, "700105020304+0130" }, - { 358384, 0x17, "700105020304-0130" }, - { 0, 0x17, "700105020304+01" }, - { 0, 0x17, "700105020304-01" }, - { 0, 0x17, "700105020304" }, - { 0, 0x17, "70010502Z" }, - { 0, 0x17, "7001050203xxZ" }, - { 0, 0x17, "7000050203Z" }, - { 0, 0x17, "7013050203Z" }, - { 5097600, 0x17, "7003010000Z" }, - { 68256000, 0x17, "7203010000Z" }, - { 951868800, 0x17, "0003010000Z" }, - { 4107542400, 0x18, "210003010000Z" } + { 352980, 0x18, "197001050203Z" }, + { 352984, 0x18, "19700105020304Z" }, + { 352980, 0x17, "7001050203Z" }, + { 347580, 0x17, "7001050203+0130" }, + { 358380, 0x17, "7001050203-0130" }, + { 352984, 0x17, "700105020304Z" }, + { 347584, 0x17, "700105020304+0130" }, + { 358384, 0x17, "700105020304-0130" }, + { 0, 0x17, "700105020304+01" }, + { 0, 0x17, "700105020304-01" }, + { 0, 0x17, "700105020304" }, + { 0, 0x17, "70010502Z" }, + { 0, 0x17, "7001050203xxZ" }, + { 0, 0x17, "7000050203Z" }, + { 0, 0x17, "7013050203Z" }, + { 5097600, 0x17, "7003010000Z" }, + { 68256000, 0x17, "7203010000Z" }, + { 951868800, 0x17, "0003010000Z" }, + { 4107542400UL, 0x18, "210003010000Z" } }; int i; @@ -480,7 +480,7 @@ START_TEST(test_asn1_to_time) for (i = 0; i < countof(test); i++) { - if (test[i].time > TIME_32_BIT_SIGNED_MAX && sizeof(time_t) == 4) + if (sizeof(time_t) == 4 && test[i].time < 0) { continue; } @@ -503,18 +503,18 @@ START_TEST(test_asn1_from_time) } testdata_t; testdata_t test[] = { - { 352984, 0x18, chunk_from_chars( - 0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35, - 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) }, - { 352984, 0x17, chunk_from_chars( - 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35, - 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) }, - { 1078099200, 0x17, chunk_from_chars( - 0x17, 0x0d, 0x30, 0x34, 0x30, 0x33, 0x30, 0x31, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) }, - { 4107542400, 0x18, chunk_from_chars( - 0x18, 0x0f, 0x32, 0x31, 0x30, 0x30, 0x30, 0x33, 0x30, 0x31, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) } + { 352984, 0x18, chunk_from_chars( + 0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35, + 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) }, + { 352984, 0x17, chunk_from_chars( + 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35, + 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) }, + { 1078099200, 0x17, chunk_from_chars( + 0x17, 0x0d, 0x30, 0x34, 0x30, 0x33, 0x30, 0x31, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) }, + { 4107542400UL, 0x18, chunk_from_chars( + 0x18, 0x0f, 0x32, 0x31, 0x30, 0x30, 0x30, 0x33, 0x30, 0x31, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) } }; int i; @@ -522,10 +522,10 @@ START_TEST(test_asn1_from_time) for (i = 0; i < countof(test); i++) { - if (test[i].time > TIME_32_BIT_SIGNED_MAX && sizeof(time_t) == 4) - { + if (sizeof(time_t) == 4 && test[i].time < 0) + { continue; - } + } chunk = asn1_from_time(&test[i].time, test[i].type); ck_assert(chunk_equals(chunk, test[i].chunk)); free(chunk.ptr); |