Skip to content

Commit eff8835

Browse files
author
Andras Fekete
committed
Fix CERTS_DIR for 'make distcheck' to have the correct path
1 parent bb6d02f commit eff8835

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

test/include.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ check_PROGRAMS += test/unit.test
99
noinst_PROGRAMS += test/unit.test
1010
DISTCLEANFILES += test/.libs/unit.test
1111

12+
# Override the 'certs' directory with the toplevel source directory for 'make distcheck' to work
13+
test_unit_test_CPPFLAGS = -DCERTS_DIR='"$(abs_top_srcdir)/certs/"'
1214
test_unit_test_SOURCES = \
1315
test/test_aestag.c \
1416
test/test_cipher.c \

test/test_ecc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ int test_ec_load_key(void* data)
14111411
params[0] = OSSL_PARAM_construct_end();
14121412

14131413
PRINT_MSG("Open ECC private key");
1414-
ctx = OSSL_STORE_open_ex("./certs/ecc-key.pem", wpLibCtx, NULL, NULL, NULL,
1414+
ctx = OSSL_STORE_open_ex(CERTS_DIR"ecc-key.pem", wpLibCtx, NULL, NULL, NULL,
14151415
params, NULL, NULL);
14161416
err = ctx == NULL;
14171417
if (err == 0) {
@@ -1446,7 +1446,7 @@ int test_ec_load_cert(void* data)
14461446
params[0] = OSSL_PARAM_construct_end();
14471447

14481448
PRINT_MSG("Open certificate with ECC public key");
1449-
ctx = OSSL_STORE_open_ex("./certs/server-ecc.pem", wpLibCtx, NULL, NULL,
1449+
ctx = OSSL_STORE_open_ex(CERTS_DIR"server-ecc.pem", wpLibCtx, NULL, NULL,
14501450
NULL, params, NULL, NULL);
14511451
err = ctx == NULL;
14521452
if (err == 0) {

test/test_rsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ int test_rsa_load_key(void* data)
749749
params[0] = OSSL_PARAM_construct_end();
750750

751751
PRINT_MSG("Open RSA private key");
752-
ctx = OSSL_STORE_open_ex("./certs/server-key.pem", wpLibCtx, NULL, NULL,
752+
ctx = OSSL_STORE_open_ex(CERTS_DIR"server-key.pem", wpLibCtx, NULL, NULL,
753753
NULL, params, NULL, NULL);
754754
err = ctx == NULL;
755755
if (err == 0) {
@@ -784,7 +784,7 @@ int test_rsa_load_cert(void* data)
784784
params[0] = OSSL_PARAM_construct_end();
785785

786786
PRINT_MSG("Open certificate with RSA public key");
787-
ctx = OSSL_STORE_open_ex("./certs/server-cert.pem", wpLibCtx, NULL, NULL,
787+
ctx = OSSL_STORE_open_ex(CERTS_DIR"server-cert.pem", wpLibCtx, NULL, NULL,
788788
NULL, params, NULL, NULL);
789789
err = ctx == NULL;
790790
if (err == 0) {

test/unit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ void print_buffer(const char *desc, const unsigned char *buffer, size_t len);
6262
#define TEST_DECL(func, data) { #func, func, data, 0, 0, 0 }
6363
#endif
6464

65+
#ifndef CERTS_DIR
66+
#define CERTS_DIR "./certs/"
67+
#endif
68+
6569
typedef int (*TEST_FUNC)(void *data);
6670
typedef struct TEST_CASE {
6771
const char *name;

0 commit comments

Comments
 (0)