[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tests in libconfig-model-dpkg-perl



On Monday, 28 August 2017 03:50:14 CEST Martín Ferrari wrote:
> I have just pushed commit 13b6b51 that extends autopkgtest support in
> libconfig-model-dpkg-perl. It adds full support for pkg-go, and makes it
> recognise also dkms, elpa, nodejs, python, and r as valid testsuites.

Thanks. I welcome the effort :-)

> While doing this, I added some tests, and actually verified they failed
> before modifing the code. Surprisingly, I found that some of them did not!
> 
> foreach my $target (qw(dkms elpa go nodejs perl python r ruby)) {
>     warning_is {
>         $root->load("control source Testsuite=autopkgtest-pkg-$target");
>     } undef, "check that Testsuite is accepted for autopkgtest-pkg-$target";
> }

At this point in the test, Maintainer is set to foo\@bar.com. In this case, 
any valid value of autopkgtest-pkg-* is accepted as you found out.

The value of autopkgtest-pkg-* depends on Maintainer only if Maintainer is set 
to a known packaging team. 

Dpkg source model (Source.pl file) contains 3 tests for Testsuite values to 
provide fine grained error messages:
* warn-unless:defined-test: check if Testsuite is defined *when* packaging team 
supports it (i,e, the team is "well-known" -- fancy wording to say hardcoded)
* warn-unless:team-test: check if Testsuite value matches the team names (if 
it's a wel-known team)
* warn_unless match: test whether Testsuite value is valid. This is the only 
tests that can trap an unvalid Testsuite value when the maintainer is not well 
known. 

I now wonder now if the last test makes sense: for instance, can maintainer 
joe@stuff.com set this value to autopkgtest-pkg-perl ?

The "fix" code is the same for the 3 tests.

You have correctly modified the "warn_unless_match" test, but the "warn_unless" 
(without match) tests and the fixes do not take into account the teams you want 
to add. I.e. the regexp must be updated with (dkms|elpa|go|nodejs|perl|python|
r|ruby) as you did for "warn_unless_match";

I acknowledge that there's a fair bit of duplication in there. I don't know 
hoe to improve this while keeping the declarative nature of Dpkg model.

> I noticed that this was dependent on ordering, and since I really don't
> understand much what's going on on these tests,

Ouch, I guess that I need to add comments in there :/

> So, I would appreciate it if somebody who knows better takes a look at
> this :-)

I hope I explained what's going on. Once all the regexpes are consistent, the 
tests should behave in a more, err, predicatable way.

I let you decide whether you want to finish this enhancement, or you want me to 
take over.

Since the bus factor on cme is quite bad, I'd rather you choose the first 
option... ;-) Be sure that I'll help you get there.

All the best

-- 
 https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org


Reply to: