[gnutls-devel] [PATCH] build: tests: x509cert-tl: support separate builddir

Alon Bar-Lev alon.barlev at gmail.com
Sun Aug 24 20:57:50 CEST 2014


Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 tests/Makefile.am   | 1 +
 tests/x509cert-tl.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6638fce..6081358 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -128,6 +128,7 @@ TESTS_ENVIRONMENT =						\
 	PKCS12FILE_2=$(srcdir)/pkcs12-decode/pkcs12_2certs.p12	\
 	PKCS12PASSWORD_2=""					\
 	PKCS12PATH=$(srcdir)/pkcs12-decode/			\
+	X509CERTDIR=$(srcdir)/x509cert-dir/			\
 	EXEEXT=$(EXEEXT)					\
 	top_builddir="$(top_builddir)"				\
 	srcdir="$(srcdir)"
diff --git a/tests/x509cert-tl.c b/tests/x509cert-tl.c
index dad7860..5ecc03e 100644
--- a/tests/x509cert-tl.c
+++ b/tests/x509cert-tl.c
@@ -189,6 +189,7 @@ static time_t mytime(time_t * t)
 void doit(void)
 {
 	int ret;
+	const char *path;
 	gnutls_datum_t data;
 	gnutls_x509_crt_t server_crt, ca_crt2;
 	gnutls_x509_trust_list_t tl;
@@ -209,7 +210,10 @@ void doit(void)
 	gnutls_x509_crt_init(&server_crt);
 	gnutls_x509_crt_init(&ca_crt2);
 
-	ret = gnutls_x509_trust_list_add_trust_dir(tl, "./x509cert-dir", NULL, GNUTLS_X509_FMT_PEM, 0, 0);
+	path = getenv("X509CERTDIR");
+	if (!path)
+		path = "./x509cert-dir";
+	ret = gnutls_x509_trust_list_add_trust_dir(tl, path, NULL, GNUTLS_X509_FMT_PEM, 0, 0);
 	if (ret != 1)
 		fail("gnutls_x509_trust_list_add_trust_dir: %d\n", ret);
 
-- 
1.8.5.5




More information about the Gnutls-devel mailing list