From: tb Date: Fri, 14 Apr 2023 12:37:20 +0000 (+0000) Subject: Make cttest work better with the portable test harness X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9fe04e22c18f0c99b62b7597f885b65a4d416baf;p=openbsd Make cttest work better with the portable test harness --- diff --git a/regress/lib/libcrypto/ct/Makefile b/regress/lib/libcrypto/ct/Makefile index 5cfdf74c115..a30fd1c2780 100644 --- a/regress/lib/libcrypto/ct/Makefile +++ b/regress/lib/libcrypto/ct/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2023/04/14 11:18:40 tb Exp $ +# $OpenBSD: Makefile,v 1.6 2023/04/14 12:37:20 tb Exp $ PROG= cttest LDADD= -lcrypto @@ -7,8 +7,6 @@ DPADD= ${LIBCRYPTO} WARNINGS= Yes CFLAGS+= -Wundef -Werror CFLAGS+= -DLIBRESSL_CRYPTO_INTERNAL -DLIBRESSL_INTERNAL - -run-regress-cttest: cttest - ./cttest ${.CURDIR}/../../libcrypto/ct/ +CFLAGS+= -DCTPATH=\"${.CURDIR}\" .include diff --git a/regress/lib/libcrypto/ct/cttest.c b/regress/lib/libcrypto/ct/cttest.c index 8986c938833..a0c75560efc 100644 --- a/regress/lib/libcrypto/ct/cttest.c +++ b/regress/lib/libcrypto/ct/cttest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cttest.c,v 1.5 2023/04/14 11:18:40 tb Exp $ */ +/* $OpenBSD: cttest.c,v 1.6 2023/04/14 12:37:20 tb Exp $ */ /* * Copyright (c) 2021 Joel Sing * @@ -23,6 +23,10 @@ #include #include +#ifndef CTPATH +#define CTPATH "." +#endif + char *test_ctlog_conf_file; char *test_cert_file; char *test_issuer_file; @@ -452,14 +456,15 @@ ct_sct_verify_test(void) int main(int argc, char **argv) { - const char *ctpath; + const char *ctpath = CTPATH; int failed = 0; - if (argc != 2) { - fprintf(stderr, "usage: %s ctpath\n", argv[0]); + if (argc > 2) { + fprintf(stderr, "usage %s [ctpath]\n", argv[0]); exit(1); } - ctpath = argv[1]; + if (argc == 2) + ctpath = argv[1]; if (asprintf(&test_cert_file, "%s/%s", ctpath, "libressl.org.crt") == -1)