mirror of
https://git.yoctoproject.org/poky
synced 2026-04-23 00:32:12 +02:00
bitbake: bitbake: tests/fetch: Set git config if not already set
git config returns an error code if user.email or user.name are not set, so bb.process.run raises an ExecutionError, failing the test. Improve the logic by catching the ExectionError and using this to set a default value. Change a direct invocation of 'git init' to use self.git_init so that it follows the code path above. Remove the related comment from the README now that git sets up the user details automatically. (Bitbake rev: 0c7079d0609a13713b890a9675abd9fba032f199) Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
baf345598d
commit
8b0fc4850d
@@ -45,8 +45,7 @@ it has so many corner cases. The datastore has many tests too. Testing with the
|
||||
recommended before submitting patches, particularly to the fetcher and datastore. We also
|
||||
appreciate new test cases and may require them for more obscure issues.
|
||||
|
||||
To run the tests "zstd" and "git" must be installed. Git must be correctly configured, in
|
||||
particular the user.email and user.name values must be set.
|
||||
To run the tests "zstd" and "git" must be installed.
|
||||
|
||||
The assumption is made that this testsuite is run from an initialized OpenEmbedded build
|
||||
environment (i.e. `source oe-init-build-env` is used). If this is not the case, run the
|
||||
|
||||
@@ -429,9 +429,15 @@ class FetcherTest(unittest.TestCase):
|
||||
# a common setup is to use other default
|
||||
# branch than master.
|
||||
self.git(['checkout', '-b', 'master'], cwd=cwd)
|
||||
if not self.git(['config', 'user.email'], cwd=cwd):
|
||||
|
||||
try:
|
||||
self.git(['config', 'user.email'], cwd=cwd)
|
||||
except bb.process.ExecutionError:
|
||||
self.git(['config', 'user.email', 'you@example.com'], cwd=cwd)
|
||||
if not self.git(['config', 'user.name'], cwd=cwd):
|
||||
|
||||
try:
|
||||
self.git(['config', 'user.name'], cwd=cwd)
|
||||
except bb.process.ExecutionError:
|
||||
self.git(['config', 'user.name', 'Your Name'], cwd=cwd)
|
||||
|
||||
class MirrorUriTest(FetcherTest):
|
||||
@@ -3038,7 +3044,7 @@ class FetchPremirroronlyLocalTest(FetcherTest):
|
||||
self.mirrorname = "git2_git.fake.repo.bitbake.tar.gz"
|
||||
recipeurl = "git:/git.fake.repo/bitbake"
|
||||
os.makedirs(self.gitdir)
|
||||
self.git("init", self.gitdir)
|
||||
self.git_init(cwd=self.gitdir)
|
||||
for i in range(0):
|
||||
self.git_new_commit()
|
||||
bb.process.run('tar -czvf {} .'.format(os.path.join(self.mirrordir, self.mirrorname)), cwd = self.gitdir)
|
||||
|
||||
Reference in New Issue
Block a user