]> git.saurik.com Git - apt.git/blame - test/integration/test-acquire-same-file-multiple-times
ignore for _apt inaccessible TMPDIR in pkgAcqChangelog
[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
17 #cat download.log
18 testsuccess cmp $TESTFILE ./downloaded/foo1
19 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
20 #testequal '1' grep -c '200%20URI%20Start' ./download.log
21 testequal '1' grep -c '201%20URI%20Done' ./download.log
22 rm -f ./downloaded/foo1 ./downloaded/foo2
23}
24
25testrun() {
26 $1 'no partial'
27 cp $TESTFILE ./downloaded/foo1
28 $1 'complete partial 1'
29 cp $TESTFILE ./downloaded/foo2
30 $1 'complete partial 2'
31 cp $TESTFILE ./downloaded/foo1
32 cp $TESTFILE ./downloaded/foo2
33 $1 'complete partial 1+2'
34 dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
35 $1 'partial partial 1'
36 dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
37 $1 'partial partial 2'
38 dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
39 dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
40 $1 'partial partial 1+2'
41}
42testrun 'filedown'
43
44changetowebserver -o aptwebserver::redirect::replace::/foo2=/foo
45
46httpdown() {
47 msgtest 'Downloading the same URI to different files' 'twice over http'
9d2a8a73 48 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
49 cp rootdir/tmp/testsuccess.output download.log
50 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
51 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
52 testequal '1' grep -c '200%20URI%20Start' ./download.log
53 testequal '1' grep -c '201%20URI%20Done' ./download.log
54 rm -f ./downloaded/foo1 ./downloaded/foo2
55}
56testrun 'httpdown'
57
58httpredirectdown() {
59 msgtest 'Redirect leads' 'first URI to the second URI'
9d2a8a73 60 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
61 cp rootdir/tmp/testsuccess.output download.log
62 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
63 testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
64 testequal '1' grep -c '200%20URI%20Start' ./download.log
65 testequal '1' grep -c '103%20Redirect' ./download.log
66 testequal '1' grep -c '201%20URI%20Done' ./download.log
67 rm -f ./downloaded/foo1 ./downloaded/foo2
68}
69testrun 'httpredirectdown'
70
71httpsamedown() {
72 msgtest 'Downloading two files via the same URI to' 'the same file'
73 testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo1 '' -o Debug::pkgAcquire::Worker=1
74 cp rootdir/tmp/testsuccess.output download.log
75 testsuccess cmp $TESTDIR/framework ./downloaded/foo1
76 testequal '1' grep -c '200%20URI%20Start' ./download.log
77 testequal '1' grep -c '201%20URI%20Done' ./download.log
78 rm -f ./downloaded/foo1
79}
80testrun 'httpsamedown'