summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/methods/debdelta/test-signature47
-rw-r--r--test/methods/debdelta/test.txt3
2 files changed, 50 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
diff --git a/test/methods/debdelta/test.txt b/test/methods/debdelta/test.txt
new file mode 100644
index 000000000..8b5f8f189
--- /dev/null
+++ b/test/methods/debdelta/test.txt
@@ -0,0 +1,3 @@
+./test-signature /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_4.6.0-7_amd64.debdelta /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_amd64.deb
+
+sudo LD_LIBRARY_PATH=.. ./debdelta /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_4.6.0-7_amd64.debdelta /home/ishan/devel/apt/testrepo/testitems/cpp-4.6_4.6.0-2_amd64.deb