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