diff options
Diffstat (limited to 'deps/openssl/openssl/test/v3ext.c')
-rw-r--r-- | deps/openssl/openssl/test/v3ext.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/deps/openssl/openssl/test/v3ext.c b/deps/openssl/openssl/test/v3ext.c index 1c1f788a73..14ae49969d 100644 --- a/deps/openssl/openssl/test/v3ext.c +++ b/deps/openssl/openssl/test/v3ext.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -13,30 +13,35 @@ #include <openssl/pem.h> #include <openssl/err.h> -int main(int ac, char **av) +#include "testutil.h" + +static const char *infile; + +static int test_pathlen(void) { X509 *x = NULL; BIO *b = NULL; long pathlen; - int ret = 1; + int ret = 0; - if (ac != 2) { - fprintf(stderr, "Usage error\n"); - goto end; - } - b = BIO_new_file(av[1], "r"); - if (b == NULL) + if (!TEST_ptr(b = BIO_new_file(infile, "r")) + || !TEST_ptr(x = PEM_read_bio_X509(b, NULL, NULL, NULL)) + || !TEST_int_eq(pathlen = X509_get_pathlen(x), 6)) goto end; - x = PEM_read_bio_X509(b, NULL, NULL, NULL); - if (x == NULL) - goto end; - pathlen = X509_get_pathlen(x); - if (pathlen == 6) - ret = 0; + + ret = 1; end: - ERR_print_errors_fp(stderr); BIO_free(b); X509_free(x); return ret; } + +int setup_tests(void) +{ + if (!TEST_ptr(infile = test_get_argument(0))) + return 0; + + ADD_TEST(test_pathlen); + return 1; +} |