]> git.saurik.com Git - apt.git/blame - test/integration/test-acquire-same-file-multiple-times
add --sha512 option + documentation for apt-ftparchive
[apt.git] / test / integration / test-acquire-same-file-multiple-times
CommitLineData
08ea7806
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64'
8
9TESTFILE="$TESTDIR/framework"
10cp $TESTFILE aptarchive/foo
11APTARCHIVE="$(readlink -f ./aptarchive)"
12
13filedown() {
14 msgtest 'Downloading the same URI twice over file' "$1"
15 testsuccess --nomsg apthelper download-file file:///$APTARCHIVE/foo ./downloaded/foo1 '' file:///$APTARCHIVE/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1
16 cp rootdir/tmp/testsuccess.output download.log
08ea7806
DK
17 testsuccess cmp $TESTFILE ./downloaded/foo1
18 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
7c8206bf 19 testequal '1' grep -c '200%20URI%20Start' ./download.log
08ea7806
DK
20 testequal '1' grep -c '201%20URI%20Done' ./download.log
21 rm -f ./downloaded/foo1 ./downloaded/foo2
22}
23
24testrun() {
25 $1 'no partial'
26 cp $TESTFILE ./downloaded/foo1
27 $1 'complete partial 1'
28 cp $TESTFILE ./downloaded/foo2
29 $1 'complete partial 2'
30 cp $TESTFILE ./downloaded/foo1
31 cp $TESTFILE ./downloaded/foo2
32 $1 'complete partial 1+2'
33 dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
34 $1 'partial partial 1'
35 dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
36 $1 'partial partial 2'
37 dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
38 dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
39 $1 'partial partial 1+2'
40}
41testrun 'filedown'
42
43changetowebserver -o aptwebserver::redirect::replace::/foo2=/foo
44
45httpdown() {
46 msgtest 'Downloading the same URI to different files' 'twice over http'
9d2a8a73 47 testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
08ea7806
DK
48 cp rootdir/tmp/testsuccess.output download.log
49 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
50 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
51 testequal '1' grep -c '200%20URI%20Start' ./download.log
52 testequal '1' grep -c '201%20URI%20Done' ./download.log
53 rm -f ./downloaded/foo1 ./downloaded/foo2
54}
55testrun 'httpdown'
56
57httpredirectdown() {
58 msgtest 'Redirect leads' 'first URI to the second URI'
9d2a8a73 59 testsuccess --nomsg apthelper download-file http://localhost:8080/foo2 ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
08ea7806
DK
60 cp rootdir/tmp/testsuccess.output download.log
61 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
62 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
63 testequal '1' grep -c '200%20URI%20Start' ./download.log
64 testequal '1' grep -c '103%20Redirect' ./download.log
65 testequal '1' grep -c '201%20URI%20Done' ./download.log
66 rm -f ./downloaded/foo1 ./downloaded/foo2
67}
68testrun 'httpredirectdown'
69
70httpsamedown() {
71 msgtest 'Downloading two files via the same URI to' 'the same file'
72 testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo1 '' -o Debug::pkgAcquire::Worker=1
73 cp rootdir/tmp/testsuccess.output download.log
74 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
75 testequal '1' grep -c '200%20URI%20Start' ./download.log
76 testequal '1' grep -c '201%20URI%20Done' ./download.log
77 rm -f ./downloaded/foo1
78}
79testrun 'httpsamedown'