diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-06-03 18:34:10 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-06-03 18:34:10 +0000 |
commit | f143c3cab79c59dd57124f19d16ac35253843136 (patch) | |
tree | 9fa67aa3d59e9d96f5f37858e95c4ab91960ea92 /test/test_ssl.c | |
parent | 6f61a1acd01dc2ad1d2f5c1f7458702c77c69f9c (diff) | |
download | libserf-tarball-fb6ad73dfc340d81d364f2c8bf791bcf6e84fb67.tar.gz |
serf-1.2.1HEADserf-1.2.1master
Diffstat (limited to 'test/test_ssl.c')
-rw-r--r-- | test/test_ssl.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/test_ssl.c b/test/test_ssl.c index 81b939d..43e9f9a 100644 --- a/test/test_ssl.c +++ b/test/test_ssl.c @@ -55,14 +55,28 @@ static void test_ssl_init(CuTest *tc) test_teardown(test_pool); } + +static const char * get_ca_file(apr_pool_t *pool, const char * file) +{ + char *srcdir = ""; + + if (apr_env_get(&srcdir, "srcdir", pool) == APR_SUCCESS) { + return apr_pstrcat(pool, srcdir, "/", file, NULL); + } + else { + return file; + } +} + + /* Test that loading a custom CA certificate file works. */ static void test_ssl_load_cert_file(CuTest *tc) { serf_ssl_certificate_t *cert = NULL; apr_pool_t *test_pool = test_setup(); - apr_status_t status = serf_ssl_load_cert_file(&cert, "test/serftestca.pem", - test_pool); + apr_status_t status = serf_ssl_load_cert_file( + &cert, get_ca_file(test_pool, "test/serftestca.pem"), test_pool); CuAssertIntEquals(tc, APR_SUCCESS, status); CuAssertPtrNotNull(tc, cert); @@ -78,7 +92,8 @@ static void test_ssl_cert_subject(CuTest *tc) apr_pool_t *test_pool = test_setup(); - status = serf_ssl_load_cert_file(&cert, "test/serftestca.pem", test_pool); + status = serf_ssl_load_cert_file( + &cert, get_ca_file(test_pool, "test/serftestca.pem"), test_pool); CuAssertIntEquals(tc, APR_SUCCESS, status); CuAssertPtrNotNull(tc, cert); |