Gentoo Archives: gentoo-dev

From: "Arsen Arsenović" <arsen@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [PATCH] New pre-GLEP: TEST_SUITE_PRESENT variable
Date: Sun, 19 Feb 2023 18:12:40
Message-Id: 86v8jxplrl.fsf@gentoo.org
In Reply to: [gentoo-dev] [PATCH] New pre-GLEP: TEST_SUITE_PRESENT variable by "Michał Górny"
1 Hi,
2
3 Michał Górny <mgorny@g.o> writes:
4
5 > Signed-off-by: Michał Górny <mgorny@g.o>
6 > ---
7 > glep-9999.ebuild | 132 +++++++++++++++++++++++++++++++++++++++++++++++
8 > 1 file changed, 132 insertions(+)
9 > create mode 100644 glep-9999.ebuild
10 >
11 > diff --git a/glep-9999.ebuild b/glep-9999.ebuild
12 > new file mode 100644
13 > index 0000000..9ee18ca
14 > --- /dev/null
15 > +++ b/glep-9999.ebuild
16 > @@ -0,0 +1,132 @@
17 > +---
18 > +GLEP: 9999
19 > +Title: TEST_SUITE_PRESENT variable
20 > +Author: Michał Górny <mgorny@g.o>
21 > +Type: Standards Track
22 > +Status: Draft
23 > +Version: 1
24 > +Created: 2023-02-19
25 > +Last-Modified: 2023-02-19
26 > +Post-History: 2023-02-19
27 > +Content-Type: text/x-rst
28 > +---
29 > +
30 > +
31 > +Abstract
32 > +========
33 > +
34 > +A new ``TEST_SUITE_PRESENT`` variable is introduced to indicate whether
35 > +the package features a test suite. It can be set either by the ebuild,
36 > +the eclass or the default ``src_test`` implementation, and afterwards
37 > +included in the package manager logs. This can aid in analyzing
38 > +the results of automated package testing.
39 > +
40 > +
41 > +Motivation
42 > +==========
43 > +
44 > +The deployment of new Python targets in Gentoo currently involves
45 > +testing of a large number of Gentoo packages against the said target.
46 > +This is currently done manually for the most part. It can be
47 > +particularly time consuming if multiple individuals repeatedly test
48 > +the same package only to determine that it remains incompatible with
49 > +the new interpreter.
50 > +
51 > +The Python team wanted to explore the use of automation to aid this
52 > +testing. Unfortunately, this faces a major problem: for the vast
53 > +of majority of packages, the incompatibilities with new Python versions
54 > +do not exhibit during the installation and can only be detected through
55 > +running the test suite. The results of automated testing are therefore
56 > +only meaningful if the package features a test phase.
57 > +
58 > +For packages using ``distutils-r1`` eclass, the presence of test suite
59 > +can usually be easily determined through grepping for
60 > +``distutils_enable_tests`` call or an explicit ``python_test()``
61 > +function. Even then, it seems sensible to work towards a more generic
62 > +approach to tell whether a package had a test suite or not,
63 > +and therefore whether a particular successful automated testing result
64 > +means that the package actually passed tests or only confirmed that
65 > +the Python files were copied successfully.
66 > +
67 > +An explicit indication whether a test suite was present can be presented
68 > +by the package manager as part of logs, along with the result of running
69 > +the test phase. Afterwards, these logs can be used to determine which
70 > +packages were actually tested.
71 > +
72
73 +1. I have had similar aspirations lately, so I'm glad someone else
74 beat me to it :)
75
76 > +
77 > +Specification
78 > +=============
79 > +
80 > +A new ``TEST_SUITE_PRESENT`` variable is introduced that can be set
81 > +by a ``src_test()`` implementation to indicate whether the package
82 > +featured a test suite. It can take three values:
83 > +
84 > +- ``yes`` indicating that a test suite was run
85 > +- ``indeterminate`` indicating that it was not possible to clearly
86 > + determine whether the test suite was present or not (this could be
87 > + a case e.g. when a generic test command is run and it does not
88 > + indicate whether any tests were found)
89 > +- ``no`` indicating that no test suite was run
90 > +
91 > +This variable *should* be set by eclasses defining the ``src_test()``
92 > +phase. If the package in question is using ``src_test()`` defined
93 > +by an eclass that does not declare it explicitly, the PM must assume
94 > +``indeterminate``.
95 > +
96 > +The variable *may* be set by an ebuild defining the ``src_test()``
97 > +phase. If the ebuild does not define it explicitly, the PM must assume
98 > +``yes``.
99 > +
100 > +The default ``src_test()`` implementation as defined by the PMS sets
101 > +the value to ``indeterminate`` if it runs a ``check`` or ``test``
102 > +target, and to ``no`` if neither of the targets is found.
103 > +
104 > +
105 > +Rationale
106 > +=========
107 > +
108 > +The use of ternary flag makes it possible to clearly represent all three
109 > +possible outcomes while navigating the defaults defined in the GLEP.
110 > +The flag is set in ``src_test()``, so that runtime conditions (such
111 > +as the results obtained from the actual test runner) can be used to
112 > +determine the actual value.
113 > +
114 > +The defaults were defined based on the following assumptions:
115 > +
116 > +1. The presence of ``check`` target is common in autotools projects but
117 > + it does not guarantee that the target actually does anything, let
118 > + alone run a proper test suite. However, the lack of any test target
119 > + clearly indicates that no tests were run.
120 > +
121 > +2. Eclass ``src_test`` implementations can be very generic and succeed
122 > + without actually performing any testing. It is therefore reasonable
123 > + to default to ``indeterminate`` result when they are used,
124 > + and recommend them to explicitly override the variable.
125 > +
126 > +3. Explicit ``src_test`` declared in ebuild can generally be assumed
127 > + to actually run tests, with the exception of declaring the function
128 > + to prevent ``default_src_test`` from running. It therefore makes
129 > + sense to default to ``yes`` but allow ebuilds to override the value
130 > + in the latter case.
131 > +
132 > +
133 > +Backwards Compatibility
134 > +=======================
135 > +
136 > +This GLEP is entirely optional. The package managers not implementing
137 > +it will treat the variable as a regular bash variable set by the test
138 > +phase and ignore it.
139 > +
140 > +
141 > +Reference Implementation
142 > +========================
143 > +
144 > +TODO
145 > +
146 > +
147 > +Copyright
148 > +=========
149 > +
150 > +This work is licensed under the Creative Commons Attribution-ShareAlike 4.0
151 > +International License. To view a copy of this license, visit
152 > +https://creativecommons.org/licenses/by-sa/4.0/.
153
154 This approach looks OK to me.
155 --
156 Arsen Arsenović

Attachments

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