On 03/19/2018 05:04 PM, Alexander
Kanavin wrote:
On 03/19/2018 06:53 AM, ChenQi wrote:
For autotools,
1) if the test framework of some package is a standalone set of
scripts or it could be easily decoupled from Makefile, adding
ptest support for such package is easy.
2) if the test framework of some package is coupled with
Makefile, we need to adjust or replace vars in Makefile, install
make on target and rely on the Makefile to run tests. In such
case, adding ptest is not easy.
For meson, the test framework is coupled with meson/ninja. We
need to at least install ninja and meson on target as a first
step. Maybe we need to adjust other things in do_install_ptest.
That's why I said "there's no easy way to add ptest support."
Why didn't I look further into this problem? Because I view
ptest support as optional, not necessary.
What I thought was: "let's upgrade the package first. If ptest
support is required from community, deal with that in a separate
patch."
Now that I've got feedback from you, I think I'll look further
into this issue and try to add ptest support via a separate
patch.
But is it tightly coupled with meson/ninja? From what I see here:
https://github.com/systemd/systemd/blob/master/test/meson.build
there is no testing logic as such in the meson.build file, it
simply runs a few test scripts, and checks the outcome. Which we
can easily replicate in a script.
Alex
Hi Alex,
The test framework meson uses is like:
e = executable('prog', 'testprog.c')
test('name of test', e)
http://mesonbuild.com/Unit-tests.html
So they could be defined in any valid meson.build file. In systemd's
case, most of them are in top-level meson.build.
I agree with you that it's possible to extract all these test cases
and hold them in a custom script we write. I think this could serve
as a fall-back approach to adding ptest support for systemd.
But I'd like to spend some time to try to find a more general
approach, avoiding headaches when upgrading.
Best Regards,
Chen Qi