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 <lan...@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.
> 
> I had discovered this problem at archivers/py-zstandard which I made for
> mitmproxy, but it was more than two months ago I and can not easily recall
> why it's help and how I discovered this hack.
> 
> Probably it doesn't have the correct PYTHONPATH and I can't figure out how
> to set it correctly in case of cffi on this port.

i've tried playing with MODPY_TEST_LIBDIR to give it the right path to
the synapse_rust.abi3.so file, but everything i've tried so far fails.

one can easily reproduce the issue:
- go to WRKSRC
- LD_DEBUG=1 python3

>>> import tests.api.test_auth
dlopen: loading: /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so   
                                                    
objname [/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so], dynp 
0xdbef10a3840, objtype 4 lbase dbef107b000, obase dbef107b000
 flags /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so = 0x0      
head /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so               
                                                         
obj /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so has 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so as head 
linking /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so as 
dlopen()ed
head [/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so]             
                                                         
examining: '/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so'    
loading: libsodium.so.10.2 required by 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so
objname [/usr/local/lib/libsodium.so.10.2], dynp 0xdbe3db09858, objtype 3 lbase 
dbe3da87000, obase dbe3da87000
 flags /usr/local/lib/libsodium.so.10.2 = 0x1                                   
                                                         
obj /usr/local/lib/libsodium.so.10.2 has 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so as head
linking dep /usr/local/lib/libsodium.so.10.2 as child of 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so
examining: '/usr/local/lib/libsodium.so.10.2'                                   
                                                         
loading: libpthread.so.27.1 required by /usr/local/lib/libsodium.so.10.2        
                          
linking dep /usr/lib/libpthread.so.27.1 as child of 
/usr/local/lib/libsodium.so.10.2                      
tail /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so               
                                                         
protect RELRO [0xdbe3db08090,0xdbe3db0a000) in /usr/local/lib/libsodium.so.10.2 
                                 
doing ctors obj 0xdbe9f5ba000 @0xdbe3db05ac0: 
[/usr/local/lib/libsodium.so.10.2]                                     
protect RELRO [0xdbef10a10f0,0xdbef10a5000) in 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so
doing ctors obj 0xdbe9f5b9000 @0xdbef109e4e0: 
[/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so]
dlopen: /usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so: done 
(success).                     
dlsym: PyInit__sodium in 
/usr/local/lib/python3.11/site-packages/nacl/_sodium.abi3.so: 0xdbef108b060
Traceback (most recent call last):                                              
                                                         
  File "<stdin>", line 1, in <module>                                           
                                                         
  File "/usr/obj/ports/synapse-1.112.0/synapse-1.112.0/tests/api/test_auth.py", 
line 28, in <module>     
    from synapse.api.auth.internal import InternalAuth                          
                                                         
  File "/usr/obj/ports/synapse-1.112.0/synapse-1.112.0/synapse/__init__.py", 
line 32, in <module>
    from synapse.util.rust import check_rust_lib_up_to_date                     
                                                         
  File "/usr/obj/ports/synapse-1.112.0/synapse-1.112.0/synapse/util/rust.py", 
line 27, in <module>          
    from synapse.synapse_rust import get_rust_file_digest                       
                                                         
ImportError: cannot import name 'get_rust_file_digest' from 
'synapse.synapse_rust' (unknown location)        
>>>
so something doesnt set the right path to find
build/lib.openbsd-7.6-amd64-cpython-311/synapse/synapse_rust.abi3.so, but thats
not PYTHONPATH nor LD_LIBRARY_PATH.

as for the tests needing a database, its a bit more convoluted since it
needs a fullblown instance running:

synapse.storage.prepare_database.UpgradeDatabaseException: Uninitialised
database: run the main synapse process to prepare the database schema
before starting worker processes.

Landry

Reply via email to