summaryrefslogtreecommitdiff
path: root/cfg.mk
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2011-11-16 23:21:18 +0700
committerGary V. Vaughan <gary@gnu.org>2011-11-25 14:53:41 +0700
commita53d6cc4983d5c274b9db259835af12c12842a6b (patch)
tree51274d0d1d4588dfe7977c749948b49884500a53 /cfg.mk
parent06c6555d4a77a5e91f43da3451586534da93e0ae (diff)
downloadlibtool-a53d6cc4983d5c274b9db259835af12c12842a6b.tar.gz
tests: migrate tests/sh.test checks to syntax-checks.
Some modernization of the legacy testsuite. * tests/sh.test: Remove. * Makefile.am (COMMON_TESTS): Adjust. * cfg.mk (sc_libtool_m4_cc_basename, sc_prohibit_bracket_as_test) (sc_prohibit_nested_quotes, sc_prohibit_set_dummy_without_shift) (sc_prohibit_set_minus_minus, sc_prohibit_test_binary_operators) (sc_prohibit_test_dollar, sc_prohibit_test_minus_e) (sc_prohibit_test_unary_operators, sc_prohibit_test_X) (sc_prohibit_Xsed_withou_X, sc_require_function_nl_brace): Functionally identical tests to what used to be performed by sh.test, only with coverage of all files. * bootstrap, build-aux/edit-readme-alpha, build-aux/extract-trace, build-aux/getopt.m4sh, build-aux/ltmain.m4sh, configure.ac, m4/libtool.m4, m4/ltdl.m4, tests/bindir.at, tests/configure-iface.at, tests/cwrapper.at, tests/darwin.at, tests/defs.m4sh, tests/demo-hardcode.test, tests/dlloader-api.at, tests/exceptions.at, tests/getopt-m4sh.at, tests/lalib-syntax.at, tests/link-2.test, tests/link-order2.at, tests/loadlibrary.at, tests/lt_dladvise.at, tests/lt_dlexit.at, tests/lt_dlopen_a.at, tests/lt_dlopenext.at, tests/need_lib_prefix.at, tests/nonrecursive.at, tests/recursive.at, tests/resident.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/sysroot.at, tests/tagtrace.test, tests/testsuite.at: Fix violations of the new syntax checks. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
Diffstat (limited to 'cfg.mk')
-rw-r--r--cfg.mk104
1 files changed, 104 insertions, 0 deletions
diff --git a/cfg.mk b/cfg.mk
index 58c01cc0..c9bfd927 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -55,6 +55,110 @@ local-checks-to-skip = \
# trailing_blank: flags valid rfc3676 separators
# unmarked_diagnostics: libtool isn't internationalized
+
+# Check for correct usage of $cc_basename in libtool.m4.
+sc_libtool_m4_cc_basename:
+ @sed -n '/case \$$cc_basename in/,/esac/ { \
+ /^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p; \
+ }' '$(srcdir)/$(macro_dir)/libtool.m4' | grep . && { \
+ msg="\$$cc_basename matches should include a trailing \`*'." \
+ $(_sc_say_and_exit) } || :
+
+# Check for uses of Xsed without corresponding echo "X
+exclude_file_name_regexp--sc_prohibit_Xsed_without_X = ^cfg.mk$$
+sc_prohibit_Xsed_without_X:
+ @files=$$($(VC_LIST_EXCEPT)); \
+ if test -n "$$files"; then \
+ grep -nE '\$$Xsed' $$files | grep -vE '(func_echo_all|\$$ECHO) \\*"X' && { \
+ msg='occurrences of `$$Xsed'\'' without `$$ECHO "X'\'' on the same line' \
+ $(_sc_say_and_exit) } || :; \
+ else :; \
+ fi || :
+
+# Check for using `[' instead of `test'.
+exclude_file_name_regexp--sc_prohibit_bracket_as_test = ^cfg.mk$$
+sc_prohibit_bracket_as_test:
+ @prohibit='if[ ]+\[' \
+ halt="use \`if test' instead of \`if ['" \
+ $(_sc_search_regexp)
+
+# Check for quotes within backquotes within quotes "`"bar"`"
+exclude_file_name_regexp--sc_prohibit_nested_quotes = ^cfg.mk$$
+sc_prohibit_nested_quotes:
+ @prohibit='"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' \
+ halt='found nested double quotes' \
+ $(_sc_search_regexp_or_exclude)
+
+# Check for using shift after set dummy (same or following line).
+exclude_file_name_regexp--sc_prohibit_set_dummy_without_shift = ^cfg.mk$$
+sc_prohibit_set_dummy_without_shift:
+ @files=$$($(VC_LIST_EXCEPT)); \
+ if test -n "$$files"; then \
+ grep -nE '(set dummy|shift)' $$files | \
+ sed -n '/set[ ][ ]*dummy/{ \
+ /set.*dummy.*;.*shift/d; \
+ N; \
+ /\n.*shift/D; \
+ p; \
+ }' | grep -n . && { \
+ msg="use \`shift' after \`set dummy'" \
+ $(_sc_say_and_exit) } || :; \
+ else :; \
+ fi || :
+
+# Check for using set -- instead of set dummy
+exclude_file_name_regexp--sc_prohibit_set_minus_minus = ^cfg.mk$$
+sc_prohibit_set_minus_minus:
+ @prohibit='set[ ]+--[ ]+' \
+ halt="use \`set dummy ...' instead of \`set -- ...'" \
+ $(_sc_search_regexp)
+
+# Check for using test X"... instead of test "X...
+exclude_file_name_regexp--sc_prohibit_test_X = ^cfg.mk$$
+sc_prohibit_test_X:
+ @prohibit='test[ ]+(![ ])?(-.[ ]+)?[Xx]["'\'']' \
+ halt='use `test "X..."'\'' instead of `test X"'\' \
+ $(_sc_search_regexp)
+
+# Check for bad binary operators.
+sc_prohibit_test_binary_operators:
+ @prohibit='if[ ]+["'\'']?\$$[^ ]+[ ]+(=|-[lg][te]|-eq|-ne)' \
+ halt="Use \`if test \$$something =' instead of \`if \$$something ='" \
+ $(_sc_search_regexp)
+
+# Check for using test $... instead of test "$...
+exclude_file_name_regexp--sc_prohibit_test_dollar = ^cfg.mk$$
+sc_prohibit_test_dollar:
+ @prohibit='test[ ]+(![ ])?(-.[ ]+)?X?\$$[^?#]' \
+ halt='use `test "$$..."'\'' instead of `test $$'\' \
+ $(_sc_search_regexp)
+
+# Never use test -e.
+exclude_file_name_regexp--sc_prohibit_test_minus_e = ^cfg.mk$$
+sc_prohibit_test_minus_e:
+ @prohibit='test[ ]+(![ ])?-e' \
+ halt="use \`test -f' instead of \`test -e'" \
+ $(_sc_search_regexp)
+
+# Check for bad unary operators.
+sc_prohibit_test_unary_operators:
+ @prohibit='if[ ]+-[a-z]' \
+ halt="use \`if test -X' instead of \`if -X'" \
+ $(_sc_search_regexp)
+
+# Check for opening brace on next line in shell function definition.
+exclude_file_name_regexp--sc_require_function_nl_brace = (^HACKING|\.[ch])$$
+sc_require_function_nl_brace:
+ @for file in $$($(VC_LIST_EXCEPT)); do \
+ sed -n '/^func_[^ ]*[ ]*(/{ \
+ N; \
+ /^func_[^ ]* ()\n{$$/d; \
+ p; \
+ }' $$file | grep -E . && { \
+ msg="found malformed function_definition in $$file" \
+ $(_sc_say_and_exit) } || :; \
+ done
+
sc_trailing_blank-non-rfc3676:
@prohibit='([^-][^-][ ][ ]*|^[ ][ ]*)$$' \
halt='found trailing blank(s)' \