summaryrefslogtreecommitdiffstats
path: root/tests/trackingcorruption.test
blob: 6110e26c99f423ce1d86d424fd14c70151c7a231 (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
68
69
70
71
72
73
74
75
76
77
78
79
set -u
. "$TESTSDIR"/test.inc

dodo test ! -d db
mkdir -p conf
echo "export silent-never" > conf/options
cat > conf/distributions <<EOF
Codename: breakme
Components: something
Architectures: abacus coal source
Tracking: all
EOF

DISTRI=breakme PACKAGE=aa EPOCH="" VERSION=1 REVISION=-1 SECTION="base" genpackage.sh -sa

testrun - include breakme test.changes 3<<EOF
stdout
$(odb)
-v2*=Created directory "./pool"
-v2*=Created directory "./pool/something"
-v2*=Created directory "./pool/something/a"
-v2*=Created directory "./pool/something/a/aa"
$(ofa 'pool/something/a/aa/aa-addons_1-1_all.deb')
$(ofa 'pool/something/a/aa/aa_1-1_abacus.deb')
$(ofa 'pool/something/a/aa/aa_1-1.tar.gz')
$(ofa 'pool/something/a/aa/aa_1-1.dsc')
$(opa 'aa-addons' x 'breakme' 'something' 'abacus' 'deb')
$(opa 'aa-addons' x 'breakme' 'something' 'coal' 'deb')
$(opa 'aa' x 'breakme' 'something' 'abacus' 'deb')
$(opa 'aa' x 'breakme' 'something' 'source' 'dsc')
$(ota 'breakme' 'aa')
EOF
rm aa_* aa-addons* test.changes

dodo mv db/tracking.db .

testrun - removesrc  breakme aa 3<<EOF
stderr
*=Nothing about source package 'aa' found in the tracking data of 'breakme'!
*=This either means nothing from this source in this version is there,
*=or the tracking information might be out of date.
EOF

testrun - --keepunreferenced remove breakme aa aa-addons 3<<EOF
stderr
*=Could not find tracking data for aa_1-1 in breakme to remove old files from it.
stdout
$(opd 'aa' unset breakme something abacus deb)
$(opd 'aa-addons' unset breakme something abacus deb)
$(opd 'aa-addons' unset breakme something coal deb)
$(opd 'aa' unset breakme something source dsc)
EOF

dodo mv tracking.db db/

testrun - --keepunreferenced removesrc breakme aa 3<<EOF
stderr
*=Warning: tracking data might be inconsistent:
*=cannot find 'aa' in 'breakme|something|abacus', but 'pool/something/a/aa/aa_1-1_abacus.deb' should be there.
*=cannot find 'aa' in 'breakme|something|source', but 'pool/something/a/aa/aa_1-1.dsc' should be there.
*=There was an inconsistency in the tracking data of 'breakme':
*='pool/something/a/aa/aa-addons_1-1_all.deb' has refcount > 0, but was nowhere found.
*='pool/something/a/aa/aa_1-1_abacus.deb' has refcount > 0, but was nowhere found.
*='pool/something/a/aa/aa_1-1.dsc' has refcount > 0, but was nowhere found.
*='pool/something/a/aa/aa_1-1.tar.gz' has refcount > 0, but was nowhere found.
stdout
$(otd 'aa' '1-1' 'breakme')
-v1*=4 files lost their last reference.
-v1*=(dumpunreferenced lists such files, use deleteunreferenced to delete them.)
EOF

testrun - retrack breakme 3<<EOF
stderr
stdout
-v1*=Retracking breakme...
EOF

rm -r db conf pool
testsuccess