]> git.saurik.com Git - apt.git/commitdiff
add failing regression test for bug #346386
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 10 Jul 2012 10:01:46 +0000 (12:01 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 10 Jul 2012 10:01:46 +0000 (12:01 +0200)
test/integration/framework
test/integration/test-ubuntu-bug346386 [new file with mode: 0755]
test/interactive-helper/aptwebserver.cc

index a514bef20e0f1b9cf26796a414af006e695605df..bf46ae0c56eb397d0c68bc0195bf735c7a0b94dd 100644 (file)
@@ -687,10 +687,17 @@ signreleasefiles() {
        msgdone "info"
 }
 
+simulatebrokenwebserver() {
+       if ! test -x ${BUILDDIRECTORY}/aptwebserver; then
+                 msgdie 'Need the aptwebserver to simulate broken connections'
+        fi
+        changetowebserver '--simulate-paywall'
+}
+
 changetowebserver() {
        if test -x ${BUILDDIRECTORY}/aptwebserver; then
                cd aptarchive
-               LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver 2> /dev/null > /dev/null &
+               LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null &
                addtrap "kill $!;"
                cd - > /dev/null
        elif which weborf > /dev/null; then
diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386
new file mode 100755 (executable)
index 0000000..57004f3
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
+
+setupaptarchive
+simulatebrokenwebserver
+
+rm -rf rootdir/var/lib/apt/lists
+aptget update 
+testequal 'partial' "$(ls rootdir/var/lib/apt/lists/)"
+
+
index 3c476ad056905da92f127dbf5b4e76ca4978d059..c7b815925914eb22a503bcb245a2b30210b6e329 100644 (file)
@@ -244,11 +244,11 @@ int main(int argc, const char *argv[])
         }
         _error->DumpErrors(std::cerr);
         messages.clear();
-      }
 
-      std::clog << "CLOSE client " << client 
-                << " on socket " << sock << std::endl;
-      close(client);
+         std::clog << "CLOSE client " << client 
+                   << " on socket " << sock << std::endl;
+         close(client);
+      }
    }
    return 0;
 }