Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1753168232, "reponame":"openssl", "desc":"OpenSSL", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl", "f":3, "items": [ {"schema":"libjg2-1", "cid":"05077f3dddc1d004033620d228a97cce", "commit": {"type":"commit", "time": 1511823405, "time_ofs": 600, "oid_tree": { "oid": "a9abf4c057b60e86aa1579336ba668771f04ad8f", "alias": []}, "oid":{ "oid": "b7af3f1433cc0d8d5f88c0b8dcd55c0c2261281a", "alias": []}, "msg": "Test support for time_t comparisons.", "sig_commit": { "git_time": { "time": 1511823405, "offset": 600 }, "name": "Pauli", "email": "paul.dale@oracle.com", "md5": "4616f8cb80bd6ce4dab75d05e07cd125" }, "sig_author": { "git_time": { "time": 1511753255, "offset": 600 }, "name": "Pauli", "email": "paul.dale@oracle.com", "md5": "4616f8cb80bd6ce4dab75d05e07cd125" }}, "body": "Test support for time_t comparisons.\n\nReviewed-by: Richard Levitte \u003clevitte@openssl.org\u003e\nReviewed-by: Andy Polyakov \u003cappro@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/4797)\n" , "diff": "diff --git a/test/test_test.c b/test/test_test.c\nindex 2610cbf..c45bf8d 100644\n--- a/test/test_test.c\n+++ b/test/test_test.c\n@@ -191,6 +191,29 @@ err:\n return 0;\n }\n \n+static int test_time_t(void)\n+{\n+ if (!TEST(1, TEST_time_t_eq((time_t)10, (time_t)10))\n+ | !TEST(0, TEST_time_t_eq((time_t)10, (time_t)12))\n+ | !TEST(1, TEST_time_t_ne((time_t)10, (time_t)12))\n+ | !TEST(0, TEST_time_t_ne((time_t)24, (time_t)24))\n+ | !TEST(1, TEST_time_t_lt((time_t)30, (time_t)88))\n+ | !TEST(0, TEST_time_t_lt((time_t)88, (time_t)30))\n+ | !TEST(1, TEST_time_t_le((time_t)30, (time_t)88))\n+ | !TEST(1, TEST_time_t_le((time_t)33, (time_t)33))\n+ | !TEST(0, TEST_time_t_le((time_t)88, (time_t)30))\n+ | !TEST(1, TEST_time_t_gt((time_t)52, (time_t)33))\n+ | !TEST(0, TEST_time_t_gt((time_t)33, (time_t)52))\n+ | !TEST(1, TEST_time_t_ge((time_t)52, (time_t)33))\n+ | !TEST(1, TEST_time_t_ge((time_t)38, (time_t)38))\n+ | !TEST(0, TEST_time_t_ge((time_t)33, (time_t)52)))\n+ goto err;\n+ return 1;\n+\n+err:\n+ return 0;\n+}\n+\n static int test_pointer(void)\n {\n int x \u003d 0;\n@@ -518,6 +541,7 @@ int setup_tests(void)\n ADD_TEST(test_long);\n ADD_TEST(test_ulong);\n ADD_TEST(test_size_t);\n+ ADD_TEST(test_time_t);\n ADD_TEST(test_pointer);\n ADD_TEST(test_bool);\n ADD_TEST(test_string);\ndiff --git a/test/testutil.h b/test/testutil.h\nindex 2356786..6391905 100644\n--- a/test/testutil.h\n+++ b/test/testutil.h\n@@ -186,6 +186,7 @@ DECLARE_COMPARISONS(char, char)\n DECLARE_COMPARISONS(unsigned char, uchar)\n DECLARE_COMPARISONS(long, long)\n DECLARE_COMPARISONS(unsigned long, ulong)\n+DECLARE_COMPARISONS(time_t, time_t)\n /*\n * Because this comparison uses a printf format specifier that's not\n * universally known (yet), we provide an option to not have it declared.\n@@ -336,6 +337,13 @@ void test_perror(const char *s);\n # define TEST_size_t_gt(a, b) test_size_t_gt(__FILE__, __LINE__, #a, #b, a, b)\n # define TEST_size_t_ge(a, b) test_size_t_ge(__FILE__, __LINE__, #a, #b, a, b)\n \n+# define TEST_time_t_eq(a, b) test_time_t_eq(__FILE__, __LINE__, #a, #b, a, b)\n+# define TEST_time_t_ne(a, b) test_time_t_ne(__FILE__, __LINE__, #a, #b, a, b)\n+# define TEST_time_t_lt(a, b) test_time_t_lt(__FILE__, __LINE__, #a, #b, a, b)\n+# define TEST_time_t_le(a, b) test_time_t_le(__FILE__, __LINE__, #a, #b, a, b)\n+# define TEST_time_t_gt(a, b) test_time_t_gt(__FILE__, __LINE__, #a, #b, a, b)\n+# define TEST_time_t_ge(a, b) test_time_t_ge(__FILE__, __LINE__, #a, #b, a, b)\n+\n # define TEST_ptr_eq(a, b) test_ptr_eq(__FILE__, __LINE__, #a, #b, a, b)\n # define TEST_ptr_ne(a, b) test_ptr_ne(__FILE__, __LINE__, #a, #b, a, b)\n # define TEST_ptr(a) test_ptr(__FILE__, __LINE__, #a, a)\ndiff --git a/test/testutil/tests.c b/test/testutil/tests.c\nindex eb0a393..a60af07 100644\n--- a/test/testutil/tests.c\n+++ b/test/testutil/tests.c\n@@ -15,6 +15,7 @@\n #include \u003cstring.h\u003e\n #include \u003cctype.h\u003e\n #include \u0022internal/nelem.h\u0022\n+#include \u003copenssl/asn1.h\u003e\n \n /*\n * Output a failed test first line.\n@@ -416,3 +417,32 @@ int test_BN_abs_eq_word(const char *file, int line, const char *bns,\n BN_free(aa);\n return 0;\n }\n+\n+static const char *print_time(const ASN1_TIME *t)\n+{\n+ return t \u003d\u003d NULL ? \u0022\u003cnull\u003e\u0022 : (char *)ASN1_STRING_get0_data(t);\n+}\n+\n+#define DEFINE_TIME_T_COMPARISON(opname, op) \u005c\n+ int test_time_t_ ## opname(const char *file, int line, \u005c\n+ const char *s1, const char *s2, \u005c\n+ const time_t t1, const time_t t2) \u005c\n+ { \u005c\n+ ASN1_TIME *at1 \u003d ASN1_TIME_set(NULL, t1); \u005c\n+ ASN1_TIME *at2 \u003d ASN1_TIME_set(NULL, t2); \u005c\n+ int r \u003d at1 !\u003d NULL \u0026\u0026 at2 !\u003d NULL \u005c\n+ \u0026\u0026 ASN1_TIME_compare(at1, at2) op 0; \u005c\n+ if (!r) \u005c\n+ test_fail_message(NULL, file, line, \u0022time_t\u0022, s1, s2, #op, \u005c\n+ \u0022[%s] compared to [%s]\u0022, \u005c\n+ print_time(at1), print_time(at2)); \u005c\n+ ASN1_STRING_free(at1); \u005c\n+ ASN1_STRING_free(at2); \u005c\n+ return r; \u005c\n+ }\n+DEFINE_TIME_T_COMPARISON(eq, \u003d\u003d)\n+DEFINE_TIME_T_COMPARISON(ne, !\u003d)\n+DEFINE_TIME_T_COMPARISON(gt, \u003e)\n+DEFINE_TIME_T_COMPARISON(ge, \u003e\u003d)\n+DEFINE_TIME_T_COMPARISON(lt, \u003c)\n+DEFINE_TIME_T_COMPARISON(le, \u003c\u003d)\n","s":{"c":1753168232,"u": 60769}} ],"g": 62102,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}