summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-ftparchive
blob: 378b059448091c1ce250fb0706c45f96867575ae (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
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment

buildsimplenativepackage 'baz' 'all' '1'
buildsimplenativepackage 'foo' 'all' '1'
buildsimplenativepackage 'bar' 'all' '2'
buildsimplenativepackage 'bar' 'all' '1'

EXPECT_PKG='Package: bar
Version: 1
Package: bar
Version: 2
Package: baz
Version: 1
Package: foo
Version: 1'
EXPECT_SRC="$EXPECT_PKG"

linkfiles() {
	ln -s "../incoming/${2}.dsc" "${1}/${2}.dsc"
	ln -s "../incoming/${2}.tar.xz" "${1}/${2}.tar.xz"
	ln -s "../incoming/${2}_all.deb" "${1}/${2}_all.deb"
}
genoptions() {
	echo 'baz_1'
	echo 'foo_1'
	echo 'bar_2'
	echo 'bar_1'
}
gencombos() {
	for a in $(genoptions); do
		for b in $(genoptions); do
			if [ "$a" = "$b" ]; then continue; fi
			for c in $(genoptions); do
				if [ "$a" = "$c" -o "$b" = "$c" ]; then continue; fi
				for d in $(genoptions); do
					if [ "$a" = "$d" -o "$b" = "$d" -o "$c" = "$d" ]; then continue; fi
					echo "${a};${b};${c};${d}"
				done
			done
		done
	done
}
for combo in $(gencombos); do
	msgmsg 'Running apt-ftparchive in configuration' "$combo"
	incomedir="incoming${combo}"
	mkdir "$incomedir"
	for i in $(echo "$combo" | tr ';' '\n'); do
		linkfiles "$incomedir" "$i"
	done

	testsuccess aptftparchive packages "$incomedir"
	cp rootdir/tmp/testsuccess.output aptarchive/Packages
	testsuccessequal "$EXPECT_PKG" grep -e '^Package: ' -e '^Version: ' aptarchive/Packages

	testsuccess aptftparchive -qq sources "$incomedir"
	cp rootdir/tmp/testsuccess.output aptarchive/Sources
	testsuccessequal "$EXPECT_SRC" grep -e '^Package: ' -e '^Version: ' aptarchive/Sources
done