~ubuntu-branches/ubuntu/saucy/devscripts/saucy

« back to all changes in this revision

Viewing changes to test/test_checkbashisms

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung, Christoph Berg, James McCoy, Dmitry Smirnov, Paul Wise, Benjamin Drung, Cyril Brulebois, Tony Mancill, David Prévot, Josselin Mouette, Raphael Geissert, Regid Ichira, Colin Watson
  • Date: 2013-02-18 21:50:11 UTC
  • mfrom: (10.7.8 squeeze)
  • mto: (10.10.1 sid)
  • mto: This revision was merged to the branch mainline in revision 132.
  • Revision ID: package-import@ubuntu.com-20130218215011-efervwilveqwzzzx
Tags: 2.13.0
[ Christoph Berg ]
* origtargz: New script: fetch the orig tarball of a Debian package from
  various sources, and unpack it
* debcommit: --changelog-info will pass --author and --date for git commits.

[ James McCoy ]
* licensecheck: Recognize MPL 2.0 licenses.  Thanks to Ryan Pavlik for the
  patch.  (Closes: #687664)
* namecheck: Check Apache's projects page for names.  (Closes: #686862)
* debcommit:
  + Drop checks for old dpkg versions and always use the necessary Perl
    modules (Dpkg::Changelog::Parse, Dpkg::Vendor::Ubuntu,
    Dpkg::Changelog::Entry::Debian).
  + Add changelog info support for hg and bzr.
* annotate-output:
  + Handle an incomplete line of output.  (Closes: #695609)
  + Don't treat backslashes in the command's output as an escape.  (Closes:
    #695613)
  + Don't swallow leading whitespace.  (Closes: #695612, LP: #1120917)
* dscverify: Use "gpg --status-fd" to determine if a valid signature is
  found and only use the signed content.  (Closes: #695914)
* wrap-and-sort: Fix repeated word in man page.  (Closes: #696363)

[ Dmitry Smirnov ]
* licensecheck:
  + Remove any regular comments pattern. (Closes: #526698)
  + Improve command line parsing.
  + Fix GPL license version detection bug.
  + Fix BSD-3-clause detection.

[ Paul Wise ]
* checkbashisms: When examining a bash script, indicate the lack of use of
  bashisms.
* uscan:
  + Access GitHub directly instead of using githubredir.debian.net in
    example GitHub watch URL.
  + Add an example watch URL that matches the various file extensions used
    by common archive formats.
  + Add an example watch URL for Google Code projects.

[ Benjamin Drung ]
* Add bashism test cases from Raphael Geissert.
* Add autopkgtest support. (LP: #1073330)
* suspicious-source: Add inode/symlink and image/x-xpmi to whitelisted
  mime-types.
* wrap-and-sort:
  + Put special entries (variables and placeholders) at the end of the list.
  + Sort debian/control*.in files too.
* licensecheck: detect (L)GPL licenses more permissively. Thanks to
  Laurent Rineau for the patch. (Closes: #659231)
* Bump Standards-Version to 3.9.4 (no changes needed).

[ Cyril Brulebois ]
* Don't auto reverse diffs when DEBDIFF_AUTO_VER_SORT is set to yes, and
  when the version in both packages is the same. (Closes: #650732)

[ Tony Mancill ]
* debsnap: Escape the package name when used in regex.  (Closes: #696018)

[ David Prévot ]
* Minor manpages convention fix: do not terminate the SEE ALSO lists with a
  period. (Closes: #696416)
* French translation update.

[ Josselin Mouette ]
* nmudiff: Use dpkg-parsechangelog to fix manual parsing bug (Closes: #700584)

[ Raphael Geissert ]
* checkbashisms:
  + allow -FOO- as heredoc delimiter
  + simplify mixed single/double balanced quotes correctly
  + correct description of 'setvar'
  + detect traps for DEBUG, ERRNO, or RETURN
  + check for incorrect args. to 'exit' (Closes: #687450)
  + fix handling of # characters in quoted strings
  + detect use of $FUNCNAME, $TMOUT, and $TIMEFORMAT
  + detect uses of sleep with anything other than an int.
  + detect the use of the hash utility and $_
  + check for other forms of brace expansion
  + check for use of non-standard tilde expansion
  + check for case modification expansions
  + check for the use of $GLOBIGNORE

[ Regid Ichira ]
* rc-alert: Support using curl as alternative to wget. (Closes: #690024)
* wnpp-alert: Support using curl as alternative to wget. (Closes: #690056)
* wnpp-check: Support using curl as alternative to wget. (Closes: #690059)

[ Colin Watson ]
* debian/control: Mark devscripts Multi-Arch: foreign. (Closes: #694760)
* debchange, debcommit: Set the timestamp of temporary editor files back
  one second, to make modification detection more reliable in the absence
  of subsecond granularity. (Closes: #697923)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
15
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
16
 
17
 
COMMAND="../scripts/checkbashisms.pl"
 
17
if test "$1" = --installed; then
 
18
    COMMAND=checkbashisms
 
19
    shift
 
20
else
 
21
    COMMAND="../scripts/checkbashisms.pl"
 
22
fi
 
23
 
18
24
WORKDIR="$(readlink -f "${0%/*}")"
19
25
 
20
26
. "${0%/*}/shunit2-helper-functions.sh"
21
27
 
 
28
clean() {
 
29
    cd "$WORKDIR"
 
30
    runCommand "$1" "" "" 0
 
31
}
 
32
 
22
33
found() {
23
34
    cd "$WORKDIR"
24
35
    runCommand "$1" "" "$2" 1
25
36
}
26
37
 
27
 
testSource() {
28
 
    local result="possible bashism in bashisms/source line 2 (should be '.', not 'source'):
29
 
source foo.sh"
30
 
    found "bashisms/source" "$result"
 
38
test_531327() {
 
39
    clean "bashisms/531327.sh"
 
40
}
 
41
 
 
42
test_535368() {
 
43
    clean "-f bashisms/535368.mk"
 
44
}
 
45
 
 
46
test_arith() {
 
47
    found "bashisms/arith.sh" "$(cat bashisms/arith.sh.out)"
 
48
}
 
49
 
 
50
test_array_expansion() {
 
51
    found "bashisms/array-expansion.sh" "$(cat bashisms/array-expansion.sh.out)"
 
52
}
 
53
 
 
54
test_ash_setvar() {
 
55
    found "bashisms/ash-setvar.sh" "$(cat bashisms/ash-setvar.sh.out)"
 
56
}
 
57
 
 
58
test_basic() {
 
59
    found "-f bashisms/basic.mk" "$(cat bashisms/basic.mk.out)"
 
60
}
 
61
 
 
62
test_basic_bash() {
 
63
    clean "-f bashisms/basic-bash.mk"
 
64
}
 
65
 
 
66
test_brace_expansion() {
 
67
    found "-f bashisms/brace-expansion.sh" "$(cat bashisms/brace-expansion.sh.out)"
 
68
}
 
69
 
 
70
test_basic_bash_override() {
 
71
    clean "-f bashisms/basic-bash-override.mk"
 
72
}
 
73
 
 
74
test_case_modification() {
 
75
    found "-f bashisms/case-modification.sh" "$(cat bashisms/case-modification.sh.out)"
 
76
}
 
77
 
 
78
test_comments_in_quoted_strings1() {
 
79
    clean "bashisms/comments-in-quoted-strings1.sh"
 
80
}
 
81
 
 
82
test_comments_in_quoted_strings2() {
 
83
    clean "bashisms/comments-in-quoted-strings2.sh"
 
84
}
 
85
 
 
86
test_command() {
 
87
    found "bashisms/command.sh" "$(cat bashisms/command.sh.out)"
 
88
}
 
89
 
 
90
test_comments_parsing_fns() {
 
91
    found "bashisms/comments-parsing-fns.sh" "$(cat bashisms/comments-parsing-fns.sh.out)"
 
92
}
 
93
 
 
94
test_coproc() {
 
95
    found "bashisms/coproc.sh" "$(cat bashisms/coproc.sh.out)"
 
96
}
 
97
 
 
98
test_dynamic_length() {
 
99
    found "bashisms/dynamic-length.sh" "$(cat bashisms/dynamic-length.sh.out)"
 
100
}
 
101
 
 
102
test_exit_code() {
 
103
    found "bashisms/exit-code.sh" "$(cat bashisms/exit-code.sh.out)"
 
104
}
 
105
 
 
106
test_fail2ban() {
 
107
    clean "bashisms/fail2ban.sh"
 
108
}
 
109
 
 
110
test_fps() {
 
111
    found "bashisms/fps.sh" "$(cat bashisms/fps.sh.out)"
 
112
}
 
113
 
 
114
test_functions() {
 
115
    found "bashisms/functions.sh" "$(cat bashisms/functions.sh.out)"
 
116
}
 
117
 
 
118
test_gettext() {
 
119
    found "bashisms/gettext.sh" "$(cat bashisms/gettext.sh.out)"
 
120
}
 
121
 
 
122
test_glob_ignore() {
 
123
    found "bashisms/glob-ignore.sh" "$(cat bashisms/glob-ignore.sh.out)"
 
124
}
 
125
 
 
126
test_hash() {
 
127
    found "bashisms/hash.sh" "$(cat bashisms/hash.sh.out)"
 
128
}
 
129
 
 
130
test_heredocs() {
 
131
    found "bashisms/heredocs.sh" "$(cat bashisms/heredocs.sh.out)"
 
132
}
 
133
 
 
134
test_heredoc_with_dash() {
 
135
    clean "bashisms/heredoc-with-dash.sh"
 
136
}
 
137
 
 
138
test_heredoc_with_others() {
 
139
    clean "bashisms/heredoc-with-others.sh"
 
140
}
 
141
 
 
142
test_jobs() {
 
143
    found "bashisms/jobs.sh" "$(cat bashisms/jobs.sh.out)"
 
144
}
 
145
 
 
146
test_line_continuation() {
 
147
    found "bashisms/line-continuation.sh" "$(cat bashisms/line-continuation.sh.out)"
 
148
}
 
149
 
 
150
test_negations() {
 
151
    found "bashisms/negations.sh" "$(cat bashisms/negations.sh.out)"
 
152
}
 
153
 
 
154
test_other_vars() {
 
155
    found "bashisms/other-vars.sh" "$(cat bashisms/other-vars.sh.out)"
 
156
}
 
157
 
 
158
test_printf() {
 
159
    found "bashisms/printf.sh" "$(cat bashisms/printf.sh.out)"
 
160
}
 
161
 
 
162
test_quoted_strings() {
 
163
    found "bashisms/quoted-strings.sh" "$(cat bashisms/quoted-strings.sh.out)"
 
164
}
 
165
 
 
166
test_return() {
 
167
    found "bashisms/return.sh" "$(cat bashisms/return.sh.out)"
 
168
}
 
169
 
 
170
test_shell_vars() {
 
171
    clean "-f bashisms/shell-vars.mk"
 
172
}
 
173
 
 
174
test_sleep() {
 
175
    found "bashisms/sleep.sh" "$(cat bashisms/sleep.sh.out)"
 
176
}
 
177
 
 
178
test_source() {
 
179
    found "bashisms/source" "$(cat bashisms/source.out)"
 
180
}
 
181
 
 
182
test_special_case() {
 
183
    found "bashisms/special-case.sh" "$(cat bashisms/special-case.sh.out)"
 
184
}
 
185
 
 
186
test_special_expansions() {
 
187
    found "bashisms/special-expansions.sh" "$(cat bashisms/special-expansions.sh.out)"
 
188
}
 
189
 
 
190
test_subshell_no_arith() {
 
191
    clean "bashisms/subshell-no-arith.sh"
 
192
}
 
193
 
 
194
test_tilde_expansion() {
 
195
    found "bashisms/tilde-expansion.sh" "$(cat bashisms/tilde-expansion.sh.out)"
 
196
}
 
197
 
 
198
test_traps() {
 
199
    found "bashisms/traps.sh" "$(cat bashisms/traps.sh.out)"
 
200
}
 
201
 
 
202
test_underscore_var() {
 
203
    found "bashisms/underscore-var.sh" "$(cat bashisms/underscore-var.sh.out)"
 
204
}
 
205
 
 
206
test_unknown_fns() {
 
207
    found "bashisms/unknown-fns.sh" "$(cat bashisms/unknown-fns.sh.out)"
 
208
}
 
209
 
 
210
test_unterminated_string() {
 
211
    clean "bashisms/unterminated-string.sh"
 
212
}
 
213
 
 
214
test_unterminated_string2() {
 
215
    clean "bashisms/unterminated-string2.sh"
31
216
}
32
217
 
33
218
. shunit2