From f284b5e7a1618f0f3f2eec0876a0da8d5848b0fa Mon Sep 17 00:00:00 2001 From: Ricardo Martincoski Date: Fri, 11 May 2018 23:58:27 -0300 Subject: testing/tests/download: add git hash test Add one test case to ensure the hash is checked for git packages: - correct hash; - wrong hash; - no hash file. Add required infra: - a GitRemote class, that can start a git server in the host machine to emulate a remote git server under the control of the test; - a new base class, called GitTestBase, that inherits from BRTest and must be subclassed by all git test cases. Its setUp() method takes care of configuring the build with a br2-external, avoiding to hit http://sources.buildroot.net by using an empty BR2_BACKUP_SITE. It also avoids downloading not pre-installed dependencies (i.e. lzip) every time by calling 'make dependencies' using the common dl directory, and it instantiates the GitRemote object. Besides the Python scripts, add some fixtures used during the tests: - a br2-external (git-hash) with one package for each part of the test case; - a static git bare repo (repo.git) to be served using GitRemote class. Neither the br2-external nor the check hash functionalities are the subject of these tests per se, so for simplicity limit the check to the error codes and don't look for the messages in the log. Thanks to Arnout for the hint about how to add a bare repo to test. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Tested-by: Matthew Weber [Arnout: split long line; reorder imports to satisfy flake8] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- .../tests/download/git-remote/repo.git/.gitattributes | 1 + support/testing/tests/download/git-remote/repo.git/HEAD | 1 + support/testing/tests/download/git-remote/repo.git/config | 4 ++++ .../objects/99/f2e3e1cb15f9b52fa29f66d380dda061d917ab | Bin 0 -> 49 bytes .../objects/a2/38b1dfcd825d47d834af3c5223417c8411d90d | 1 + .../objects/e7/9c5e8f964493290a409888d5413a737e8e5dd5 | Bin 0 -> 23 bytes .../tests/download/git-remote/repo.git/refs/heads/master | 1 + 7 files changed, 8 insertions(+) create mode 100644 support/testing/tests/download/git-remote/repo.git/.gitattributes create mode 100644 support/testing/tests/download/git-remote/repo.git/HEAD create mode 100644 support/testing/tests/download/git-remote/repo.git/config create mode 100644 support/testing/tests/download/git-remote/repo.git/objects/99/f2e3e1cb15f9b52fa29f66d380dda061d917ab create mode 100644 support/testing/tests/download/git-remote/repo.git/objects/a2/38b1dfcd825d47d834af3c5223417c8411d90d create mode 100644 support/testing/tests/download/git-remote/repo.git/objects/e7/9c5e8f964493290a409888d5413a737e8e5dd5 create mode 100644 support/testing/tests/download/git-remote/repo.git/refs/heads/master (limited to 'support/testing/tests/download/git-remote/repo.git') diff --git a/support/testing/tests/download/git-remote/repo.git/.gitattributes b/support/testing/tests/download/git-remote/repo.git/.gitattributes new file mode 100644 index 0000000000..eb50c64a21 --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/.gitattributes @@ -0,0 +1 @@ +objects/*/* binary diff --git a/support/testing/tests/download/git-remote/repo.git/HEAD b/support/testing/tests/download/git-remote/repo.git/HEAD new file mode 100644 index 0000000000..cb089cd89a --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/support/testing/tests/download/git-remote/repo.git/config b/support/testing/tests/download/git-remote/repo.git/config new file mode 100644 index 0000000000..07d359d07c --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/config @@ -0,0 +1,4 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true diff --git a/support/testing/tests/download/git-remote/repo.git/objects/99/f2e3e1cb15f9b52fa29f66d380dda061d917ab b/support/testing/tests/download/git-remote/repo.git/objects/99/f2e3e1cb15f9b52fa29f66d380dda061d917ab new file mode 100644 index 0000000000..9db72668cf Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/99/f2e3e1cb15f9b52fa29f66d380dda061d917ab differ diff --git a/support/testing/tests/download/git-remote/repo.git/objects/a2/38b1dfcd825d47d834af3c5223417c8411d90d b/support/testing/tests/download/git-remote/repo.git/objects/a2/38b1dfcd825d47d834af3c5223417c8411d90d new file mode 100644 index 0000000000..31b6bcf34d --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/objects/a2/38b1dfcd825d47d834af3c5223417c8411d90d @@ -0,0 +1 @@ +xM @aלb.bn_@6q޸/ϕӮ(BEc(MG?L{Fh ^*\a.XeW ~O_< i]I'ks6Ÿr25•9Yl`C \ No newline at end of file diff --git a/support/testing/tests/download/git-remote/repo.git/objects/e7/9c5e8f964493290a409888d5413a737e8e5dd5 b/support/testing/tests/download/git-remote/repo.git/objects/e7/9c5e8f964493290a409888d5413a737e8e5dd5 new file mode 100644 index 0000000000..df2037a2d2 Binary files /dev/null and b/support/testing/tests/download/git-remote/repo.git/objects/e7/9c5e8f964493290a409888d5413a737e8e5dd5 differ diff --git a/support/testing/tests/download/git-remote/repo.git/refs/heads/master b/support/testing/tests/download/git-remote/repo.git/refs/heads/master new file mode 100644 index 0000000000..b6bccc1c17 --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/refs/heads/master @@ -0,0 +1 @@ +a238b1dfcd825d47d834af3c5223417c8411d90d -- cgit v1.2.3