summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/tests/fetch.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 18e585721c..622c46a05d 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -2856,3 +2856,42 @@ class FetchPremirroronlyLocalTest(FetcherTest):
2856 fetcher = bb.fetch.Fetch([self.recipe_url], self.d) 2856 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
2857 with self.assertRaises(bb.fetch2.NetworkAccess): 2857 with self.assertRaises(bb.fetch2.NetworkAccess):
2858 fetcher.download() 2858 fetcher.download()
2859
2860class FetchPremirroronlyNetworkTest(FetcherTest):
2861
2862 def setUp(self):
2863 super(FetchPremirroronlyNetworkTest, self).setUp()
2864 self.mirrordir = os.path.join(self.tempdir, "mirrors")
2865 os.mkdir(self.mirrordir)
2866 self.reponame = "fstests"
2867 self.clonedir = os.path.join(self.tempdir, "git")
2868 self.gitdir = os.path.join(self.tempdir, "git", "{}.git".format(self.reponame))
2869 self.recipe_url = "git://git.yoctoproject.org/fstests"
2870 self.d.setVar("BB_FETCH_PREMIRRORONLY", "1")
2871 self.d.setVar("BB_NO_NETWORK", "0")
2872 self.d.setVar("PREMIRRORS", self.recipe_url + " " + "file://{}".format(self.mirrordir) + " \n")
2873
2874 def make_git_repo(self):
2875 import shutil
2876 self.mirrorname = "git2_git.yoctoproject.org.fstests.tar.gz"
2877 os.makedirs(self.clonedir)
2878 self.git("clone --bare --shallow-since=\"01.01.2013\" {}".format(self.recipe_url), self.clonedir)
2879 bb.process.run('tar -czvf {} .'.format(os.path.join(self.mirrordir, self.mirrorname)), cwd = self.gitdir)
2880 shutil.rmtree(self.clonedir)
2881
2882 @skipIfNoNetwork()
2883 def test_mirror_tarball_updated(self):
2884 self.make_git_repo()
2885 ## Upstream commit is in the mirror
2886 self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec")
2887 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
2888 fetcher.download()
2889
2890 @skipIfNoNetwork()
2891 def test_mirror_tarball_outdated(self):
2892 self.make_git_repo()
2893 ## Upstream commit not in the mirror
2894 self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f")
2895 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
2896 with self.assertRaises(bb.fetch2.NetworkAccess):
2897 fetcher.download()