[libvirt] [PATCH] tests: Move tools under tests/tools/
Michal Privoznik
mprivozn at redhat.com
Tue May 7 13:01:46 UTC 2019
On 5/7/19 1:15 PM, Daniel P. Berrangé wrote:
> On Tue, May 07, 2019 at 12:49:18PM +0200, Michal Privoznik wrote:
>> On 5/7/19 11:13 AM, Daniel P. Berrangé wrote:
>>> On Mon, May 06, 2019 at 10:01:37AM +0200, Michal Privoznik wrote:
>>>> There are some scripts/binaries that are not tests themselves but
>>>> rather fulfill support purpose. Separate them from the rest of
>>>> the tests.
>>>>
>>>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>>>> ---
>>>> .gitignore | 2 +-
>>>> Makefile.am | 2 +-
>>>> cfg.mk | 4 +-
>>>> configure.ac | 1 +
>>>> tests/Makefile.am | 22 +-----
>>>> tests/qemucapabilitiestest.c | 4 +-
>>>> tests/testutils.c | 2 +-
>>>> tests/{ => tools}/.valgrind.supp | 0
>>>> tests/tools/Makefile.am | 85 +++++++++++++++++++++
>>>> tests/{ => tools}/check-file-access.pl | 0
>>>> tests/{ => tools}/file_access_whitelist.txt | 0
>>>> tests/{ => tools}/group-qemu-caps.pl | 0
>>>> tests/{ => tools}/oomtrace.pl | 0
>>>> tests/{ => tools}/qemucapsprobe.c | 0
>>>> tests/{ => tools}/qemucapsprobemock.c | 0
>>>> tests/{ => tools}/test-wrap-argv.pl | 2 +-
>>>> 16 files changed, 98 insertions(+), 26 deletions(-)
>>>> rename tests/{ => tools}/.valgrind.supp (100%)
>>>> create mode 100644 tests/tools/Makefile.am
>>>> rename tests/{ => tools}/check-file-access.pl (100%)
>>>> rename tests/{ => tools}/file_access_whitelist.txt (100%)
>>>> rename tests/{ => tools}/group-qemu-caps.pl (100%)
>>>> rename tests/{ => tools}/oomtrace.pl (100%)
>>>> rename tests/{ => tools}/qemucapsprobe.c (100%)
>>>> rename tests/{ => tools}/qemucapsprobemock.c (100%)
>>>> rename tests/{ => tools}/test-wrap-argv.pl (98%)
>>>
>>> If we're going to re-arrange our tests, then I would really like to
>>> see the goal be to remove the top level "tests/" directory entirely.
>>>
>>> Instead move the tests under the src/ sub-directory that corresponds
>>> to the code being tested. eg we should have src/util/virhashtest.c
>>> alongside src/util/virhash.c So instead of one giant test dir we
>>> have everything distributed.
>>>
>>> That way if you are running "make" in the src/ directory, you don't
>>> need to change dir to do tests.
I don't know what your workflow is, but I have a terminal open at
toplevel libvirt.git and then run vim over individual files, e.g.
libvirt.git $ vim src/qemu/qemu_driver.c
libvirt.git $ vim tools/virsh.c
This way I can have tags in libvirt.git and can access them from
whatever file I'm in. Running binaries is a bit more verbose:
libvirt.git $ ./src/libvirtd --listen
For tests I have a separate terminal open which entered tests:
libvirt.git/tests $
So the benefin of having virhashtest next to virhash.c highly depends on
one's workflow.
>>> It will also let us split up the
>>> ever growing set of makefile rules for tests.
>>
>> How is that? Won't we have to have the rules to build tests in
>> src/Makefile.am?
>
> Most of the rules will be in the many src/*/Makefile.in.am files
Yeah, while the overall number of rules won't change, they'll be spread
accross multiple Makefiles.
>
>> Personally, I find having code along side with the tests even more
>> disaranged than what we have now. For some unit tests we can have strict
>> naming scheme: virhash.c -> virhashtest.c; but for some more advanced tests
>> qemuxml2*test this won't work.
>
> We don't need to rename everything - that could be src/qemu/qemuxml2argvtest.c
> easily enough
>
Okay, let me send a v2 and see what others think.
Michal
More information about the libvir-list
mailing list