diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2018-08-24 15:20:12 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-27 18:31:18 (GMT) |
commit | b2fa7a2372f42af404a942a4691a5341af8868e9 (patch) | |
tree | 5a7320926ea9d35dffce9a37d44ebbe981cfd4c3 /t/check-non-portable-shell.pl | |
parent | 2a59a6ef2066c786b69253e148cccdc92cfdb434 (diff) | |
download | git-b2fa7a2372f42af404a942a4691a5341af8868e9.zip git-b2fa7a2372f42af404a942a4691a5341af8868e9.tar.gz git-b2fa7a2372f42af404a942a4691a5341af8868e9.tar.bz2 |
tests: fix and add lint for non-portable seq
The seq command is not in POSIX, and doesn't exist on
e.g. OpenBSD. We've had the test_seq wrapper since d17cf5f3a3 ("tests:
Introduce test_seq", 2012-08-04), but use of it keeps coming back,
e.g. in the recently added "fetch negotiator" tests being added here.
So let's also add a check to "make test-lint". The regex is aiming to
capture the likes of $(seq ..) and "seq" as a stand-alone command,
without capturing some existing cases where we e.g. have files called
"seq", as \bseq\b would do.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/check-non-portable-shell.pl')
-rwxr-xr-x | t/check-non-portable-shell.pl | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index c8f10d4..75f3829 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -42,6 +42,7 @@ while (<>) { /\btest\s+[^=]*==/ and err '"test a == b" is not portable (use =)'; /\bwc -l.*"\s*=/ and err '`"$(wc -l)"` is not portable (use test_line_count)'; /\bhead\s+-c\b/ and err 'head -c is not portable (use test_copy_bytes BYTES <file >out)'; + /(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)'; /\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)'; /^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and err '"FOO=bar shell_func" assignment extends beyond "shell_func"'; |