summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-604401-files-are-directories
blob: 4261d544ddef0e854f550d8d7176facb93db1a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture "i386"
setupaptarchive

test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/apt/apt.conf.d/000move-away-apt.conf

msgtest "Directory instead of a file as apt.conf ignored"
mkdir -p rootdir/etc/apt/apt.conf
testsuccess --nomsg aptconfig dump
rmdir rootdir/etc/apt/apt.conf

msgtest "Good link instead of a file as apt.conf ignored"
echo 'Test::APT::Link "good";' > rootdir/etc/apt/good-link.conf
ln -s rootdir/etc/apt/good-link.conf rootdir/etc/apt/apt.conf
testempty aptconfig shell TestLink 'Test::APT::Link'
rm rootdir/etc/apt/apt.conf

msgtest "Broken link instead of a file as apt.conf ignored"
ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf
testsuccess --nomsg aptconfig dump
rm rootdir/etc/apt/apt.conf


test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdir/etc/apt/sources.list.d/000move-away-sources.list

msgtest "Directory instead of a file as sources.list ignored"
mkdir -p rootdir/etc/apt/sources.list
testsuccess --nomsg aptget update --print-uris
rmdir rootdir/etc/apt/sources.list

msgtest "Good link instead of a file as sources.list ignored"
echo 'deb file:///tmp/debian sid main' > rootdir/etc/apt/good-link.list
ln -s rootdir/etc/apt/good-link.list rootdir/etc/apt/sources.list
testempty aptget update --print-uris
rm rootdir/etc/apt/sources.list

msgtest "Broken link instead of a file as sources.list ignored"
ln -s /tmp/doesnt-exist rootdir/etc/apt/sources.list
testempty aptget update --print-uris
rm rootdir/etc/apt/sources.list


test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/etc/apt/preferences.d/000move-away-preferences

msgtest "Directory instead of a file as preferences ignored"
mkdir -p rootdir/etc/apt/preferences
testsuccess --nomsg aptcache policy
rmdir rootdir/etc/apt/preferences

msgtest "Good link instead of a file as preferences ignored"
echo 'Package: apt
Pin: release a=now
Pin-Value: 1000' > rootdir/etc/apt/good-link.pref
ln -s rootdir/etc/apt/good-link.pref rootdir/etc/apt/preferences
testsuccess aptcache policy
testfailure grep '1000 ' rootdir/tmp/testsucess.output
rm rootdir/etc/apt/preferences

msgtest "Broken link instead of a file as preferences ignored"
ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences
testsuccess --nomsg aptcache policy
rm rootdir/etc/apt/preferences