I'm writing a meson.build file where I run several tests. These tests need a server running on a port in order to run successfully.
I started with this:
exe = executable('tests-client', 'tests-client.c')
test('test-client', suite: 'foo')
To run the tests I do:
$ meson test --suite foo
To launch the server, I run a script before the test
call:
exe = executable('tests-client', 'tests-client.c')
run_command('start-server.sh')
test('test-client', suite: 'foo')
However, this doesn't work because run_script
runs when meson builds, not when the tests are run. I also tried to run the server as if it was a test, but although it may work, it's semantically incorrect.
question from:
https://stackoverflow.com/questions/65838760/meson-how-to-run-tests-that-depend-on-an-external-process 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…