#include "ssltestlib.h"
#include "testutil.h"
-#include "test_main_custom.h"
static char *cert = NULL;
static char *privkey = NULL;
+static unsigned int timer_cb_count;
#define NUM_TESTS 2
#define RECORD_SEQUENCE 10
+static unsigned int timer_cb(SSL *s, unsigned int timer_us)
+{
+ ++timer_cb_count;
+
+ if (timer_us == 0)
+ return 1000000;
+ else
+ return 2 * timer_us;
+}
+
static int test_dtls_unprocessed(int testidx)
{
SSL_CTX *sctx = NULL, *cctx = NULL;
BIO *c_to_s_fbio, *c_to_s_mempacket;
int testresult = 0;
+ timer_cb_count = 0;
+
if (!TEST_true(create_ssl_ctx_pair(DTLS_server_method(),
DTLS_client_method(), &sctx,
&cctx, cert, privkey)))
NULL, c_to_s_fbio)))
goto end;
+ DTLS_set_timer_cb(clientssl1, timer_cb);
+
if (testidx == 1)
certstatus[RECORD_SEQUENCE] = 0xff;
SSL_ERROR_NONE)))
goto end;
+ if (timer_cb_count == 0) {
+ printf("timer_callback was not called.\n");
+ goto end;
+ }
+
testresult = 1;
end:
SSL_free(serverssl1);
return testresult;
}
-int test_main(int argc, char *argv[])
+int setup_tests(void)
{
- int testresult = 1;
-
- if (!TEST_int_eq(argc, 3))
- return 1;
-
- cert = argv[1];
- privkey = argv[2];
+ if (!TEST_ptr(cert = test_get_argument(0))
+ || !TEST_ptr(privkey = test_get_argument(1)))
+ return 0;
ADD_ALL_TESTS(test_dtls_unprocessed, NUM_TESTS);
+ return 1;
+}
- testresult = run_tests(argv[0]);
-
+void cleanup_tests(void)
+{
bio_f_tls_dump_filter_free();
bio_s_mempacket_test_free();
-
- return testresult;
}