Make the signertest work better with the portable test framework
authortb <tb@openbsd.org>
Fri, 14 Apr 2023 12:41:26 +0000 (12:41 +0000)
committertb <tb@openbsd.org>
Fri, 14 Apr 2023 12:41:26 +0000 (12:41 +0000)
regress/lib/libtls/signer/Makefile
regress/lib/libtls/signer/signertest.c

index 7110e9f..ac72edf 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.3 2022/06/15 06:14:59 tb Exp $
+#      $OpenBSD: Makefile,v 1.4 2023/04/14 12:41:26 tb Exp $
 
 PROG=  signertest
 LDADD= -lcrypto -lssl ${TLS_INT}
@@ -7,12 +7,6 @@ DPADD= ${LIBCRYPTO} ${LIBSSL} ${LIBTLS}
 WARNINGS=      Yes
 CFLAGS+=       -DLIBRESSL_INTERNAL -Wall -Wundef -Werror
 CFLAGS+=       -I${.CURDIR}/../../../../lib/libtls/
-
-REGRESS_TARGETS= \
-       regress-signertest
-
-regress-signertest: ${PROG}
-       ./signertest \
-           ${.CURDIR}/../../libssl/certs
+CFLAGS+=       -DCERTSDIR=\"${.CURDIR}/../../libssl/certs\"
 
 .include <bsd.regress.mk>
index 89af257..f0523d3 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: signertest.c,v 1.5 2022/03/24 15:58:57 tb Exp $ */
+/* $OpenBSD: signertest.c,v 1.6 2023/04/14 12:41:26 tb Exp $ */
 /*
  * Copyright (c) 2017, 2018, 2022 Joel Sing <jsing@openbsd.org>
  *
 
 #include "tls_internal.h"
 
-const char *cert_path;
+#ifndef CERTSDIR
+#define CERTSDIR "."
+#endif
+
+const char *cert_path = CERTSDIR;
 int sign_cb_count;
 
 static void
@@ -453,12 +457,12 @@ main(int argc, char **argv)
 {
        int failure = 0;
 
-       if (argc != 2) {
-               fprintf(stderr, "usage: %s certpath\n", argv[0]);
+       if (argc > 2) {
+               fprintf(stderr, "usage: %s [certpath]\n", argv[0]);
                return (1);
        }
-
-       cert_path = argv[1];
+       if (argc == 2)
+               cert_path = argv[1];
 
        failure |= do_signer_tests();
        failure |= do_signer_tls_tests();