summaryrefslogtreecommitdiffstats
path: root/tests/exporthooks.test
blob: 5d7c9c2fb4efe75f3f827575e0c0a9bc40bed5b2 (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

mkdir conf
cat > conf/distributions <<EOF
Codename: o
Architectures: a b
Components: e
DebIndices: .
EOF

testrun - -b . export o 3<<EOF
*=Error parsing ./conf/distributions, line 4, column 13: filename for index files expected!
-v0*=There have been errors!
returns 255
EOF

cat > conf/distributions <<EOF
Codename: o
Architectures: a b
Components: e
DebIndices: X .gz .bz2 strange.sh
EOF
cat > conf/strange.sh <<'EOF'
#!/bin/sh
echo hook "$@"
touch "$1/$3.something.new"
echo "$3.something.new" >&3
touch "$1/$3.something.hidden.new"
echo "$3.something.hidden.new." >&3
exit 0
EOF
chmod a+x conf/strange.sh

testrun - -b . export o 3<<EOF
stdout
$(odb)
-v1*=Exporting o...
-v2*=Created directory "./dists"
-v2*=Created directory "./dists/o"
-v2*=Created directory "./dists/o/e"
-v2*=Created directory "./dists/o/e/binary-a"
-v6*= exporting 'o|e|a'...
-v6*=  creating './dists/o/e/binary-a/X' (gzipped,bzip2ed,script: strange.sh)
*=hook ./dists/o e/binary-a/X.new e/binary-a/X new
-v2*=Created directory "./dists/o/e/binary-b"
*=hook ./dists/o e/binary-b/X.new e/binary-b/X new
-v6*= exporting 'o|e|b'...
-v6*=  creating './dists/o/e/binary-b/X' (gzipped,bzip2ed,script: strange.sh)
EOF

find dists -type f | sort > results
cat > results.expected <<EOF
dists/o/Release
dists/o/e/binary-a/X.bz2
dists/o/e/binary-a/X.gz
dists/o/e/binary-a/X.something
dists/o/e/binary-a/X.something.hidden
dists/o/e/binary-b/X.bz2
dists/o/e/binary-b/X.gz
dists/o/e/binary-b/X.something
dists/o/e/binary-b/X.something.hidden
EOF
dodiff results.expected results

grep  something dists/o/Release > results || true
cat > results.expected <<EOF
 $(md5releaseline o e/binary-a/X.something)
 $(md5releaseline o e/binary-b/X.something)
 $(sha1releaseline o e/binary-a/X.something)
 $(sha1releaseline o e/binary-b/X.something)
 $(sha2releaseline o e/binary-a/X.something)
 $(sha2releaseline o e/binary-b/X.something)
EOF
dodiff results.expected results

rm -r conf db dists
rm results results.expected
testsuccess