summaryrefslogtreecommitdiff
path: root/test/methods/debdelta/test-signature
diff options
context:
space:
mode:
Diffstat (limited to 'test/methods/debdelta/test-signature')
-rwxr-xr-xtest/methods/debdelta/test-signature47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/methods/debdelta/test-signature b/test/methods/debdelta/test-signature
new file mode 100755
index 000000000..952260322
--- /dev/null
+++ b/test/methods/debdelta/test-signature
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+deb=$1
+
+verify_deb() {
+ [ "$deb" = "" ] && return
+ md5sum_1=$(LD_LIBRARY_PATH=../../../bin ../../../bin/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/Filename: //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 \ No newline at end of file