From 172e4b14195019a7bc72f63f2a62581d7903b8ec Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 14 Apr 2023 12:38:30 +0000 Subject: [PATCH] Make the apitest work better with the portable tets framework --- regress/lib/libssl/api/Makefile | 10 ++-------- regress/lib/libssl/api/apitest.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/regress/lib/libssl/api/Makefile b/regress/lib/libssl/api/Makefile index 0989fc22643..7f745518ebc 100644 --- a/regress/lib/libssl/api/Makefile +++ b/regress/lib/libssl/api/Makefile @@ -1,16 +1,10 @@ -# $OpenBSD: Makefile,v 1.1 2022/01/05 09:59:39 jsing Exp $ +# $OpenBSD: Makefile,v 1.2 2023/04/14 12:38:30 tb Exp $ PROG= apitest LDADD= -lssl -lcrypto DPADD= ${LIBSSL} ${LIBCRYPTO} WARNINGS= Yes CFLAGS+= -DLIBRESSL_INTERNAL -Werror - -REGRESS_TARGETS= \ - regress-apitest - -regress-apitest: ${PROG} - ./apitest \ - ${.CURDIR}/../../libssl/certs +CFLAGS+= -DCERTSDIR=\"${.CURDIR}/../../libssl/certs\" .include diff --git a/regress/lib/libssl/api/apitest.c b/regress/lib/libssl/api/apitest.c index b5a5c544e2f..9a58de9f835 100644 --- a/regress/lib/libssl/api/apitest.c +++ b/regress/lib/libssl/api/apitest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apitest.c,v 1.1 2022/01/05 09:59:39 jsing Exp $ */ +/* $OpenBSD: apitest.c,v 1.2 2023/04/14 12:38:30 tb Exp $ */ /* * Copyright (c) 2020, 2021 Joel Sing * @@ -21,7 +21,11 @@ #include #include -const char *certs_path; +#ifndef CERTSDIR +#define CERTSDIR "." +#endif + +const char *certs_path = CERTSDIR; int debug = 0; @@ -357,11 +361,12 @@ main(int argc, char **argv) { int failed = 0; - if (argc != 2) { - fprintf(stderr, "usage: %s certspath\n", argv[0]); + if (argc > 2) { + fprintf(stderr, "usage: %s [certspath]\n", argv[0]); exit(1); } - certs_path = argv[1]; + if (argc == 2) + certs_path = argv[1]; failed |= ssl_get_peer_cert_chain_tests(); -- 2.20.1