diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2019-01-18 14:37:53 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2019-01-21 10:41:37 +0000 |
commit | 50165081f7b78f689446287e541869175c984365 (patch) | |
tree | f19a977c3108dbdc78a434ecd264a60a2e742981 /tests/testutils | |
parent | ce8dab0ff768e9b8d78e25d681d0efa097803131 (diff) | |
download | buildstream-50165081f7b78f689446287e541869175c984365.tar.gz |
tests/sources/git.py: Skip tests that assume too new a git
test_track_invalid_submodule depends on being able to remove a submodule
by `git rm $submoduledir`, but old versions of git don't update .gitmodules
so BuildStream still thinks there's a submodule present.
For expediency the test is skipped rather than changed to manually remove
the entry from .gitmodules if git hasn't done it,
since in the common case git is new enough to do that itself.
test_git_describe expects --first-parent to find another tag,
but `bst track` will gracefully degrade if the option doesn't work
so a different history will be retained with old versions of git.
It's of marginal benefit to add additional cruft
to test for different output on old versions of git that won't persist forever.
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/site.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/testutils/site.py b/tests/testutils/site.py index 6ef22babb..b7bfa11cf 100644 --- a/tests/testutils/site.py +++ b/tests/testutils/site.py @@ -2,6 +2,7 @@ # so we dont have to repeat this everywhere # import os +import subprocess import sys from buildstream import _site, utils, ProgramNotFoundError @@ -16,8 +17,12 @@ except ProgramNotFoundError: try: utils.get_host_tool('git') HAVE_GIT = True + out = str(subprocess.check_output(['git', '--version']), "utf-8") + version = tuple(int(x) for x in out.split(' ', 2)[2].split('.')) + HAVE_OLD_GIT = version < (1, 8, 5) except ProgramNotFoundError: HAVE_GIT = False + HAVE_OLD_GIT = False try: utils.get_host_tool('ostree') |