diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index e8c416afd0..d7c73dda02 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -588,6 +588,36 @@ class FetcherNetworkTest(FetcherTest): | |||
588 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5;tag=270a05b0b4ba0959fe0624d2a4885d7b70426da5" | 588 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5;tag=270a05b0b4ba0959fe0624d2a4885d7b70426da5" |
589 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) | 589 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) |
590 | 590 | ||
591 | def test_gitfetch_localusehead(self): | ||
592 | # Create dummy local Git repo | ||
593 | src_dir = tempfile.mkdtemp(dir=self.tempdir, | ||
594 | prefix='gitfetch_localusehead_') | ||
595 | src_dir = os.path.abspath(src_dir) | ||
596 | bb.process.run("git init", cwd=src_dir) | ||
597 | bb.process.run("git commit --allow-empty -m'Dummy commit'", | ||
598 | cwd=src_dir) | ||
599 | # Use other branch than master | ||
600 | bb.process.run("git checkout -b my-devel", cwd=src_dir) | ||
601 | bb.process.run("git commit --allow-empty -m'Dummy commit 2'", | ||
602 | cwd=src_dir) | ||
603 | stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir) | ||
604 | orig_rev = stdout[0].strip() | ||
605 | |||
606 | # Fetch and check revision | ||
607 | self.d.setVar("SRCREV", "AUTOINC") | ||
608 | url = "git://" + src_dir + ";protocol=file;usehead=1" | ||
609 | fetcher = bb.fetch.Fetch([url], self.d) | ||
610 | fetcher.download() | ||
611 | fetcher.unpack(self.unpackdir) | ||
612 | stdout = bb.process.run("git rev-parse HEAD", | ||
613 | cwd=os.path.join(self.unpackdir, 'git')) | ||
614 | unpack_rev = stdout[0].strip() | ||
615 | self.assertEqual(orig_rev, unpack_rev) | ||
616 | |||
617 | def test_gitfetch_remoteusehead(self): | ||
618 | url = "git://git.openembedded.org/bitbake;usehead=1" | ||
619 | self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url) | ||
620 | |||
591 | def test_gitfetch_premirror(self): | 621 | def test_gitfetch_premirror(self): |
592 | url1 = "git://git.openembedded.org/bitbake" | 622 | url1 = "git://git.openembedded.org/bitbake" |
593 | url2 = "git://someserver.org/bitbake" | 623 | url2 = "git://someserver.org/bitbake" |