Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o, Andrew Savchenko <bircoph@g.o>
Subject: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
Date: Sun, 26 Aug 2018 07:28:26
Message-Id: 653bd4ec-102a-04fa-fdf5-e67c62756cfa@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" by Andrew Savchenko
1 On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
2 > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
3 >> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@g.o> wrote:
4 >>>
5 >>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
6 >>>> ---
7 >>>> general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
8 >>>> 1 file changed, 38 insertions(+)
9 >>>>
10 >>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
11 >>>> index 2f10380..64be9dc 100644
12 >>>> --- a/general-concepts/dependencies/text.xml
13 >>>> +++ b/general-concepts/dependencies/text.xml
14 >>>> @@ -578,6 +578,44 @@ valid.
15 >>>> </body>
16 >>>> </section>
17 >>>>
18 >>>> +<section>
19 >>>> +<title>Test Dependencies</title>
20 >>>> +<body>
21 >>>> +
22 >>>> +<p>
23 >>>> +Packages often have optional dependencies that are needed only when running
24 >>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
25 >>>> +'test' USE flag is used for this purpose.
26 >>>> +</p>
27 >>>> +
28 >>>> +<p>
29 >>>> +Since testing will likely fail when test dependencies are not installed, the
30 >>>> +test phase should be disabled in this case. This may be accomplished via USE
31 >>>> +conditionals in the RESTRICT variable.
32 >>>> +</p>
33 >>>> +
34 >>>> +<p>
35 >>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
36 >>>> +may be set to express this.
37 >>>> +</p>
38 >>>> +
39 >>>> +<codesample lang="ebuild">
40 >>>> +# Define some USE flags
41 >>>> +IUSE="debug test"
42 >>>> +
43 >>>> +# Disable test phase when test USE flag is disabled
44 >>>> +RESTRICT="!test? ( test )"
45 >>>
46 >>> I do not understand why we need this useless code. If test USE flag
47 >>> is disabled, tests must be disabled as well. It is PM's job and
48 >>> there is no need to put this obvious stuff into each ebuild with
49 >>> tests and extra deps. I see no reason to support running src_test()
50 >>> with USE="-test".
51 >>
52 >> PMS does not specify that behavior (skipping src_test with USE=-test).
53 >> It is better to define the requrement explicitly rather than relying
54 >> on a Portage-specific behavior.
55 >
56 > Then PMS should be fixed. Putting useless code in thousands
57 > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
58 > conformance to the PMS is good, but common sense should still be
59 > considered.
60
61 Since PMS doesn't specify the behavior of FEATURES, I suppose we could
62 make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
63 drawbacks to that?
64 --
65 Thanks,
66 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies