Browse Source

Merge branch 'allow-deactivation' of DamienCassou/makel into master

pull/3/head
Damien Cassou 1 year ago
committed by Gitea
parent
commit
0be395e831
3 changed files with 57 additions and 42 deletions
  1. +37
    -39
      makel.mk
  2. +0
    -0
      test/data/test-lint-checkdoc-ko-1.el
  3. +20
    -3
      test/run-tests.sh

+ 37
- 39
makel.mk View File

@ -43,11 +43,10 @@ debug:
install-elpa-dependencies:
@if [ -n "${ELPA_DEPENDENCIES}" ]; then \
echo "# Install ELPA dependencies: $(call split_with_commas,${ELPA_DEPENDENCIES})"; \
output=$$(mktemp --tmpdir "makel-ci-dependencies-XXXXX"); \
$(BATCH) \
output=$$($(BATCH) \
--funcall package-refresh-contents \
${patsubst %,--eval "(package-install (quote %))",${ELPA_DEPENDENCIES}} \
> $${output} 2>&1 || ( cat $${output} && exit 1 ); \
${patsubst %,--eval "(package-install (quote %))",${ELPA_DEPENDENCIES}} 2>&1) \
|| ( echo "$${output}" && exit 1 ); \
fi
download-non-elpa-dependencies:
@ -74,12 +73,13 @@ MAKEL_TEST_ERT_FILES0=$(filter-out %-autoloads.el,${TEST_ERT_FILES})
MAKEL_TEST_ERT_FILES=$(patsubst %,(load-file \"%\"),${MAKEL_TEST_ERT_FILES0})
test-ert:
# Run ert tests from $(call split_with_commas,${MAKEL_TEST_ERT_FILES0})…
@output=$$(mktemp --tmpdir "makel-test-ert-XXXXX"); \
${BATCH} \
$(if ${TEST_ERT_OPTIONS},${TEST_ERT_OPTIONS}) \
--eval "(progn ${MAKEL_TEST_ERT_FILES} (ert-run-tests-batch-and-exit))" \
> $${output} 2>&1 || ( cat $${output} && exit 1 )
@if [ -n "${TEST_ERT_FILES}" ]; then \
echo "# Run ert tests from $(call split_with_commas,${MAKEL_TEST_ERT_FILES0})"; \
output=$$(${BATCH} \
$(if ${TEST_ERT_OPTIONS},${TEST_ERT_OPTIONS}) \
--eval "(progn ${MAKEL_TEST_ERT_FILES} (ert-run-tests-batch-and-exit))" 2>&1) \
|| ( echo "$${output}" && exit 1 ); \
fi;
####################################
# Tests - Buttercup
@ -88,11 +88,10 @@ test-ert:
test-buttercup:
@if [ -n "${TEST_BUTTERCUP_OPTIONS}" ]; then \
echo "# Run buttercup tests on $(call split_with_commas,${TEST_BUTTERCUP_OPTIONS})"; \
output=$$(mktemp --tmpdir "makel-test-buttercup-XXXXX"); \
${BATCH} \
--eval "(require 'buttercup)" \
-f buttercup-run-discover ${TEST_BUTTERCUP_OPTIONS} \
> $${output} 2>&1 || ( cat $${output} && exit 1 ); \
output=$$(${BATCH} \
--eval "(require 'buttercup)" \
-f buttercup-run-discover ${TEST_BUTTERCUP_OPTIONS} 2>&1) \
|| ( echo "$${output}" && exit 1 ); \
fi;
####################################
@ -112,18 +111,13 @@ MAKEL_LINT_CHECKDOC_FILES=$(patsubst %,\"%\",${MAKEL_LINT_CHECKDOC_FILES0})
# errors, it always succeeds. We thus have to check if checkdoc
# printed anything to decide the exit status of the rule.
lint-checkdoc:
# Run checkdoc on $(call split_with_commas,${MAKEL_LINT_CHECKDOC_FILES0})…
@output=$$(mktemp --tmpdir "makel-lint-checkdoc-XXXXX"); \
${BATCH} \
$(if ${LINT_CHECKDOC_OPTIONS},${LINT_CHECKDOC_OPTIONS}) \
--eval "(mapcar #'checkdoc-file (list ${MAKEL_LINT_CHECKDOC_FILES}))" \
> $${output} 2>&1; \
if [ "$$(stat --printf='%s' $${output})" -eq 0 ]; then \
exit 0; \
else \
cat $${output}; \
exit 1; \
fi
@if [ -n "${LINT_CHECKDOC_FILES}" ]; then \
echo "# Run checkdoc on $(call split_with_commas,${MAKEL_LINT_CHECKDOC_FILES0})"; \
output=$$(${BATCH} \
$(if ${LINT_CHECKDOC_OPTIONS},${LINT_CHECKDOC_OPTIONS}) \
--eval "(mapcar #'checkdoc-file (list ${MAKEL_LINT_CHECKDOC_FILES}))" 2>&1); \
[ -z "$${output}" ] || (echo "$${output}"; exit 1); \
fi;
####################################
# Lint - Package-lint
@ -132,12 +126,14 @@ lint-checkdoc:
MAKEL_LINT_PACKAGE_LINT_FILES=$(filter-out %-autoloads.el,${LINT_PACKAGE_LINT_FILES})
lint-package-lint:
# Run package-lint on $(call split_with_commas,${MAKEL_LINT_PACKAGE_LINT_FILES})…
@${BATCH} \
--eval "(require 'package-lint)" \
$(if ${LINT_PACKAGE_LINT_OPTIONS},${LINT_PACKAGE_LINT_OPTIONS}) \
--funcall package-lint-batch-and-exit \
${MAKEL_LINT_PACKAGE_LINT_FILES}
@if [ -n "${LINT_PACKAGE_LINT_FILES}" ]; then \
echo "# Run package-lint on $(call split_with_commas,${MAKEL_LINT_PACKAGE_LINT_FILES})"; \
${BATCH} \
--eval "(require 'package-lint)" \
$(if ${LINT_PACKAGE_LINT_OPTIONS},${LINT_PACKAGE_LINT_OPTIONS}) \
--funcall package-lint-batch-and-exit \
${MAKEL_LINT_PACKAGE_LINT_FILES}; \
fi;
####################################
# Lint - Compilation
@ -146,9 +142,11 @@ lint-package-lint:
MAKEL_LINT_COMPILE_FILES=$(filter-out %-autoloads.el,${LINT_COMPILE_FILES})
lint-compile:
# Run byte compilation on $(call split_with_commas,${MAKEL_LINT_COMPILE_FILES})…
@${BATCH} \
--eval "(setq byte-compile-error-on-warn t)" \
$(if ${LINT_COMPILE_OPTIONS},${LINT_COMPILE_OPTIONS}) \
--funcall batch-byte-compile \
${MAKEL_LINT_COMPILE_FILES}
@if [ -n "${LINT_COMPILE_FILES}" ]; then \
echo "# Run byte compilation on $(call split_with_commas,${MAKEL_LINT_COMPILE_FILES})"; \
${BATCH} \
--eval "(setq byte-compile-error-on-warn t)" \
$(if ${LINT_COMPILE_OPTIONS},${LINT_COMPILE_OPTIONS}) \
--funcall batch-byte-compile \
${MAKEL_LINT_COMPILE_FILES}; \
fi

test/data/test-lint-checkdoc-ko.el → test/data/test-lint-checkdoc-ko-1.el View File


+ 20
- 3
test/run-tests.sh View File

@ -113,6 +113,10 @@ check_exit_failure
run TEST_ERT_FILES="data/test-ert-ok-1.el data/test-ert-ko.el" test-ert
check_exit_failure
# Check that empty TEST_ERT_FILES doesn't run ert
run TEST_ERT_FILES="" test-ert
check_not_output "ert"
####################################
# Tests - Buttercup
####################################
@ -154,21 +158,25 @@ run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ok.el" lint-checkdoc
check_not_output "^test-lint-checkdoc-ok.el:"
# Check that linting an unclean file echoes an error line
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ko.el" lint-checkdoc
check_output "^test-lint-checkdoc-ko.el:.* Argument .foo. should appear (as FOO) in the doc string$"
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ko-1.el" lint-checkdoc
check_output "^test-lint-checkdoc-ko-1.el:.* Argument .foo. should appear (as FOO) in the doc string$"
# Check that linting a clean file exits with success status
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ok.el" lint-checkdoc
check_exit_success
# Check that linting an unclean file exits with failure status
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ko.el" lint-checkdoc
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ko-1.el" lint-checkdoc
check_exit_failure
# Check that linting several files including an unclean one exits with failure status
run LINT_CHECKDOC_FILES="data/test-lint-checkdoc-ok.el data/test-lint-checkdoc-ko.el" lint-checkdoc
check_exit_failure
# Check that empty LINT_CHECKDOC_FILES doesn't run checkdoc
run LINT_CHECKDOC_FILES="" lint-checkdoc
check_not_output "checkdoc"
####################################
# Lint - Package-lint
####################################
@ -197,6 +205,10 @@ check_exit_failure
run LINT_PACKAGE_LINT_FILES="data/test-lint-package-lint-ok.el data/test-lint-package-lint-ko.el" lint-package-lint
check_exit_failure
# Check that empty LINT_PACKAGE_LINT_FILES doesn't run package-lint
run LINT_PACKAGE_LINT_FILES="" lint-package-lint
check_not_output "package-lint"
####################################
# Lint - Compilation
####################################
@ -225,6 +237,11 @@ check_exit_failure
run LINT_COMPILE_FILES="data/test-lint-compile-ok.el data/test-lint-compile-ko.el" lint-compile
check_exit_failure
# Check that empty TEST_COMPILE-FILES doesn't byte compile
run TEST_COMPILE-FILES="" lint-compile
check_not_output "compil"
####################################
# Conclusion
####################################


Loading…
Cancel
Save