summaryrefslogtreecommitdiff
path: root/test/methods
diff options
context:
space:
mode:
Diffstat (limited to 'test/methods')
-rwxr-xr-xtest/methods/debdelta/test-signature47
-rw-r--r--test/methods/debdelta/test.txt1
2 files changed, 48 insertions, 0 deletions
diff --git a/test/methods/debdelta/test-signature b/test/methods/debdelta/test-signature
new file mode 100755
index 000000000..f9fa678ff
--- /dev/null
+++ b/test/methods/debdelta/test-signature
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+deb=$1
+
+verify_deb() {
+ [ "$deb" = "" ] && return
+ md5sum_1=$(apt-cache show `dpkg -I "$deb" | sed -n "s/Package: //p"` | sed -n "s/MD5sum: //p")
+ md5sum_2=$(md5sum "$deb" | gawk '{print $1}')
+ for s1 in $md5sum_1; do
+ for s2 in $md5sum_2; do
+ #echo "$s1 $s2"
+ if [ $s1 = $s2 ]; then
+ echo "[OK] $deb"
+ exit 0
+ fi
+ done
+ done
+ echo "[NOT OK] $deb"
+ exit 1;
+}
+
+usage() {
+ echo "Usage: test-signature <deb-file> <debdelta-file>"
+}
+
+make_deb() {
+ if [ "$2" = "" ]; then
+ usage
+ exit 1
+ fi
+ result_deb=$(LD_LIBRARY_PATH=../../../bin ../../../bin/methods/debdelta $1 $2 | sed -n "s/Result-Deb: //p")
+ deb=$result_deb
+ verify_deb
+}
+
+testmethod() {
+ path="/var/cache/apt/archives/"
+ for d in $(dir $path); do
+ deb=$path$d
+ [ -d $deb ] && continue
+ runtest
+ done
+}
+
+#testmethod
+make_deb $1 $2
diff --git a/test/methods/debdelta/test.txt b/test/methods/debdelta/test.txt
new file mode 100644
index 000000000..dbcae64d1
--- /dev/null
+++ b/test/methods/debdelta/test.txt
@@ -0,0 +1 @@
+./test-signature /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_amd64.deb /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_4.6.0-7_amd64.debdelta