summaryrefslogtreecommitdiff
path: root/test/test.d/create-filelists.sh
blob: e3a30d12c180feafe03acb51afc5968989df8186 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash

curdir=$(readlink -e "$(dirname "$0")")
. "${curdir}/../lib/common.inc"

testCreateSimpleFileLists() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
	local pkgbase
	local arch

	for pkgbase in "${pkgs[@]}"; do
		for arch in "${arches[@]}"; do
			releasePackage extra "${pkgbase}" "${arch}"
		done
	done
	../db-update

	for pkgbase in "${pkgs[@]}"; do
		for arch in "${arches[@]}"; do
			if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgbase}"; then
				fail "usr/bin/${pkgbase} not found in ${arch}/extra${FILESEXT}"
			fi
		done
	done
}

testCreateAnyFileLists() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-any-a' 'pkg-any-b')
	local pkgbase
	local arch

	for pkgbase in "${pkgs[@]}"; do
		releasePackage extra "${pkgbase}" any
	done
	../db-update

	for pkgbase in "${pkgs[@]}"; do
		for arch in "${arches[@]}"; do
			if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/share/${pkgbase}/test"; then
				fail "usr/share/${pkgbase}/test not found in ${arch}/extra${FILESEXT}"
			fi
		done
	done
}

testCreateSplitFileLists() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-split-a' 'pkg-split-b')
	local pkg
	local pkgbase
	local pkgname
	local pkgnames
	local arch

	for pkgbase in "${pkgs[@]}"; do
		for arch in "${arches[@]}"; do
			releasePackage extra "${pkgbase}" "${arch}"
		done
	done
	../db-update

	for pkgbase in "${pkgs[@]}"; do
		pkgnames=($(source "${TMP}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo ${pkgname[@]}))
		for pkgname in "${pkgnames[@]}"; do
			for arch in "${arches[@]}"; do
				if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgname}"; then
					fail "usr/bin/${pkgname} not found in ${arch}/extra${FILESEXT}"
				fi
			done
		done
	done
}


testCleanupFileLists() {
	local arches=('i686' 'x86_64')
	local pkgs=('pkg-simple-a' 'pkg-simple-b')
	local pkgbase
	local arch

	for pkgbase in "${pkgs[@]}"; do
		for arch in "${arches[@]}"; do
			releasePackage extra "${pkgbase}" "${arch}"
		done
	done
	../db-update

	for arch in "${arches[@]}"; do
		../db-remove extra "${arch}" pkg-simple-a
	done

	for arch in "${arches[@]}"; do
		if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-b"; then
			fail "usr/bin/pkg-simple-b not found in ${arch}/extra${FILESEXT}"
		fi
		if bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-a"; then
			fail "usr/bin/pkg-simple-a still found in ${arch}/extra${FILESEXT}"
		fi
	done

}

. "${curdir}/../lib/shunit2"