1 |
From: Andreas K. Hüttel <dilfridge@g.o> |
2 |
|
3 |
--- |
4 |
eclass/perl-module.eclass | 65 ++++++++++++++++++++++++++++++++--------------- |
5 |
1 file changed, 45 insertions(+), 20 deletions(-) |
6 |
|
7 |
diff --git a/eclass/perl-module.eclass b/eclass/perl-module.eclass |
8 |
index faa8a34..c174d5f 100644 |
9 |
--- a/eclass/perl-module.eclass |
10 |
+++ b/eclass/perl-module.eclass |
11 |
@@ -314,13 +314,14 @@ perl-module_src_compile() { |
12 |
# @DESCRIPTION: |
13 |
# (EAPI=6) Variable that controls if tests are run in the test phase |
14 |
# at all, and if yes under which conditions. Defaults to "do parallel" |
15 |
-# In EAPI=5 the variable is called SRC_TEST and defaults to "skip". |
16 |
-# All of the following have been tested to work: |
17 |
-# DIST_TEST="do parallel" |
18 |
-# DIST_TEST="parallel" |
19 |
-# DIST_TEST="parallel do" |
20 |
-# DIST_TEST=parallel |
21 |
-# DIST_TEST=skip |
22 |
+# If neither "do" nor "parallel" is recognized, tests are skipped. |
23 |
+# (In EAPI=5 the variable is called SRC_TEST, defaults to "skip", and |
24 |
+# recognizes fewer options.) |
25 |
+# The following space-separated keywords are recognized: |
26 |
+# do : run tests |
27 |
+# parallel : run tests in parallel |
28 |
+# verbose : increase test verbosity |
29 |
+# network : do not try to disable network tests |
30 |
|
31 |
# @ECLASS-VARIABLE: DIST_TEST_OVERRIDE |
32 |
# @DESCRIPTION: |
33 |
@@ -333,33 +334,57 @@ perl-module_src_compile() { |
34 |
# @FUNCTION: perl-module_src-test |
35 |
# @USAGE: perl-module_src_test() |
36 |
# @DESCRIPTION: |
37 |
-# This code attempts to work out your threadingness from MAKEOPTS |
38 |
-# and apply them to Test::Harness. |
39 |
-# |
40 |
-# If you want more verbose testing, set TEST_VERBOSE=1 |
41 |
-# in your bashrc | /etc/portage/make.conf | ENV |
42 |
+# This code attempts to work out your threadingness and runs tests |
43 |
+# according to the settings of DIST_TEST using Test::Harness. |
44 |
perl-module_src_test() { |
45 |
debug-print-function $FUNCNAME "$@" |
46 |
local my_test_control |
47 |
+ local my_test_verbose |
48 |
+ |
49 |
if [[ ${EAPI:-0} = 5 ]] ; then |
50 |
my_test_control=${SRC_TEST} |
51 |
+ my_test_verbose=${TEST_VERBOSE:-0} |
52 |
+ if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then |
53 |
+ if has "${my_test_verbose}" 0 && has 'parallel' ${my_test_control} ; then |
54 |
+ export HARNESS_OPTIONS=j$(makeopts_jobs) |
55 |
+ einfo "Test::Harness Jobs=$(makeopts_jobs)" |
56 |
+ fi |
57 |
+ else |
58 |
+ einfo Skipping tests due to SRC_TEST=${SRC_TEST} |
59 |
+ return 0 |
60 |
+ fi |
61 |
else |
62 |
[[ -n "${DIST_TEST_OVERRIDE}" ]] && ewarn DIST_TEST_OVERRIDE is set to ${DIST_TEST_OVERRIDE} |
63 |
my_test_control=${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}} |
64 |
- fi |
65 |
|
66 |
- if has 'do' ${my_test_control} || has 'parallel' ${my_test_control} ; then |
67 |
- if has "${TEST_VERBOSE:-0}" 0 && has 'parallel' ${my_test_control} ; then |
68 |
+ if ! has 'do' ${my_test_control} && ! has 'parallel' ${my_test_control} ; then |
69 |
+ einfo Skipping tests due to DIST_TEST=${my_test_control} |
70 |
+ return 0 |
71 |
+ fi |
72 |
+ |
73 |
+ if has verbose ${my_test_control} ; then |
74 |
+ my_test_verbose=1 |
75 |
+ else |
76 |
+ my_test_verbose=0 |
77 |
+ fi |
78 |
+ |
79 |
+ if has parallel ${my_test_control} ; then |
80 |
export HARNESS_OPTIONS=j$(makeopts_jobs) |
81 |
einfo "Test::Harness Jobs=$(makeopts_jobs)" |
82 |
fi |
83 |
- perl_set_version |
84 |
- if [[ -f Build ]] ; then |
85 |
- ./Build test verbose=${TEST_VERBOSE:-0} || die "test failed" |
86 |
- elif [[ -f Makefile ]] ; then |
87 |
- emake test TEST_VERBOSE=${TEST_VERBOSE:-0} || die "test failed" |
88 |
+ |
89 |
+ # this might sometimes work... |
90 |
+ if ! has network ${my_test_control} ; then |
91 |
+ export NO_NETWORK_TESTING=1 |
92 |
fi |
93 |
fi |
94 |
+ |
95 |
+ perl_set_version |
96 |
+ if [[ -f Build ]] ; then |
97 |
+ ./Build test verbose=${my_test_verbose} || die "test failed" |
98 |
+ elif [[ -f Makefile ]] ; then |
99 |
+ emake test TEST_VERBOSE=${my_test_verbose} || die "test failed" |
100 |
+ fi |
101 |
} |
102 |
|
103 |
# @FUNCTION: perl-module_src_install |
104 |
-- |
105 |
2.6.3 |