public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
@ 2018-08-24 18:24 Mike Gilbert
  2018-08-25  5:41 ` Andrew Savchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Gilbert @ 2018-08-24 18:24 UTC (permalink / raw
  To: gentoo-dev; +Cc: devmanual

---
 general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
index 2f10380..64be9dc 100644
--- a/general-concepts/dependencies/text.xml
+++ b/general-concepts/dependencies/text.xml
@@ -578,6 +578,44 @@ valid.
 </body>
 </section>
 
+<section>
+<title>Test Dependencies</title>
+<body>
+
+<p>
+Packages often have optional dependencies that are needed only when running
+tests. These should be specified in DEPEND behind a USE flag. Often, the
+'test' USE flag is used for this purpose.
+</p>
+
+<p>
+Since testing will likely fail when test dependencies are not installed, the
+test phase should be disabled in this case. This may be accomplished via USE
+conditionals in the RESTRICT variable.
+</p>
+
+<p>
+If other optional features must be enabled/disabled when testing, REQUIRED_USE
+may be set to express this.
+</p>
+
+<codesample lang="ebuild">
+# Define some USE flags
+IUSE="debug test"
+
+# Disable test phase when test USE flag is disabled
+RESTRICT="!test? ( test )"
+
+# Running tests requires 'foo' to be installed
+DEPEND="test? ( dev-util/foo )"
+
+# Require debug support when tests are enabled
+REQUIRED_USE="test? ( debug )"
+</codesample>
+
+</body>
+</section>
+
 </body>
 </chapter>
 </guide>
-- 
2.18.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-24 18:24 [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" Mike Gilbert
@ 2018-08-25  5:41 ` Andrew Savchenko
  2018-08-25 18:24   ` Mike Gilbert
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Savchenko @ 2018-08-25  5:41 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]

On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> ---
>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> index 2f10380..64be9dc 100644
> --- a/general-concepts/dependencies/text.xml
> +++ b/general-concepts/dependencies/text.xml
> @@ -578,6 +578,44 @@ valid.
>  </body>
>  </section>
>  
> +<section>
> +<title>Test Dependencies</title>
> +<body>
> +
> +<p>
> +Packages often have optional dependencies that are needed only when running
> +tests. These should be specified in DEPEND behind a USE flag. Often, the
> +'test' USE flag is used for this purpose.
> +</p>
> +
> +<p>
> +Since testing will likely fail when test dependencies are not installed, the
> +test phase should be disabled in this case. This may be accomplished via USE
> +conditionals in the RESTRICT variable.
> +</p>
> +
> +<p>
> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> +may be set to express this.
> +</p>
> +
> +<codesample lang="ebuild">
> +# Define some USE flags
> +IUSE="debug test"
> +
> +# Disable test phase when test USE flag is disabled
> +RESTRICT="!test? ( test )"

I do not understand why we need this useless code. If test USE flag
is disabled, tests must be disabled as well. It is PM's job and
there is no need to put this obvious stuff into each ebuild with
tests and extra deps. I see no reason to support running src_test()
with USE="-test".

> +# Running tests requires 'foo' to be installed
> +DEPEND="test? ( dev-util/foo )"
> +
> +# Require debug support when tests are enabled
> +REQUIRED_USE="test? ( debug )"
> +</codesample>
> +
> +</body>
> +</section>
> +
>  </body>
>  </chapter>
>  </guide>


Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-25  5:41 ` Andrew Savchenko
@ 2018-08-25 18:24   ` Mike Gilbert
  2018-08-26  2:11     ` Andrew Savchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Gilbert @ 2018-08-25 18:24 UTC (permalink / raw
  To: Gentoo Dev

On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
>
> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> > ---
> >  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> >  1 file changed, 38 insertions(+)
> >
> > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> > index 2f10380..64be9dc 100644
> > --- a/general-concepts/dependencies/text.xml
> > +++ b/general-concepts/dependencies/text.xml
> > @@ -578,6 +578,44 @@ valid.
> >  </body>
> >  </section>
> >
> > +<section>
> > +<title>Test Dependencies</title>
> > +<body>
> > +
> > +<p>
> > +Packages often have optional dependencies that are needed only when running
> > +tests. These should be specified in DEPEND behind a USE flag. Often, the
> > +'test' USE flag is used for this purpose.
> > +</p>
> > +
> > +<p>
> > +Since testing will likely fail when test dependencies are not installed, the
> > +test phase should be disabled in this case. This may be accomplished via USE
> > +conditionals in the RESTRICT variable.
> > +</p>
> > +
> > +<p>
> > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> > +may be set to express this.
> > +</p>
> > +
> > +<codesample lang="ebuild">
> > +# Define some USE flags
> > +IUSE="debug test"
> > +
> > +# Disable test phase when test USE flag is disabled
> > +RESTRICT="!test? ( test )"
>
> I do not understand why we need this useless code. If test USE flag
> is disabled, tests must be disabled as well. It is PM's job and
> there is no need to put this obvious stuff into each ebuild with
> tests and extra deps. I see no reason to support running src_test()
> with USE="-test".

PMS does not specify that behavior (skipping src_test with USE=-test).
It is better to define the requrement explicitly rather than relying
on a Portage-specific behavior.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-25 18:24   ` Mike Gilbert
@ 2018-08-26  2:11     ` Andrew Savchenko
  2018-08-26  7:28       ` Zac Medico
  2018-08-26 13:43       ` Mike Gilbert
  0 siblings, 2 replies; 13+ messages in thread
From: Andrew Savchenko @ 2018-08-26  2:11 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]

On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> >
> > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> > > ---
> > >  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> > >  1 file changed, 38 insertions(+)
> > >
> > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> > > index 2f10380..64be9dc 100644
> > > --- a/general-concepts/dependencies/text.xml
> > > +++ b/general-concepts/dependencies/text.xml
> > > @@ -578,6 +578,44 @@ valid.
> > >  </body>
> > >  </section>
> > >
> > > +<section>
> > > +<title>Test Dependencies</title>
> > > +<body>
> > > +
> > > +<p>
> > > +Packages often have optional dependencies that are needed only when running
> > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
> > > +'test' USE flag is used for this purpose.
> > > +</p>
> > > +
> > > +<p>
> > > +Since testing will likely fail when test dependencies are not installed, the
> > > +test phase should be disabled in this case. This may be accomplished via USE
> > > +conditionals in the RESTRICT variable.
> > > +</p>
> > > +
> > > +<p>
> > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> > > +may be set to express this.
> > > +</p>
> > > +
> > > +<codesample lang="ebuild">
> > > +# Define some USE flags
> > > +IUSE="debug test"
> > > +
> > > +# Disable test phase when test USE flag is disabled
> > > +RESTRICT="!test? ( test )"
> >
> > I do not understand why we need this useless code. If test USE flag
> > is disabled, tests must be disabled as well. It is PM's job and
> > there is no need to put this obvious stuff into each ebuild with
> > tests and extra deps. I see no reason to support running src_test()
> > with USE="-test".
> 
> PMS does not specify that behavior (skipping src_test with USE=-test).
> It is better to define the requrement explicitly rather than relying
> on a Portage-specific behavior.

Then PMS should be fixed. Putting useless code in thousands
of ebuilds due to bureaucratic reasons is ridiculous. Having strict
conformance to the PMS is good, but common sense should still be
considered.

Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  2:11     ` Andrew Savchenko
@ 2018-08-26  7:28       ` Zac Medico
  2018-08-26  7:39         ` Michał Górny
                           ` (2 more replies)
  2018-08-26 13:43       ` Mike Gilbert
  1 sibling, 3 replies; 13+ messages in thread
From: Zac Medico @ 2018-08-26  7:28 UTC (permalink / raw
  To: gentoo-dev, Andrew Savchenko


[-- Attachment #1.1: Type: text/plain, Size: 2517 bytes --]

On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
>> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
>>>
>>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
>>>> ---
>>>>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
>>>>  1 file changed, 38 insertions(+)
>>>>
>>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
>>>> index 2f10380..64be9dc 100644
>>>> --- a/general-concepts/dependencies/text.xml
>>>> +++ b/general-concepts/dependencies/text.xml
>>>> @@ -578,6 +578,44 @@ valid.
>>>>  </body>
>>>>  </section>
>>>>
>>>> +<section>
>>>> +<title>Test Dependencies</title>
>>>> +<body>
>>>> +
>>>> +<p>
>>>> +Packages often have optional dependencies that are needed only when running
>>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
>>>> +'test' USE flag is used for this purpose.
>>>> +</p>
>>>> +
>>>> +<p>
>>>> +Since testing will likely fail when test dependencies are not installed, the
>>>> +test phase should be disabled in this case. This may be accomplished via USE
>>>> +conditionals in the RESTRICT variable.
>>>> +</p>
>>>> +
>>>> +<p>
>>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
>>>> +may be set to express this.
>>>> +</p>
>>>> +
>>>> +<codesample lang="ebuild">
>>>> +# Define some USE flags
>>>> +IUSE="debug test"
>>>> +
>>>> +# Disable test phase when test USE flag is disabled
>>>> +RESTRICT="!test? ( test )"
>>>
>>> I do not understand why we need this useless code. If test USE flag
>>> is disabled, tests must be disabled as well. It is PM's job and
>>> there is no need to put this obvious stuff into each ebuild with
>>> tests and extra deps. I see no reason to support running src_test()
>>> with USE="-test".
>>
>> PMS does not specify that behavior (skipping src_test with USE=-test).
>> It is better to define the requrement explicitly rather than relying
>> on a Portage-specific behavior.
> 
> Then PMS should be fixed. Putting useless code in thousands
> of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> conformance to the PMS is good, but common sense should still be
> considered.

Since PMS doesn't specify the behavior of FEATURES, I suppose we could
make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
drawbacks to that?
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  7:28       ` Zac Medico
@ 2018-08-26  7:39         ` Michał Górny
  2018-08-26  7:58           ` Zac Medico
  2018-08-26 11:25         ` Andrew Savchenko
  2018-08-26 14:10         ` Mike Gilbert
  2 siblings, 1 reply; 13+ messages in thread
From: Michał Górny @ 2018-08-26  7:39 UTC (permalink / raw
  To: gentoo-dev, Andrew Savchenko

[-- Attachment #1: Type: text/plain, Size: 2992 bytes --]

On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> > > On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> > > > 
> > > > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> > > > > ---
> > > > >  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> > > > >  1 file changed, 38 insertions(+)
> > > > > 
> > > > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> > > > > index 2f10380..64be9dc 100644
> > > > > --- a/general-concepts/dependencies/text.xml
> > > > > +++ b/general-concepts/dependencies/text.xml
> > > > > @@ -578,6 +578,44 @@ valid.
> > > > >  </body>
> > > > >  </section>
> > > > > 
> > > > > +<section>
> > > > > +<title>Test Dependencies</title>
> > > > > +<body>
> > > > > +
> > > > > +<p>
> > > > > +Packages often have optional dependencies that are needed only when running
> > > > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
> > > > > +'test' USE flag is used for this purpose.
> > > > > +</p>
> > > > > +
> > > > > +<p>
> > > > > +Since testing will likely fail when test dependencies are not installed, the
> > > > > +test phase should be disabled in this case. This may be accomplished via USE
> > > > > +conditionals in the RESTRICT variable.
> > > > > +</p>
> > > > > +
> > > > > +<p>
> > > > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> > > > > +may be set to express this.
> > > > > +</p>
> > > > > +
> > > > > +<codesample lang="ebuild">
> > > > > +# Define some USE flags
> > > > > +IUSE="debug test"
> > > > > +
> > > > > +# Disable test phase when test USE flag is disabled
> > > > > +RESTRICT="!test? ( test )"
> > > > 
> > > > I do not understand why we need this useless code. If test USE flag
> > > > is disabled, tests must be disabled as well. It is PM's job and
> > > > there is no need to put this obvious stuff into each ebuild with
> > > > tests and extra deps. I see no reason to support running src_test()
> > > > with USE="-test".
> > > 
> > > PMS does not specify that behavior (skipping src_test with USE=-test).
> > > It is better to define the requrement explicitly rather than relying
> > > on a Portage-specific behavior.
> > 
> > Then PMS should be fixed. Putting useless code in thousands
> > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> > conformance to the PMS is good, but common sense should still be
> > considered.
> 
> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
> drawbacks to that?

Except for Portage once again silently letting developers pass with non-
PMS behavior, and making other PMs fail with the ebuilds?

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  7:39         ` Michał Górny
@ 2018-08-26  7:58           ` Zac Medico
  2018-08-26  8:08             ` Michał Górny
  0 siblings, 1 reply; 13+ messages in thread
From: Zac Medico @ 2018-08-26  7:58 UTC (permalink / raw
  To: gentoo-dev, Michał Górny, Andrew Savchenko


[-- Attachment #1.1: Type: text/plain, Size: 3109 bytes --]

On 08/26/2018 12:39 AM, Michał Górny wrote:
> On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
>> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
>>> On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
>>>> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
>>>>>
>>>>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
>>>>>> ---
>>>>>>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
>>>>>>  1 file changed, 38 insertions(+)
>>>>>>
>>>>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
>>>>>> index 2f10380..64be9dc 100644
>>>>>> --- a/general-concepts/dependencies/text.xml
>>>>>> +++ b/general-concepts/dependencies/text.xml
>>>>>> @@ -578,6 +578,44 @@ valid.
>>>>>>  </body>
>>>>>>  </section>
>>>>>>
>>>>>> +<section>
>>>>>> +<title>Test Dependencies</title>
>>>>>> +<body>
>>>>>> +
>>>>>> +<p>
>>>>>> +Packages often have optional dependencies that are needed only when running
>>>>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
>>>>>> +'test' USE flag is used for this purpose.
>>>>>> +</p>
>>>>>> +
>>>>>> +<p>
>>>>>> +Since testing will likely fail when test dependencies are not installed, the
>>>>>> +test phase should be disabled in this case. This may be accomplished via USE
>>>>>> +conditionals in the RESTRICT variable.
>>>>>> +</p>
>>>>>> +
>>>>>> +<p>
>>>>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
>>>>>> +may be set to express this.
>>>>>> +</p>
>>>>>> +
>>>>>> +<codesample lang="ebuild">
>>>>>> +# Define some USE flags
>>>>>> +IUSE="debug test"
>>>>>> +
>>>>>> +# Disable test phase when test USE flag is disabled
>>>>>> +RESTRICT="!test? ( test )"
>>>>>
>>>>> I do not understand why we need this useless code. If test USE flag
>>>>> is disabled, tests must be disabled as well. It is PM's job and
>>>>> there is no need to put this obvious stuff into each ebuild with
>>>>> tests and extra deps. I see no reason to support running src_test()
>>>>> with USE="-test".
>>>>
>>>> PMS does not specify that behavior (skipping src_test with USE=-test).
>>>> It is better to define the requrement explicitly rather than relying
>>>> on a Portage-specific behavior.
>>>
>>> Then PMS should be fixed. Putting useless code in thousands
>>> of ebuilds due to bureaucratic reasons is ridiculous. Having strict
>>> conformance to the PMS is good, but common sense should still be
>>> considered.
>>
>> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
>> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
>> drawbacks to that?
> 
> Except for Portage once again silently letting developers pass with non-
> PMS behavior, and making other PMs fail with the ebuilds?

Is it really sane for other PMs to behave that way though?

In PMS it says src_test "may be disabled by user too, using a
PM-specific mechanism", which doesn't explicitly rule out behavior based
on USE settings.
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  7:58           ` Zac Medico
@ 2018-08-26  8:08             ` Michał Górny
  2018-08-26  8:43               ` Zac Medico
  0 siblings, 1 reply; 13+ messages in thread
From: Michał Górny @ 2018-08-26  8:08 UTC (permalink / raw
  To: gentoo-dev, Andrew Savchenko

[-- Attachment #1: Type: text/plain, Size: 3725 bytes --]

On Sun, 2018-08-26 at 00:58 -0700, Zac Medico wrote:
> On 08/26/2018 12:39 AM, Michał Górny wrote:
> > On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
> > > On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> > > > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> > > > > On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> > > > > > 
> > > > > > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> > > > > > > ---
> > > > > > >  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> > > > > > >  1 file changed, 38 insertions(+)
> > > > > > > 
> > > > > > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> > > > > > > index 2f10380..64be9dc 100644
> > > > > > > --- a/general-concepts/dependencies/text.xml
> > > > > > > +++ b/general-concepts/dependencies/text.xml
> > > > > > > @@ -578,6 +578,44 @@ valid.
> > > > > > >  </body>
> > > > > > >  </section>
> > > > > > > 
> > > > > > > +<section>
> > > > > > > +<title>Test Dependencies</title>
> > > > > > > +<body>
> > > > > > > +
> > > > > > > +<p>
> > > > > > > +Packages often have optional dependencies that are needed only when running
> > > > > > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
> > > > > > > +'test' USE flag is used for this purpose.
> > > > > > > +</p>
> > > > > > > +
> > > > > > > +<p>
> > > > > > > +Since testing will likely fail when test dependencies are not installed, the
> > > > > > > +test phase should be disabled in this case. This may be accomplished via USE
> > > > > > > +conditionals in the RESTRICT variable.
> > > > > > > +</p>
> > > > > > > +
> > > > > > > +<p>
> > > > > > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> > > > > > > +may be set to express this.
> > > > > > > +</p>
> > > > > > > +
> > > > > > > +<codesample lang="ebuild">
> > > > > > > +# Define some USE flags
> > > > > > > +IUSE="debug test"
> > > > > > > +
> > > > > > > +# Disable test phase when test USE flag is disabled
> > > > > > > +RESTRICT="!test? ( test )"
> > > > > > 
> > > > > > I do not understand why we need this useless code. If test USE flag
> > > > > > is disabled, tests must be disabled as well. It is PM's job and
> > > > > > there is no need to put this obvious stuff into each ebuild with
> > > > > > tests and extra deps. I see no reason to support running src_test()
> > > > > > with USE="-test".
> > > > > 
> > > > > PMS does not specify that behavior (skipping src_test with USE=-test).
> > > > > It is better to define the requrement explicitly rather than relying
> > > > > on a Portage-specific behavior.
> > > > 
> > > > Then PMS should be fixed. Putting useless code in thousands
> > > > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> > > > conformance to the PMS is good, but common sense should still be
> > > > considered.
> > > 
> > > Since PMS doesn't specify the behavior of FEATURES, I suppose we could
> > > make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
> > > drawbacks to that?
> > 
> > Except for Portage once again silently letting developers pass with non-
> > PMS behavior, and making other PMs fail with the ebuilds?
> 
> Is it really sane for other PMs to behave that way though?
> 
> In PMS it says src_test "may be disabled by user too, using a
> PM-specific mechanism", which doesn't explicitly rule out behavior based
> on USE settings.

It doesn't rule out disabling based on the phase of the moon either, or
my mood which is degrading badly with this discussion.

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  8:08             ` Michał Górny
@ 2018-08-26  8:43               ` Zac Medico
  2018-08-26  8:54                 ` Michał Górny
  0 siblings, 1 reply; 13+ messages in thread
From: Zac Medico @ 2018-08-26  8:43 UTC (permalink / raw
  To: gentoo-dev, Michał Górny, Andrew Savchenko


[-- Attachment #1.1: Type: text/plain, Size: 3731 bytes --]

On 08/26/2018 01:08 AM, Michał Górny wrote:
> On Sun, 2018-08-26 at 00:58 -0700, Zac Medico wrote:
>> On 08/26/2018 12:39 AM, Michał Górny wrote:
>>> On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
>>>> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
>>>>> On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
>>>>>> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
>>>>>>>
>>>>>>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
>>>>>>>> ---
>>>>>>>>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
>>>>>>>>  1 file changed, 38 insertions(+)
>>>>>>>>
>>>>>>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
>>>>>>>> index 2f10380..64be9dc 100644
>>>>>>>> --- a/general-concepts/dependencies/text.xml
>>>>>>>> +++ b/general-concepts/dependencies/text.xml
>>>>>>>> @@ -578,6 +578,44 @@ valid.
>>>>>>>>  </body>
>>>>>>>>  </section>
>>>>>>>>
>>>>>>>> +<section>
>>>>>>>> +<title>Test Dependencies</title>
>>>>>>>> +<body>
>>>>>>>> +
>>>>>>>> +<p>
>>>>>>>> +Packages often have optional dependencies that are needed only when running
>>>>>>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
>>>>>>>> +'test' USE flag is used for this purpose.
>>>>>>>> +</p>
>>>>>>>> +
>>>>>>>> +<p>
>>>>>>>> +Since testing will likely fail when test dependencies are not installed, the
>>>>>>>> +test phase should be disabled in this case. This may be accomplished via USE
>>>>>>>> +conditionals in the RESTRICT variable.
>>>>>>>> +</p>
>>>>>>>> +
>>>>>>>> +<p>
>>>>>>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
>>>>>>>> +may be set to express this.
>>>>>>>> +</p>
>>>>>>>> +
>>>>>>>> +<codesample lang="ebuild">
>>>>>>>> +# Define some USE flags
>>>>>>>> +IUSE="debug test"
>>>>>>>> +
>>>>>>>> +# Disable test phase when test USE flag is disabled
>>>>>>>> +RESTRICT="!test? ( test )"
>>>>>>>
>>>>>>> I do not understand why we need this useless code. If test USE flag
>>>>>>> is disabled, tests must be disabled as well. It is PM's job and
>>>>>>> there is no need to put this obvious stuff into each ebuild with
>>>>>>> tests and extra deps. I see no reason to support running src_test()
>>>>>>> with USE="-test".
>>>>>>
>>>>>> PMS does not specify that behavior (skipping src_test with USE=-test).
>>>>>> It is better to define the requrement explicitly rather than relying
>>>>>> on a Portage-specific behavior.
>>>>>
>>>>> Then PMS should be fixed. Putting useless code in thousands
>>>>> of ebuilds due to bureaucratic reasons is ridiculous. Having strict
>>>>> conformance to the PMS is good, but common sense should still be
>>>>> considered.
>>>>
>>>> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
>>>> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
>>>> drawbacks to that?
>>>
>>> Except for Portage once again silently letting developers pass with non-
>>> PMS behavior, and making other PMs fail with the ebuilds?
>>
>> Is it really sane for other PMs to behave that way though?
>>
>> In PMS it says src_test "may be disabled by user too, using a
>> PM-specific mechanism", which doesn't explicitly rule out behavior based
>> on USE settings.
> 
> It doesn't rule out disabling based on the phase of the moon either, or
> my mood which is degrading badly with this discussion.

Well, using package.use for this doesn't really make sense within the
context of ebuilds that don't have IUSE=test, which is an argument for
people to use package.env as a consistent means to selectively disable
unit tests.
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  8:43               ` Zac Medico
@ 2018-08-26  8:54                 ` Michał Górny
  0 siblings, 0 replies; 13+ messages in thread
From: Michał Górny @ 2018-08-26  8:54 UTC (permalink / raw
  To: gentoo-dev, Andrew Savchenko

[-- Attachment #1: Type: text/plain, Size: 4462 bytes --]

On Sun, 2018-08-26 at 01:43 -0700, Zac Medico wrote:
> On 08/26/2018 01:08 AM, Michał Górny wrote:
> > On Sun, 2018-08-26 at 00:58 -0700, Zac Medico wrote:
> > > On 08/26/2018 12:39 AM, Michał Górny wrote:
> > > > On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
> > > > > On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> > > > > > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> > > > > > > On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> > > > > > > > 
> > > > > > > > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> > > > > > > > > ---
> > > > > > > > >  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> > > > > > > > >  1 file changed, 38 insertions(+)
> > > > > > > > > 
> > > > > > > > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> > > > > > > > > index 2f10380..64be9dc 100644
> > > > > > > > > --- a/general-concepts/dependencies/text.xml
> > > > > > > > > +++ b/general-concepts/dependencies/text.xml
> > > > > > > > > @@ -578,6 +578,44 @@ valid.
> > > > > > > > >  </body>
> > > > > > > > >  </section>
> > > > > > > > > 
> > > > > > > > > +<section>
> > > > > > > > > +<title>Test Dependencies</title>
> > > > > > > > > +<body>
> > > > > > > > > +
> > > > > > > > > +<p>
> > > > > > > > > +Packages often have optional dependencies that are needed only when running
> > > > > > > > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
> > > > > > > > > +'test' USE flag is used for this purpose.
> > > > > > > > > +</p>
> > > > > > > > > +
> > > > > > > > > +<p>
> > > > > > > > > +Since testing will likely fail when test dependencies are not installed, the
> > > > > > > > > +test phase should be disabled in this case. This may be accomplished via USE
> > > > > > > > > +conditionals in the RESTRICT variable.
> > > > > > > > > +</p>
> > > > > > > > > +
> > > > > > > > > +<p>
> > > > > > > > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> > > > > > > > > +may be set to express this.
> > > > > > > > > +</p>
> > > > > > > > > +
> > > > > > > > > +<codesample lang="ebuild">
> > > > > > > > > +# Define some USE flags
> > > > > > > > > +IUSE="debug test"
> > > > > > > > > +
> > > > > > > > > +# Disable test phase when test USE flag is disabled
> > > > > > > > > +RESTRICT="!test? ( test )"
> > > > > > > > 
> > > > > > > > I do not understand why we need this useless code. If test USE flag
> > > > > > > > is disabled, tests must be disabled as well. It is PM's job and
> > > > > > > > there is no need to put this obvious stuff into each ebuild with
> > > > > > > > tests and extra deps. I see no reason to support running src_test()
> > > > > > > > with USE="-test".
> > > > > > > 
> > > > > > > PMS does not specify that behavior (skipping src_test with USE=-test).
> > > > > > > It is better to define the requrement explicitly rather than relying
> > > > > > > on a Portage-specific behavior.
> > > > > > 
> > > > > > Then PMS should be fixed. Putting useless code in thousands
> > > > > > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> > > > > > conformance to the PMS is good, but common sense should still be
> > > > > > considered.
> > > > > 
> > > > > Since PMS doesn't specify the behavior of FEATURES, I suppose we could
> > > > > make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
> > > > > drawbacks to that?
> > > > 
> > > > Except for Portage once again silently letting developers pass with non-
> > > > PMS behavior, and making other PMs fail with the ebuilds?
> > > 
> > > Is it really sane for other PMs to behave that way though?
> > > 
> > > In PMS it says src_test "may be disabled by user too, using a
> > > PM-specific mechanism", which doesn't explicitly rule out behavior based
> > > on USE settings.
> > 
> > It doesn't rule out disabling based on the phase of the moon either, or
> > my mood which is degrading badly with this discussion.
> 
> Well, using package.use for this doesn't really make sense within the
> context of ebuilds that don't have IUSE=test, which is an argument for
> people to use package.env as a consistent means to selectively disable
> unit tests.

...and this is how it was supposed to work, and AFAIU how it works right
now.

-- 
Best regards,
Michał Górny

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  7:28       ` Zac Medico
  2018-08-26  7:39         ` Michał Górny
@ 2018-08-26 11:25         ` Andrew Savchenko
  2018-08-26 14:10         ` Mike Gilbert
  2 siblings, 0 replies; 13+ messages in thread
From: Andrew Savchenko @ 2018-08-26 11:25 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2775 bytes --]

On Sun, 26 Aug 2018 00:28:16 -0700 Zac Medico wrote:
> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> >> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> >>>
> >>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> >>>> ---
> >>>>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> >>>>  1 file changed, 38 insertions(+)
> >>>>
> >>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> >>>> index 2f10380..64be9dc 100644
> >>>> --- a/general-concepts/dependencies/text.xml
> >>>> +++ b/general-concepts/dependencies/text.xml
> >>>> @@ -578,6 +578,44 @@ valid.
> >>>>  </body>
> >>>>  </section>
> >>>>
> >>>> +<section>
> >>>> +<title>Test Dependencies</title>
> >>>> +<body>
> >>>> +
> >>>> +<p>
> >>>> +Packages often have optional dependencies that are needed only when running
> >>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
> >>>> +'test' USE flag is used for this purpose.
> >>>> +</p>
> >>>> +
> >>>> +<p>
> >>>> +Since testing will likely fail when test dependencies are not installed, the
> >>>> +test phase should be disabled in this case. This may be accomplished via USE
> >>>> +conditionals in the RESTRICT variable.
> >>>> +</p>
> >>>> +
> >>>> +<p>
> >>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> >>>> +may be set to express this.
> >>>> +</p>
> >>>> +
> >>>> +<codesample lang="ebuild">
> >>>> +# Define some USE flags
> >>>> +IUSE="debug test"
> >>>> +
> >>>> +# Disable test phase when test USE flag is disabled
> >>>> +RESTRICT="!test? ( test )"
> >>>
> >>> I do not understand why we need this useless code. If test USE flag
> >>> is disabled, tests must be disabled as well. It is PM's job and
> >>> there is no need to put this obvious stuff into each ebuild with
> >>> tests and extra deps. I see no reason to support running src_test()
> >>> with USE="-test".
> >>
> >> PMS does not specify that behavior (skipping src_test with USE=-test).
> >> It is better to define the requrement explicitly rather than relying
> >> on a Portage-specific behavior.
> > 
> > Then PMS should be fixed. Putting useless code in thousands
> > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> > conformance to the PMS is good, but common sense should still be
> > considered.
> 
> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
> drawbacks to that?

IMO no. This is what everyone expects from the test feature.

Best regards,
Andrew Savchenko

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  2:11     ` Andrew Savchenko
  2018-08-26  7:28       ` Zac Medico
@ 2018-08-26 13:43       ` Mike Gilbert
  1 sibling, 0 replies; 13+ messages in thread
From: Mike Gilbert @ 2018-08-26 13:43 UTC (permalink / raw
  To: Gentoo Dev

On Sat, Aug 25, 2018 at 10:11 PM Andrew Savchenko <bircoph@gentoo.org> wrote:
>
> On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> > PMS does not specify that behavior (skipping src_test with USE=-test).
> > It is better to define the requrement explicitly rather than relying
> > on a Portage-specific behavior.
>
> Then PMS should be fixed. Putting useless code in thousands
> of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> conformance to the PMS is good, but common sense should still be
> considered.

I disagree with your opinion. Adding one line of code to many ebuilds
is not a crazy idea, and it doesn't need to happen overnight. Adding
RESTRICT="!test? ( test )" is certainly not harmful.

The advice given in the devmanual should agree with PMS. I think PMS
is unlikely to change; if it does, the devmanual can be updated to
match.

Personally, I would not like to see a change in PMS in this regard. I
think controlling tests via USE conditionals in RESTRICT is a nice way
to avoid hard-coding the meaning of individual USE flags into PMS.
It also gives the ebuild author more flexibility. For example, he
could put something like this in RESTRICT if some exotic "foo" feature
causes tests to fail:

RESTRICT="foo ( test )"


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
  2018-08-26  7:28       ` Zac Medico
  2018-08-26  7:39         ` Michał Górny
  2018-08-26 11:25         ` Andrew Savchenko
@ 2018-08-26 14:10         ` Mike Gilbert
  2 siblings, 0 replies; 13+ messages in thread
From: Mike Gilbert @ 2018-08-26 14:10 UTC (permalink / raw
  To: Gentoo Dev; +Cc: bircoph

On Sun, Aug 26, 2018 at 3:28 AM Zac Medico <zmedico@gentoo.org> wrote:
>
> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
> > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
> >> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@gentoo.org> wrote:
> >>>
> >>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
> >>>> ---
> >>>>  general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
> >>>>  1 file changed, 38 insertions(+)
> >>>>
> >>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
> >>>> index 2f10380..64be9dc 100644
> >>>> --- a/general-concepts/dependencies/text.xml
> >>>> +++ b/general-concepts/dependencies/text.xml
> >>>> @@ -578,6 +578,44 @@ valid.
> >>>>  </body>
> >>>>  </section>
> >>>>
> >>>> +<section>
> >>>> +<title>Test Dependencies</title>
> >>>> +<body>
> >>>> +
> >>>> +<p>
> >>>> +Packages often have optional dependencies that are needed only when running
> >>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
> >>>> +'test' USE flag is used for this purpose.
> >>>> +</p>
> >>>> +
> >>>> +<p>
> >>>> +Since testing will likely fail when test dependencies are not installed, the
> >>>> +test phase should be disabled in this case. This may be accomplished via USE
> >>>> +conditionals in the RESTRICT variable.
> >>>> +</p>
> >>>> +
> >>>> +<p>
> >>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
> >>>> +may be set to express this.
> >>>> +</p>
> >>>> +
> >>>> +<codesample lang="ebuild">
> >>>> +# Define some USE flags
> >>>> +IUSE="debug test"
> >>>> +
> >>>> +# Disable test phase when test USE flag is disabled
> >>>> +RESTRICT="!test? ( test )"
> >>>
> >>> I do not understand why we need this useless code. If test USE flag
> >>> is disabled, tests must be disabled as well. It is PM's job and
> >>> there is no need to put this obvious stuff into each ebuild with
> >>> tests and extra deps. I see no reason to support running src_test()
> >>> with USE="-test".
> >>
> >> PMS does not specify that behavior (skipping src_test with USE=-test).
> >> It is better to define the requrement explicitly rather than relying
> >> on a Portage-specific behavior.
> >
> > Then PMS should be fixed. Putting useless code in thousands
> > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
> > conformance to the PMS is good, but common sense should still be
> > considered.
>
> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
> drawbacks to that?

I think that's a nice idea from a usability standpoint, at least while
most ebuilds in the tree do not set it explicitly.

I still think adding an explicit RESTRICT="!test? ( test )" to ebuilds
is a good idea though. My fear is that certain people would start
rejecting patches or reverting commits as "useless changes".


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-08-26 14:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-24 18:24 [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" Mike Gilbert
2018-08-25  5:41 ` Andrew Savchenko
2018-08-25 18:24   ` Mike Gilbert
2018-08-26  2:11     ` Andrew Savchenko
2018-08-26  7:28       ` Zac Medico
2018-08-26  7:39         ` Michał Górny
2018-08-26  7:58           ` Zac Medico
2018-08-26  8:08             ` Michał Górny
2018-08-26  8:43               ` Zac Medico
2018-08-26  8:54                 ` Michał Górny
2018-08-26 11:25         ` Andrew Savchenko
2018-08-26 14:10         ` Mike Gilbert
2018-08-26 13:43       ` Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox