diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-11 18:16:01 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-13 20:00:39 +0100 |
commit | 4dd2655caef1003b51c0600397a91f1c9526a67f (patch) | |
tree | 97e5d4cce14d9b172cb8b5dfb130aec97b469dab | |
parent | 1a0cdc65812f1f12bf4bbea6540a3aaf0f81b4f7 (diff) | |
download | bitbake-4dd2655caef1003b51c0600397a91f1c9526a67f.tar.gz |
bitbake/tests: Add test of the git fetcher
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/tests/fetch.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index 234b25146..42af8839e 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -19,6 +19,7 @@ import unittest import tempfile +import subprocess import os import bb @@ -33,6 +34,8 @@ class FetcherTest(unittest.TestCase): self.d.setVar("DL_DIR", self.dldir) self.unpackdir = os.path.join(self.tempdir, "unpacked") os.mkdir(self.unpackdir) + persistdir = os.path.join(self.tempdir, "persistdata") + self.d.setVar("PERSISTENT_DIR", persistdir) def tearDown(self): bb.utils.prunedir(self.tempdir) @@ -61,6 +64,24 @@ class FetcherTest(unittest.TestCase): fetcher.download() self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) + def test_gitfetch(self): + def checkrevision(self, fetcher): + fetcher.unpack(self.unpackdir) + revision = subprocess.check_output("git rev-parse HEAD", shell=True, cwd=self.unpackdir + "/git").strip() + self.assertEqual(revision, "270a05b0b4ba0959fe0624d2a4885d7b70426da5") + + self.d.setVar("BB_GENERATE_MIRROR_TARBALLS", "1") + self.d.setVar("SRCREV", "270a05b0b4ba0959fe0624d2a4885d7b70426da5") + fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake"], self.d) + fetcher.download() + checkrevision(self, fetcher) + # Wipe out the dldir clone and the unpacked source, turn off the network and check mirror tarball works + bb.utils.prunedir(self.dldir + "/git2/") + bb.utils.prunedir(self.unpackdir) + self.d.setVar("BB_NO_NETWORK", "1") + fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake"], self.d) + fetcher.download() + checkrevision(self, fetcher) class URLHandle(unittest.TestCase): |