summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/fetch.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-11 18:16:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-13 20:09:53 +0100
commit09b231deb19799659cd181deebf3e5437048b619 (patch)
tree95cf73344b015ac0da3ece4a0f85ce3ff329da10 /bitbake/lib/bb/tests/fetch.py
parent36462d5927107b3e33976689f1969e045c396481 (diff)
downloadpoky-09b231deb19799659cd181deebf3e5437048b619.tar.gz
bitbake/tests: Add test of the git fetcher
(Bitbake rev: 4dd2655caef1003b51c0600397a91f1c9526a67f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r--bitbake/lib/bb/tests/fetch.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 234b251466..42af8839e0 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -19,6 +19,7 @@
19 19
20import unittest 20import unittest
21import tempfile 21import tempfile
22import subprocess
22import os 23import os
23import bb 24import bb
24 25
@@ -33,6 +34,8 @@ class FetcherTest(unittest.TestCase):
33 self.d.setVar("DL_DIR", self.dldir) 34 self.d.setVar("DL_DIR", self.dldir)
34 self.unpackdir = os.path.join(self.tempdir, "unpacked") 35 self.unpackdir = os.path.join(self.tempdir, "unpacked")
35 os.mkdir(self.unpackdir) 36 os.mkdir(self.unpackdir)
37 persistdir = os.path.join(self.tempdir, "persistdata")
38 self.d.setVar("PERSISTENT_DIR", persistdir)
36 39
37 def tearDown(self): 40 def tearDown(self):
38 bb.utils.prunedir(self.tempdir) 41 bb.utils.prunedir(self.tempdir)
@@ -61,6 +64,24 @@ class FetcherTest(unittest.TestCase):
61 fetcher.download() 64 fetcher.download()
62 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749) 65 self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
63 66
67 def test_gitfetch(self):
68 def checkrevision(self, fetcher):
69 fetcher.unpack(self.unpackdir)
70 revision = subprocess.check_output("git rev-parse HEAD", shell=True, cwd=self.unpackdir + "/git").strip()
71 self.assertEqual(revision, "270a05b0b4ba0959fe0624d2a4885d7b70426da5")
72
73 self.d.setVar("BB_GENERATE_MIRROR_TARBALLS", "1")
74 self.d.setVar("SRCREV", "270a05b0b4ba0959fe0624d2a4885d7b70426da5")
75 fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake"], self.d)
76 fetcher.download()
77 checkrevision(self, fetcher)
78 # Wipe out the dldir clone and the unpacked source, turn off the network and check mirror tarball works
79 bb.utils.prunedir(self.dldir + "/git2/")
80 bb.utils.prunedir(self.unpackdir)
81 self.d.setVar("BB_NO_NETWORK", "1")
82 fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake"], self.d)
83 fetcher.download()
84 checkrevision(self, fetcher)
64 85
65class URLHandle(unittest.TestCase): 86class URLHandle(unittest.TestCase):
66 87