testing/tests/download: test git branch
authorRicardo Martincoski <ricardo.martincoski@gmail.com>
Sat, 12 May 2018 02:58:29 +0000 (23:58 -0300)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tue, 5 Feb 2019 09:23:03 +0000 (10:23 +0100)
Add a branch to the static repo and check on the git refs test case the
download of a git package:
 - with a sha1 reachable by a branch name, but not pointed by it, as
   version. This is the most common use case for git refs in the tree;
 - with a partial sha1 of a commit reachable by a branch as version;
 - with a sha1 of the commit head of a branch as version;
 - with a partial sha1 of the commit head of a branch as version;

Enforce the download always occurs by removing the BR2_DL_DIR used for
the tarballs generated by the git download infra.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Cc: Arnout Vandecappelle <arnout@mind.be>
Tested-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
16 files changed:
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.hash [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.mk [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.hash [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.mk [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.hash [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.mk [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.hash [new file with mode: 0644]
support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.mk [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0 [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/31/7406308d9259e2231bd0d6ddad3de3832bce08 [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5 [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/68/c197d0879d485f4f6cee85544722b79e68e59f [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232 [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e [new file with mode: 0644]
support/testing/tests/download/git-remote/repo.git/refs/heads/mybranch [new file with mode: 0644]
support/testing/tests/download/test_git.py

diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.hash b/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.hash
new file mode 100644 (file)
index 0000000..648bcce
--- /dev/null
@@ -0,0 +1,2 @@
+sha256  70b76187369e47db69dac02c5696e63b35199cd20490fa473d289dd377774613  git-partial-sha1-branch-head-68c197d0879d485f4f6c.tar.gz
+sha256  2c1126513651b0d346a4e6d1bb75ac1c9999217e18026302d27bea47b06c7fb2  file
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.mk b/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.mk
new file mode 100644 (file)
index 0000000..6d4177c
--- /dev/null
@@ -0,0 +1,11 @@
+################################################################################
+#
+# git-partial-sha1-branch-head
+#
+################################################################################
+
+GIT_PARTIAL_SHA1_BRANCH_HEAD_VERSION = 68c197d0879d485f4f6c
+GIT_PARTIAL_SHA1_BRANCH_HEAD_SITE = git://localhost:$(GITREMOTE_PORT_NUMBER)/repo.git
+GIT_PARTIAL_SHA1_BRANCH_HEAD_LICENSE_FILES = file
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.hash b/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.hash
new file mode 100644 (file)
index 0000000..d064362
--- /dev/null
@@ -0,0 +1,2 @@
+sha256  9db079b9e215799d59975db7b2b26671eff1932ee6cf1075296f2ace3e2cb746  git-partial-sha1-reachable-by-branch-317406308d9259e2231b.tar.gz
+sha256  fabbc65c442bacb5e69b7adfea6d14fbbfc1327134322efd12771dc84387d507  file
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.mk b/support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.mk
new file mode 100644 (file)
index 0000000..2f65b5c
--- /dev/null
@@ -0,0 +1,11 @@
+################################################################################
+#
+# git-partial-sha1-reachable-by-branch
+#
+################################################################################
+
+GIT_PARTIAL_SHA1_REACHABLE_BY_BRANCH_VERSION = 317406308d9259e2231b
+GIT_PARTIAL_SHA1_REACHABLE_BY_BRANCH_SITE = git://localhost:$(GITREMOTE_PORT_NUMBER)/repo.git
+GIT_PARTIAL_SHA1_REACHABLE_BY_BRANCH_LICENSE_FILES = file
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.hash b/support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.hash
new file mode 100644 (file)
index 0000000..3e8f76d
--- /dev/null
@@ -0,0 +1,2 @@
+sha256  a21a2507b6d94ad484e49e3a9ae698f672a57469aab8e1779da77df7c9d4d337  git-sha1-branch-head-68c197d0879d485f4f6cee85544722b79e68e59f.tar.gz
+sha256  2c1126513651b0d346a4e6d1bb75ac1c9999217e18026302d27bea47b06c7fb2  file
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.mk b/support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.mk
new file mode 100644 (file)
index 0000000..d3ecaa8
--- /dev/null
@@ -0,0 +1,11 @@
+################################################################################
+#
+# git-sha1-branch-head
+#
+################################################################################
+
+GIT_SHA1_BRANCH_HEAD_VERSION = 68c197d0879d485f4f6cee85544722b79e68e59f
+GIT_SHA1_BRANCH_HEAD_SITE = git://localhost:$(GITREMOTE_PORT_NUMBER)/repo.git
+GIT_SHA1_BRANCH_HEAD_LICENSE_FILES = file
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.hash b/support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.hash
new file mode 100644 (file)
index 0000000..f8d7b5d
--- /dev/null
@@ -0,0 +1,2 @@
+sha256  8909e76d898e651af0bc23fae4103b87888bfe77448d71aaf1fbec3da97a3ce2  git-sha1-reachable-by-branch-317406308d9259e2231bd0d6ddad3de3832bce08.tar.gz
+sha256  fabbc65c442bacb5e69b7adfea6d14fbbfc1327134322efd12771dc84387d507  file
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.mk b/support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.mk
new file mode 100644 (file)
index 0000000..badf9e1
--- /dev/null
@@ -0,0 +1,11 @@
+################################################################################
+#
+# git-sha1-reachable-by-branch
+#
+################################################################################
+
+GIT_SHA1_REACHABLE_BY_BRANCH_VERSION = 317406308d9259e2231bd0d6ddad3de3832bce08
+GIT_SHA1_REACHABLE_BY_BRANCH_SITE = git://localhost:$(GITREMOTE_PORT_NUMBER)/repo.git
+GIT_SHA1_REACHABLE_BY_BRANCH_LICENSE_FILES = file
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0 b/support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0
new file mode 100644 (file)
index 0000000..3541cd1
Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0 differ
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/31/7406308d9259e2231bd0d6ddad3de3832bce08 b/support/testing/tests/download/git-remote/repo.git/objects/31/7406308d9259e2231bd0d6ddad3de3832bce08
new file mode 100644 (file)
index 0000000..c2c9865
--- /dev/null
@@ -0,0 +1 @@
+x\ 1­Î;N\ 31\14@Qj¯Â\e\98Èß\8c\8dP\94\rÐ\90\15<¿Ob\ 5\8f\91ã\14ì\9eH)è\11í)®.öÖêÔÞí_æ`ÖìPØì\93¬\1c\8b\ 4bïDغ` ¢\87\82\9c\ 5Rfõ\ 5\83·©ÁùT,        Rr\91ÂJÉ\a\10\8fÑ9\1fì\8a)XKÙ\90\82û¼ô¡?* ®ßa̺a¿]«~\eOܵ_<\9e\eÔÏ\1dövÐ6\9a5ÇäcÖ\8bñƨ\87>¦'ÿSN\95\ 1\e^¬R§zÞ\98\96\94ï׿̪\1f\191nS
\ No newline at end of file
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5 b/support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5
new file mode 100644 (file)
index 0000000..29f2d4f
Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5 differ
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/68/c197d0879d485f4f6cee85544722b79e68e59f b/support/testing/tests/download/git-remote/repo.git/objects/68/c197d0879d485f4f6cee85544722b79e68e59f
new file mode 100644 (file)
index 0000000..3e421bb
--- /dev/null
@@ -0,0 +1 @@
+x\ 1­Î=N\ 31\10\86aj\9fÂ\17ØÈ;³ë\1f\84\10\17 !'\18ÏL\12+x\8d\8c)¸=+¥H\1fÑ>Ò÷éåVk\19\16Á?\8d®j3,\19cð°¨p\88â \ 1Í\10xA&I\99R`\ f\bæ\8bºnûp\ e\8bóè¢$X\93\ 2à\9cÅ\89\17!AQ\8c\b\99ÕEC?ãÒºý(L]\9a}§>ÊÆíûZìK¿á¡Þñí\©|\1e¸ÕW;¯.¤5¢G;9tÎìºG\ fý§;\93;m|\ 1c\8e弩Lít\9aòïó#±æ\ f$bl·
\ No newline at end of file
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232 b/support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232
new file mode 100644 (file)
index 0000000..20491e3
Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232 differ
diff --git a/support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e b/support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e
new file mode 100644 (file)
index 0000000..57be648
Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e differ
diff --git a/support/testing/tests/download/git-remote/repo.git/refs/heads/mybranch b/support/testing/tests/download/git-remote/repo.git/refs/heads/mybranch
new file mode 100644 (file)
index 0000000..45cec54
--- /dev/null
@@ -0,0 +1 @@
+68c197d0879d485f4f6cee85544722b79e68e59f
index 64b060ba303d38543c0877350a10f856305d355e..83fb6fe3cd564cda6c5516b4b905a418cfbd4557 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import shutil
 
 from gitremote import GitRemote
 
@@ -36,7 +37,11 @@ class GitTestBase(infra.basetest.BRTest):
     def check_download(self, package):
         # store downloaded tarball inside the output dir so the test infra
         # cleans it up at the end
-        env = {"BR2_DL_DIR": os.path.join(self.builddir, "dl"),
+        dl_dir = os.path.join(self.builddir, "dl")
+        # enforce we test the download
+        if os.path.exists(dl_dir):
+            shutil.rmtree(dl_dir)
+        env = {"BR2_DL_DIR": dl_dir,
                "GITREMOTE_PORT_NUMBER": str(self.gitremote.port)}
         self.b.build(["{}-dirclean".format(package),
                       "{}-legal-info".format(package)],
@@ -61,3 +66,7 @@ class TestGitRefs(GitTestBase):
             self.check_download("git-wrong-content")
         with self.assertRaises(SystemError):
             self.check_download("git-wrong-sha1")
+        self.check_download("git-partial-sha1-branch-head")
+        self.check_download("git-partial-sha1-reachable-by-branch")
+        self.check_download("git-sha1-branch-head")
+        self.check_download("git-sha1-reachable-by-branch")