Debian Codegraph @

debian/patches/0003-Tests-try-to-run-tests-with-custom-verbose-log-drive.patch

raw
1 From: Didier Raboud <[email protected]>
2 Date: Sun, 4 May 2014 12:34:59 +0200
3 Subject: Tests: try to run tests with custom verbose log driver
4
5 This avoids timing out on slow architectures
6
7 Closes: #868743
8 ---
9 scripts/global.mk | 4 ++
10 scripts/test-driver-verbose | 146 ++++++++++++++++++++++++++++++++++++++++++++
11 2 files changed, 150 insertions(+)
12 create mode 100644 scripts/test-driver-verbose
13
14 diff --git a/scripts/global.mk b/scripts/global.mk
15 index 792b8b0..22ad739 100644
16 --- a/scripts/global.mk
17 +++ b/scripts/global.mk
18 @@ -8,6 +8,10 @@
19
20 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS) -DPACKAGE_LOCALE_DIR=\"$(PACKAGE_LOCALE_DIR)\" -DPACKAGE_DATA_DIR=\"$(PACKAGE_DATA_DIR)\" -DPACKAGE_LIB_DIR=\"$(PACKAGE_LIB_DIR)\" -DPACKAGE_BIN_DIR=\"$(PACKAGE_BIN_DIR)\" -DPKGMODULEDIR=\"$(PKGMODULEDIR)\" -DPKGXMLDATADIR=\"$(PKGXMLDATADIR)\"
21
22 +# Use a verbose script to avoid timing out
23 +LOG_DRIVER = $(top_srcdir)/scripts/test-driver-verbose
24 +
25 +
26 LIBS = $(INTLLIBS) @LIBS@
27
28 # Libraries
29 diff --git a/scripts/test-driver-verbose b/scripts/test-driver-verbose
30 new file mode 100644
31 index 0000000..f26644f
32 --- /dev/null
33 +++ b/scripts/test-driver-verbose
34 @@ -0,0 +1,146 @@
35 +#! /bin/sh
36 +# test-driver - testsuite driver script inherited from Automake's basic, but with verbose output.
37 +# Verbosity patch by Didier Raboud <[email protected]>
38 +
39 +scriptversion=2018-03-07.03; # UTC
40 +
41 +# Copyright (C) 2011-2018 Free Software Foundation, Inc.
42 +#
43 +# This program is free software; you can redistribute it and/or modify
44 +# it under the terms of the GNU General Public License as published by
45 +# the Free Software Foundation; either version 2, or (at your option)
46 +# any later version.
47 +#
48 +# This program is distributed in the hope that it will be useful,
49 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
50 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51 +# GNU General Public License for more details.
52 +#
53 +# You should have received a copy of the GNU General Public License
54 +# along with this program. If not, see <https://www.gnu.org/licenses/>.
55 +
56 +# As a special exception to the GNU General Public License, if you
57 +# distribute this file as part of a program that contains a
58 +# configuration script generated by Autoconf, you may include it under
59 +# the same distribution terms that you use for the rest of that program.
60 +
61 +# Make unconditional expansion of undefined variables an error. This
62 +# helps a lot in preventing typo-related bugs.
63 +set -u
64 +
65 +usage_error ()
66 +{
67 + echo "$0: $*" >&2
68 + print_usage >&2
69 + exit 2
70 +}
71 +
72 +print_usage ()
73 +{
74 + cat <<END
75 +Usage:
76 + test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
77 + [--expect-failure={yes|no}] [--color-tests={yes|no}]
78 + [--enable-hard-errors={yes|no}] [--]
79 + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
80 +The '--test-name', '--log-file' and '--trs-file' options are mandatory.
81 +END
82 +}
83 +
84 +test_name= # Used for reporting.
85 +log_file= # Where to save the output of the test script.
86 +trs_file= # Where to save the metadata of the test run.
87 +expect_failure=no
88 +color_tests=no
89 +enable_hard_errors=yes
90 +while test $# -gt 0; do
91 + case $1 in
92 + --help) print_usage; exit $?;;
93 + --version) echo "test-driver $scriptversion"; exit $?;;
94 + --test-name) test_name=$2; shift;;
95 + --log-file) log_file=$2; shift;;
96 + --trs-file) trs_file=$2; shift;;
97 + --color-tests) color_tests=$2; shift;;
98 + --expect-failure) expect_failure=$2; shift;;
99 + --enable-hard-errors) enable_hard_errors=$2; shift;;
100 + --) shift; break;;
101 + -*) usage_error "invalid option: '$1'";;
102 + *) break;;
103 + esac
104 + shift
105 +done
106 +
107 +missing_opts=
108 +test x"$test_name" = x && missing_opts="$missing_opts --test-name"
109 +test x"$log_file" = x && missing_opts="$missing_opts --log-file"
110 +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
111 +if test x"$missing_opts" != x; then
112 + usage_error "the following mandatory options are missing:$missing_opts"
113 +fi
114 +
115 +if test $# -eq 0; then
116 + usage_error "missing argument"
117 +fi
118 +
119 +if test $color_tests = yes; then
120 + # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
121 + red='' # Red.
122 + grn='' # Green.
123 + lgn='' # Light green.
124 + blu='' # Blue.
125 + mgn='' # Magenta.
126 + std='' # No color.
127 +else
128 + red= grn= lgn= blu= mgn= std=
129 +fi
130 +
131 +do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
132 +trap "st=129; $do_exit" 1
133 +trap "st=130; $do_exit" 2
134 +trap "st=141; $do_exit" 13
135 +trap "st=143; $do_exit" 15
136 +
137 +# Test script is run here.
138 +# OdyX: Make it verbose by using tee
139 +"$@" 2>&1 | tee -a $log_file
140 +estatus=$?
141 +
142 +if test $enable_hard_errors = no && test $estatus -eq 99; then
143 + tweaked_estatus=1
144 +else
145 + tweaked_estatus=$estatus
146 +fi
147 +
148 +case $tweaked_estatus:$expect_failure in
149 + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
150 + 0:*) col=$grn res=PASS recheck=no gcopy=no;;
151 + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
152 + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
153 + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
154 + *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
155 +esac
156 +
157 +# Report the test outcome and exit status in the logs, so that one can
158 +# know whether the test passed or failed simply by looking at the '.log'
159 +# file, without the need of also peaking into the corresponding '.trs'
160 +# file (automake bug#11814).
161 +echo "$res $test_name (exit status: $estatus)" >>$log_file
162 +
163 +# Report outcome to console.
164 +echo "${col}${res}${std}: $test_name"
165 +
166 +# Register the test result, and other relevant metadata.
167 +echo ":test-result: $res" > $trs_file
168 +echo ":global-test-result: $res" >> $trs_file
169 +echo ":recheck: $recheck" >> $trs_file
170 +echo ":copy-in-global-log: $gcopy" >> $trs_file
171 +
172 +# Local Variables:
173 +# mode: shell-script
174 +# sh-indentation: 2
175 +# eval: (add-hook 'before-save-hook 'time-stamp)
176 +# time-stamp-start: "scriptversion="
177 +# time-stamp-format: "%:y-%02m-%02d.%02H"
178 +# time-stamp-time-zone: "UTC0"
179 +# time-stamp-end: "; # UTC"
180 +# End: