Skip to content

Commit

Permalink
sagemathgh-39392: Test that the Sage git repo is clean.
Browse files Browse the repository at this point in the history
    
Test that the Sage git repo is clean

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Add a doctest which will check whether the Sage git repo is clean. The
test is based on the top answer at
https://unix.stackexchange.com/questions/155046/determine-if-git-
working-directory-is-clean-from-a-script.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39392
Reported by: John H. Palmieri
Reviewer(s):
  • Loading branch information
Release Manager committed Feb 3, 2025
2 parents 8320fa9 + d8dc279 commit d3265d8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit d3265d8

Please sign in to comment.