瀏覽代碼

testing/tests/download: test git branch

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>
Ricardo Martincoski 7 年之前
父節點
當前提交
5692e6afa1
共有 16 個文件被更改,包括 63 次插入1 次删除
  1. 2 0
      support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.hash
  2. 11 0
      support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.mk
  3. 2 0
      support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.hash
  4. 11 0
      support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.mk
  5. 2 0
      support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.hash
  6. 11 0
      support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.mk
  7. 2 0
      support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.hash
  8. 11 0
      support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.mk
  9. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0
  10. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/31/7406308d9259e2231bd0d6ddad3de3832bce08
  11. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5
  12. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/68/c197d0879d485f4f6cee85544722b79e68e59f
  13. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232
  14. 二進制
      support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e
  15. 1 0
      support/testing/tests/download/git-remote/repo.git/refs/heads/mybranch
  16. 10 1
      support/testing/tests/download/test_git.py

+ 2 - 0
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.hash

@@ -0,0 +1,2 @@
+sha256  70b76187369e47db69dac02c5696e63b35199cd20490fa473d289dd377774613  git-partial-sha1-branch-head-68c197d0879d485f4f6c.tar.gz
+sha256  2c1126513651b0d346a4e6d1bb75ac1c9999217e18026302d27bea47b06c7fb2  file

+ 11 - 0
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-branch-head/git-partial-sha1-branch-head.mk

@@ -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))

+ 2 - 0
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.hash

@@ -0,0 +1,2 @@
+sha256  9db079b9e215799d59975db7b2b26671eff1932ee6cf1075296f2ace3e2cb746  git-partial-sha1-reachable-by-branch-317406308d9259e2231b.tar.gz
+sha256  fabbc65c442bacb5e69b7adfea6d14fbbfc1327134322efd12771dc84387d507  file

+ 11 - 0
support/testing/tests/download/br2-external/git-refs/package/git-partial-sha1-reachable-by-branch/git-partial-sha1-reachable-by-branch.mk

@@ -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))

+ 2 - 0
support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.hash

@@ -0,0 +1,2 @@
+sha256  a21a2507b6d94ad484e49e3a9ae698f672a57469aab8e1779da77df7c9d4d337  git-sha1-branch-head-68c197d0879d485f4f6cee85544722b79e68e59f.tar.gz
+sha256  2c1126513651b0d346a4e6d1bb75ac1c9999217e18026302d27bea47b06c7fb2  file

+ 11 - 0
support/testing/tests/download/br2-external/git-refs/package/git-sha1-branch-head/git-sha1-branch-head.mk

@@ -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))

+ 2 - 0
support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.hash

@@ -0,0 +1,2 @@
+sha256  8909e76d898e651af0bc23fae4103b87888bfe77448d71aaf1fbec3da97a3ce2  git-sha1-reachable-by-branch-317406308d9259e2231bd0d6ddad3de3832bce08.tar.gz
+sha256  fabbc65c442bacb5e69b7adfea6d14fbbfc1327134322efd12771dc84387d507  file

+ 11 - 0
support/testing/tests/download/br2-external/git-refs/package/git-sha1-reachable-by-branch/git-sha1-reachable-by-branch.mk

@@ -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))

二進制
support/testing/tests/download/git-remote/repo.git/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0


二進制
support/testing/tests/download/git-remote/repo.git/objects/31/7406308d9259e2231bd0d6ddad3de3832bce08


二進制
support/testing/tests/download/git-remote/repo.git/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5


二進制
support/testing/tests/download/git-remote/repo.git/objects/68/c197d0879d485f4f6cee85544722b79e68e59f


二進制
support/testing/tests/download/git-remote/repo.git/objects/b2/4b387624edc78d0292a127c43cad9ba97c6232


二進制
support/testing/tests/download/git-remote/repo.git/objects/e2/cfe068f7e5bf4de32ffe1241da53abce9fa89e


+ 1 - 0
support/testing/tests/download/git-remote/repo.git/refs/heads/mybranch

@@ -0,0 +1 @@
+68c197d0879d485f4f6cee85544722b79e68e59f

+ 10 - 1
support/testing/tests/download/test_git.py

@@ -1,4 +1,5 @@
 import os
 import os
+import shutil
 
 
 from gitremote import GitRemote
 from gitremote import GitRemote
 
 
@@ -36,7 +37,11 @@ class GitTestBase(infra.basetest.BRTest):
     def check_download(self, package):
     def check_download(self, package):
         # store downloaded tarball inside the output dir so the test infra
         # store downloaded tarball inside the output dir so the test infra
         # cleans it up at the end
         # 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)}
                "GITREMOTE_PORT_NUMBER": str(self.gitremote.port)}
         self.b.build(["{}-dirclean".format(package),
         self.b.build(["{}-dirclean".format(package),
                       "{}-legal-info".format(package)],
                       "{}-legal-info".format(package)],
@@ -61,3 +66,7 @@ class TestGitRefs(GitTestBase):
             self.check_download("git-wrong-content")
             self.check_download("git-wrong-content")
         with self.assertRaises(SystemError):
         with self.assertRaises(SystemError):
             self.check_download("git-wrong-sha1")
             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")