git: 0281cacc0a7c - main - cad/py-cocotb: Fix the test target

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 05 Feb 2023 18:09:32 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0281cacc0a7c2955dd24b168d017b3fdbcdd74a4

commit 0281cacc0a7c2955dd24b168d017b3fdbcdd74a4
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-02-05 18:07:25 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-02-05 18:09:28 +0000

    cad/py-cocotb: Fix the test target
---
 cad/py-cocotb/Makefile | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/cad/py-cocotb/Makefile b/cad/py-cocotb/Makefile
index a2168ec07d4d..211f36f0ab29 100644
--- a/cad/py-cocotb/Makefile
+++ b/cad/py-cocotb/Makefile
@@ -14,13 +14,18 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}find-libpython>0:devel/py-find-libpython@${PY_FLAVOR} \
 		gtkwave:cad/gtkwave
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR}
 
-USES=		python:3.6+
-USE_PYTHON=	pep517 autoplist pytest # https://github.com/cocotb/cocotb/issues/3230
+USES=		python:3.6+ shebangfix
+USE_PYTHON=	pep517 autoplist
 USE_GITHUB=	yes
 
-TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
-TEST_WRKSRC=	${WRKSRC}/tests
+SHEBANG_GLOB=	*.py
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} \
+		PATH=${STAGEDIR}${LOCALBASE}/bin:${PATH} \
+		LD_LIBRARY_PATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/cocotb/libs \
+		SIM=icarus
 
 OPTIONS_DEFINE=		IVERILOG VERILATOR # GHDL - TODO
 OPTIONS_DEFAULT=	IVERILOG VERILATOR
@@ -37,4 +42,7 @@ post-install:
 		${STAGEDIR}${PYTHON_SITELIBDIR}/cocotb/libs/lib*.so \
 		${STAGEDIR}${PYTHON_SITELIBDIR}/cocotb/libs/libcocotbvpi_icarus.vpl
 
+do-test: # some tests fail, see https://github.com/cocotb/cocotb/issues/3236
+	@cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${GMAKE} test
+
 .include <bsd.port.mk>