Index | Thread | Search

From:
Landry Breuil <landry@openbsd.org>
Subject:
Re: net/synapse: fix tests
To:
ports@openbsd.org
Date:
Sun, 25 Aug 2024 09:07:11 +0200

Download raw body.

Thread
Le Thu, Aug 22, 2024 at 10:04:45AM +0200, Landry Breuil a écrit :
> Le Thu, Aug 22, 2024 at 09:40:23AM +0200, Landry Breuil a écrit :
> > Le Wed, Aug 21, 2024 at 06:11:32PM +0200, Kirill A. Korinsky a écrit :
> > > On Wed, 21 Aug 2024 17:16:11 +0200,
> > > Landry Breuil <landry@openbsd.org> wrote:
> > > > 
> > > > Le Wed, Aug 21, 2024 at 05:00:21PM +0200, Landry Breuil a écrit :
> > > > > Le Wed, Aug 21, 2024 at 03:49:45PM +0200, Kirill A. Korinsky a écrit :
> > > > > > ports@,
> > > > > > 
> > > > > > Here a ping from another diff from my
> > > > > 
> > > > > can you explain the dance about dropping/copying tests in pre-test ?
> > > > > why was that needed ? isn't doing MODPY_PYTEST_ARGS = --forked enough ?
> > > > 
> > > > now that i've tested, this fails with a rather strange error (strange as
> > > > in "i dont understand why moving tests/ around helps") on all test files:
> > > >
> > > 
> > > and I confirm that this is the problem I am overlooking by moving tests.
> 
> it feels we're getting close.. but not yet.

this version with a symlink for the rust lib works, and it's probably what im
going to commit. fixing the tests requiring a throwaway synapse test instance
is left for future work.

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/synapse/Makefile,v
diff -u -r1.82 Makefile
--- Makefile    31 Jul 2024 16:01:52 -0000      1.82
+++ Makefile    25 Aug 2024 07:04:41 -0000
@@ -72,10 +72,20 @@
 TEST_DEPENDS = ${FULLPKGNAME}:${BUILD_PKGPATH} \
                devel/py-mock${MODPY_FLAVOR} \
                devel/py-parameterized${MODPY_FLAVOR} \
+               devel/py-test-forked${MODPY_FLAVOR} \
                www/py-jwt${MODPY_FLAVOR}
 
 do-configure:
        @${MODCARGO_configure}
+
+MODPY_PYTEST_ARGS =    --forked
+
+# some tests fail, but they need a previously running synapse process, not just a database
+# E synapse.storage.prepare_database.UpgradeDatabaseException: Uninitialised database:
+# run the main synapse process to prepare the database schema before starting worker processes.
+# make sure that the rust library is found
+pre-test:
+       ln -sf ${WRKSRC}/build/lib.openbsd-${OSREV}-${ARCH}-cpython-${MODPY_MAJORMINOR}/synapse/synapse_rust.abi3.so ${WRKSRC}/synapse/
 
 # to generate rust modules.inc:
 #  make modcargo-gen-crates and modcargo-gen-crates-licenses

Landry