diff options
author | Johan Claesson <[email protected]> | 2018-09-15 23:14:47 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2018-10-09 11:57:01 +0200 |
commit | 02e3a9b162a1fe193c271cd0db7a99c326b63844 (patch) | |
tree | ba9b693e0a82a7c9c4a3ac42455b613f3bc4e3f1 /lib/tools/emacs/test-erlang-mode | |
parent | 8755c68695ee5c672a4105077ac2e5953939d528 (diff) | |
download | otp-02e3a9b162a1fe193c271cd0db7a99c326b63844.tar.gz otp-02e3a9b162a1fe193c271cd0db7a99c326b63844.tar.bz2 otp-02e3a9b162a1fe193c271cd0db7a99c326b63844.zip |
Emacs: do not accept compiler warnings in selected elisp files
Diffstat (limited to 'lib/tools/emacs/test-erlang-mode')
-rwxr-xr-x | lib/tools/emacs/test-erlang-mode | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/lib/tools/emacs/test-erlang-mode b/lib/tools/emacs/test-erlang-mode index 910af48ed8..2418d23c92 100755 --- a/lib/tools/emacs/test-erlang-mode +++ b/lib/tools/emacs/test-erlang-mode @@ -48,6 +48,7 @@ version="$(emacs --version | head -n1)" version_number="${version#GNU Emacs }" version_major="${version_number%%\.*}" +echo "Emacs version $version" case "$version_major" in [0-9][0-9]) @@ -60,22 +61,50 @@ case "$version_major" in echo "Skipping emacs test due to unsupported emacs version ($version)" exit "$invalid_emacs_rc";; esac - + set -x # Test interpreted erlang-mode. emacs -Q -batch -L . -l erlang.el -f erlang-mode -# Compile. -emacs -Q -batch -L . -f batch-byte-compile *.el +# Compile everything except erldoc.el. +for el in *.el +do + [ "$el" = "erldoc.el" ] && continue + emacs -Q -batch -L . -f batch-byte-compile "$el" +done # Test compiled erlang-mode. emacs -Q -batch -L . -l erlang.elc -f erlang-mode -# Run unit tests in interpreted mode. -emacs -Q -batch -L . -l erlang.el -l erlang-test.el \ - -f ert-run-tests-batch-and-exit - -# Run unit tests in compiled mode. -emacs -Q -batch -L . -l erlang.elc -l erlang-test.elc \ - -f ert-run-tests-batch-and-exit +if [ "$version_major" -ge 25 ] +then + # Run unit tests in interpreted mode. + emacs -Q -batch -L . -l erlang.el -l erlang-test.el \ + -f ert-run-tests-batch-and-exit + + # Run unit tests in compiled mode. + emacs -Q -batch -L . -l erlang.elc -l erlang-test.elc \ + -f ert-run-tests-batch-and-exit + + # Compile erldoc which depends on cl-lib which was introduced in + # Emacs 25. + emacs -Q -batch -L . -f batch-byte-compile erldoc.el + + # Compile selected files again and this time do not accept any + # warnings. Add files here whenever they are cleaned of warnings. + if [ "$version_major" -ge 26 ] + then + unforgiving="(setq byte-compile-error-on-warn t)" + else + # Workaround byte-compile-error-on-warn which seem broken in + # Emacs 25. + unforgiving="(advice-add #'display-warning :after \ + (lambda (_ f _ _) (error \"%s\" f)))" + fi + for el in erlang.el erlang-test.el erlang-edoc.el \ + erlang-start.el erldoc.el + do + emacs -Q -batch -L . --eval "$unforgiving" -f batch-byte-compile "$el" + done +fi |