Make the apitest work better with the portable tets framework
authortb <tb@openbsd.org>
Fri, 14 Apr 2023 12:38:30 +0000 (12:38 +0000)
committertb <tb@openbsd.org>
Fri, 14 Apr 2023 12:38:30 +0000 (12:38 +0000)
regress/lib/libssl/api/Makefile
regress/lib/libssl/api/apitest.c

index 0989fc2..7f74551 100644 (file)
@@ -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 <bsd.regress.mk>
index b5a5c54..9a58de9 100644 (file)
@@ -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 <jsing@openbsd.org>
  *
 #include <openssl/err.h>
 #include <openssl/ssl.h>
 
-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();