1 |
commit: b3fe0cc847e455de69e5f88886a859f6de9da5c0 |
2 |
Author: Andreas K. Huettel (dilfridge) <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 5 13:08:55 2015 +0000 |
4 |
Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 19 13:22:10 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3fe0cc8 |
7 |
|
8 |
perl-module.eclass: Rename SRC_TEST to DIST_TEST in EAPI=6, default to "do parallel", add features |
9 |
|
10 |
* The variable SRC_TEST used to allow some control over the testing phase (run |
11 |
it, run tests parallelized, skip it). Named DIST_TEST in EAPI=6 now for |
12 |
consistency. |
13 |
|
14 |
* Add functionality for ebuild authors: even if the ebuild specifies that e.g. |
15 |
tests should not be run or run single-threaded, allow in EAPI=6 to override |
16 |
that from make.conf or package.env. |
17 |
|
18 |
* Rewrite of the test phase for EAPI=6. Adds options to control test verbosity |
19 |
and switch network tests (something that might or might not work depending on |
20 |
upstream cooperativity). |
21 |
|
22 |
eclass/perl-module.eclass | 94 +++++++++++++++++++++++++++++++++-------------- |
23 |
1 file changed, 67 insertions(+), 27 deletions(-) |
24 |
|
25 |
diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass |
26 |
index ea49de4..0e9f423 100644 |
27 |
--- a/eclass/perl-module.eclass |
28 |
+++ b/eclass/perl-module.eclass |
29 |
@@ -142,6 +142,8 @@ if [[ ${EAPI:-0} = 5 ]] ; then |
30 |
SRC_URI="mirror://cpan/authors/id/${MODULE_AUTHOR:0:1}/${MODULE_AUTHOR:0:2}/${MODULE_AUTHOR}/${MODULE_SECTION:+${MODULE_SECTION}/}${MODULE_A}" |
31 |
[[ -z "${HOMEPAGE}" ]] && \ |
32 |
HOMEPAGE="http://search.cpan.org/dist/${MODULE_NAME}/" |
33 |
+ |
34 |
+ SRC_TEST="skip" |
35 |
else |
36 |
DIST_NAME=${DIST_NAME:-${PN}} |
37 |
DIST_P=${DIST_NAME}-${DIST_VERSION:-${PV}} |
38 |
@@ -156,7 +158,6 @@ else |
39 |
fi |
40 |
|
41 |
SRC_PREP="no" |
42 |
-SRC_TEST="skip" |
43 |
PREFER_BUILDPL="yes" |
44 |
|
45 |
pm_echovar="" |
46 |
@@ -301,42 +302,81 @@ perl-module_src_compile() { |
47 |
fi |
48 |
} |
49 |
|
50 |
+# @ECLASS-VARIABLE: DIST_TEST |
51 |
+# @DESCRIPTION: |
52 |
+# (EAPI=6) Variable that controls if tests are run in the test phase |
53 |
+# at all, and if yes under which conditions. Defaults to "do parallel" |
54 |
+# If neither "do" nor "parallel" is recognized, tests are skipped. |
55 |
+# (In EAPI=5 the variable is called SRC_TEST, defaults to "skip", and |
56 |
+# recognizes fewer options.) |
57 |
+# The following space-separated keywords are recognized: |
58 |
+# do : run tests |
59 |
+# parallel : run tests in parallel |
60 |
+# verbose : increase test verbosity |
61 |
+# network : do not try to disable network tests |
62 |
+ |
63 |
+# @ECLASS-VARIABLE: DIST_TEST_OVERRIDE |
64 |
+# @DESCRIPTION: |
65 |
+# (EAPI=6) Variable that controls if tests are run in the test phase |
66 |
+# at all, and if yes under which conditions. It is intended for use in |
67 |
+# make.conf or the environment by ebuild authors during testing, and |
68 |
+# accepts the same values as DIST_TEST. If set, it overrides DIST_TEST |
69 |
+# completely. DO NOT USE THIS IN EBUILDS! |
70 |
+ |
71 |
# @FUNCTION: perl-module_src-test |
72 |
# @USAGE: perl-module_src_test() |
73 |
# @DESCRIPTION: |
74 |
-# This code attempts to work out your threadingness from MAKEOPTS |
75 |
-# and apply them to Test::Harness. |
76 |
-# |
77 |
-# If you want more verbose testing, set TEST_VERBOSE=1 |
78 |
-# in your bashrc | /etc/portage/make.conf | ENV |
79 |
-# |
80 |
-# or ebuild writers: |
81 |
-# If you wish to enable default tests w/ 'make test' , |
82 |
-# |
83 |
-# SRC_TEST="do" |
84 |
-# |
85 |
-# If you wish to have threads run in parallel ( using the users makeopts ) |
86 |
-# all of the following have been tested to work. |
87 |
-# |
88 |
-# SRC_TEST="do parallel" |
89 |
-# SRC_TEST="parallel" |
90 |
-# SRC_TEST="parallel do" |
91 |
-# SRC_TEST=parallel |
92 |
-# |
93 |
+# This code attempts to work out your threadingness and runs tests |
94 |
+# according to the settings of DIST_TEST using Test::Harness. |
95 |
perl-module_src_test() { |
96 |
debug-print-function $FUNCNAME "$@" |
97 |
- if has 'do' ${SRC_TEST} || has 'parallel' ${SRC_TEST} ; then |
98 |
- if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${SRC_TEST} ; then |
99 |
+ local my_test_control |
100 |
+ local my_test_verbose |
101 |
+ |
102 |
+ if [[ ${EAPI:-0} = 5 ]] ; then |
103 |
+ my_test_control=${SRC_TEST} |
104 |
+ my_test_verbose=${TEST_VERBOSE:-0} |
105 |
+ if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then |
106 |
+ if has "${my_test_verbose}" 0 && has 'parallel' ${my_test_control} ; then |
107 |
+ export HARNESS_OPTIONS=j$(makeopts_jobs) |
108 |
+ einfo "Test::Harness Jobs=$(makeopts_jobs)" |
109 |
+ fi |
110 |
+ else |
111 |
+ einfo Skipping tests due to SRC_TEST=${SRC_TEST} |
112 |
+ return 0 |
113 |
+ fi |
114 |
+ else |
115 |
+ [[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE} |
116 |
+ my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} |
117 |
+ |
118 |
+ if ! has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then |
119 |
+ einfo Skipping tests due to DIST_TEST=${my_test_control} |
120 |
+ return 0 |
121 |
+ fi |
122 |
+ |
123 |
+ if has verbose ${my_test_control} ; then |
124 |
+ my_test_verbose=1 |
125 |
+ else |
126 |
+ my_test_verbose=0 |
127 |
+ fi |
128 |
+ |
129 |
+ if has parallel ${my_test_control} ; then |
130 |
export HARNESS_OPTIONS=j$(makeopts_jobs) |
131 |
einfo "Test::Harness Jobs=$(makeopts_jobs)" |
132 |
fi |
133 |
- perl_set_version |
134 |
- if [[ -f Build ]] ; then |
135 |
- ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" |
136 |
- elif [[ -f Makefile ]] ; then |
137 |
- emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" |
138 |
+ |
139 |
+ # this might sometimes work... |
140 |
+ if ! has network ${my_test_control} ; then |
141 |
+ export NO_NETWORK_TESTING=1 |
142 |
fi |
143 |
fi |
144 |
+ |
145 |
+ perl_set_version |
146 |
+ if [[ -f Build ]] ; then |
147 |
+ ./Build test verbose=${my_test_verbose} || die "test failed" |
148 |
+ elif [[ -f Makefile ]] ; then |
149 |
+ emake test TEST_VERBOSE=${my_test_verbose} || die "test failed" |
150 |
+ fi |
151 |
} |
152 |
|
153 |
# @FUNCTION: perl-module_src_install |