diff --git a/Makefile b/Makefile index 6bc60acdca3..15dbbb411c0 100644 --- a/Makefile +++ b/Makefile @@ -253,9 +253,19 @@ TEST_TARGET = $@ TEST = ./sage -t --logfile=$(TEST_LOG) $(TEST_FLAGS) --optional=$(TEST_OPTIONAL) $(TEST_FILES) +test-git-no-uncommitted-changes: + @UNCOMMITTED=$$(git status --porcelain); \ + if [ -n "$$UNCOMMITTED" ]; then \ + echo "Error: the git repo has uncommitted changes:"; \ + echo "$$UNCOMMITTED"; \ + echo; \ + exit 1; \ + fi + test: all @echo '### make $(TEST_TARGET): Running $(TEST)' >> $(TEST_LOG) - $(TEST) + $(TEST); \ + $(MAKE) test-git-no-uncommitted-changes check: @$(MAKE) test @@ -302,7 +312,8 @@ ptestoptionallong: test-nodoc: TEST_OPTIONAL := $(TEST_OPTIONAL),!sagemath_doc_html,!sagemath_doc_pdf test-nodoc: build @echo '### make $(TEST_TARGET): Running $(TEST)' >> $(TEST_LOG) - $(TEST) + $(TEST); \ + $(MAKE) test-git-no-uncommitted-changes check-nodoc: @$(MAKE) test-nodoc @@ -387,5 +398,6 @@ list: misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \ test check testoptional testall testlong testoptionallong testallong \ ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \ + test-git-no-uncommitted-changes \ list \ doc-clean clean sagelib-clean build-clean