Skip to content

Commit

Permalink
Trac #33967: sage -t: Print git commit hash and SAGE_LOCAL, SAGE_VENV
Browse files Browse the repository at this point in the history
`sage -t` already prints the current branch. We add some more
information so that the log files `*test*.log` become more useful.

URL: https://trac.sagemath.org/33967
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): John Palmieri
  • Loading branch information
Release Manager committed Jun 12, 2022
2 parents 0e48fec + f2468ab commit f793558
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/sage/doctest/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ def run(self):
return self.run_val_gdb()
else:
self.create_run_id()
from sage.env import SAGE_ROOT_GIT
from sage.env import SAGE_ROOT_GIT, SAGE_LOCAL, SAGE_VENV
# SAGE_ROOT_GIT can be None on distributions which typically
# only have the SAGE_LOCAL install tree but not SAGE_ROOT
if (SAGE_ROOT_GIT is not None) and os.path.isdir(SAGE_ROOT_GIT):
Expand All @@ -1343,6 +1343,18 @@ def run(self):
self.log("Git branch: " + branch, end="")
except subprocess.CalledProcessError:
pass
try:
ref = subprocess.check_output(["git",
"--git-dir=" + SAGE_ROOT_GIT,
"describe",
"--always",
"--dirty"])
ref = ref.decode('utf-8')
self.log("Git ref: " + ref, end="")
except subprocess.CalledProcessError:
pass

self.log(f"Running with {SAGE_LOCAL=} and {SAGE_VENV=}")

self.log("Using --optional=" + self._optional_tags_string())
available_software._allow_external = self.options.optional is True or 'external' in self.options.optional
Expand Down

0 comments on commit f793558

Please sign in to comment.