Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/tests/unpacker.sh | 105 +++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh
index ea9e64d0a4c7..ef17e724a851 100755
--- a/eclass/tests/unpacker.sh
+++ b/eclass/tests/unpacker.sh
@@ -223,6 +223,67 @@ test_reject_junk() {
rm -f "${archive}" || die
}
+test_online() {
+ local url=${1}
+ local b2sum=${2}
+ local unpacked=${3}
+ local unp_b2sum=${4}
+
+ local filename=${url##*/}
+ local archive=${DISTDIR}/${filename}
+
+ if [[ ! -f ${archive} ]]; then
+ if [[ ${UNPACKER_TESTS_ONLINE} != 1 ]]; then
+ ewarn "Skipping ${filename} test, distfile not found"
+ return
+ fi
+
+ if ! wget -O "${archive}" "${url}"; then
+ die "Fetching ${archive} failed"
+ fi
+ fi
+
+ local real_sum=$(b2sum "${archive}" | cut -d' ' -f1)
+ if [[ ${real_sum} != ${b2sum} ]]; then
+ eerror "Incorrect b2sum on ${filename}"
+ eerror " expected: ${b2sum}"
+ eerror " found: ${real_sum}"
+ di