1 |
On Sun, Feb 19, 2023 at 3:11 PM Maciej Barć <xgqt@g.o> wrote: |
2 |
> |
3 |
> What if developer configured an ebuild in a way that it downloads the |
4 |
> test suite/files/data with USE=test? |
5 |
> |
6 |
> IMO it should be added to the GLEP that then TEST_SUITE_PRESENT should |
7 |
> be true (exists). |
8 |
|
9 |
This is what I was afraid of with the name; it's not only about a |
10 |
testsuite being there or not, it's about trusting that: |
11 |
- There is a test suite. |
12 |
- It was run. |
13 |
- It passed, and passing is valuable. |
14 |
|
15 |
Just existing is not sufficient, because we cannot gain any |
16 |
information from an src_test that just downloaded but didn't run the |
17 |
suite. That is not valuable information. |
18 |
|
19 |
-A |
20 |
|
21 |
> |
22 |
> W dniu 19.02.2023 o 18:32, Michał Górny pisze: |
23 |
> > Signed-off-by: Michał Górny <mgorny@g.o> |
24 |
> > --- |
25 |
> > glep-9999.ebuild | 132 +++++++++++++++++++++++++++++++++++++++++++++++ |
26 |
> > 1 file changed, 132 insertions(+) |
27 |
> > create mode 100644 glep-9999.ebuild |
28 |
> > |
29 |
> > diff --git a/glep-9999.ebuild b/glep-9999.ebuild |
30 |
> > new file mode 100644 |
31 |
> > index 0000000..9ee18ca |
32 |
> > --- /dev/null |
33 |
> > +++ b/glep-9999.ebuild |
34 |
> > @@ -0,0 +1,132 @@ |
35 |
> > +--- |
36 |
> > +GLEP: 9999 |
37 |
> > +Title: TEST_SUITE_PRESENT variable |
38 |
> > +Author: Michał Górny <mgorny@g.o> |
39 |
> > +Type: Standards Track |
40 |
> > +Status: Draft |
41 |
> > +Version: 1 |
42 |
> > +Created: 2023-02-19 |
43 |
> > +Last-Modified: 2023-02-19 |
44 |
> > +Post-History: 2023-02-19 |
45 |
> > +Content-Type: text/x-rst |
46 |
> > +--- |
47 |
> > + |
48 |
> > + |
49 |
> > +Abstract |
50 |
> > +======== |
51 |
> > + |
52 |
> > +A new ``TEST_SUITE_PRESENT`` variable is introduced to indicate whether |
53 |
> > +the package features a test suite. It can be set either by the ebuild, |
54 |
> > +the eclass or the default ``src_test`` implementation, and afterwards |
55 |
> > +included in the package manager logs. This can aid in analyzing |
56 |
> > +the results of automated package testing. |
57 |
> > + |
58 |
> > + |
59 |
> > +Motivation |
60 |
> > +========== |
61 |
> > + |
62 |
> > +The deployment of new Python targets in Gentoo currently involves |
63 |
> > +testing of a large number of Gentoo packages against the said target. |
64 |
> > +This is currently done manually for the most part. It can be |
65 |
> > +particularly time consuming if multiple individuals repeatedly test |
66 |
> > +the same package only to determine that it remains incompatible with |
67 |
> > +the new interpreter. |
68 |
> > + |
69 |
> > +The Python team wanted to explore the use of automation to aid this |
70 |
> > +testing. Unfortunately, this faces a major problem: for the vast |
71 |
> > +of majority of packages, the incompatibilities with new Python versions |
72 |
> > +do not exhibit during the installation and can only be detected through |
73 |
> > +running the test suite. The results of automated testing are therefore |
74 |
> > +only meaningful if the package features a test phase. |
75 |
> > + |
76 |
> > +For packages using ``distutils-r1`` eclass, the presence of test suite |
77 |
> > +can usually be easily determined through grepping for |
78 |
> > +``distutils_enable_tests`` call or an explicit ``python_test()`` |
79 |
> > +function. Even then, it seems sensible to work towards a more generic |
80 |
> > +approach to tell whether a package had a test suite or not, |
81 |
> > +and therefore whether a particular successful automated testing result |
82 |
> > +means that the package actually passed tests or only confirmed that |
83 |
> > +the Python files were copied successfully. |
84 |
> > + |
85 |
> > +An explicit indication whether a test suite was present can be presented |
86 |
> > +by the package manager as part of logs, along with the result of running |
87 |
> > +the test phase. Afterwards, these logs can be used to determine which |
88 |
> > +packages were actually tested. |
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 |
> -- |
169 |
> Have a great day! |
170 |
> |
171 |
> ~ Maciej XGQT Barć |
172 |
> |
173 |
> xgqt@g.o |
174 |
> Gentoo Linux developer |
175 |
> (dotnet, emacs, math, ml, nim, scheme, sci) |
176 |
> https://wiki.gentoo.org/wiki/User:Xgqt |
177 |
> 9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C |