aboutsummaryrefslogtreecommitdiff
blob: e8d20b7bc24b2d15897c28acda61ec11f80473d1 (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
#!/bin/bash
#
# Expected test layout:
# test/
#  rpm/   put all rpms here
#  tmp/   scratch space for testing
#  lst/   known good listings
#

cd "${0%/*}" || exit 1

if [ ! -e test ] ; then
	echo "Sorry, no test data (test/)"
	exit 0
fi

# This can be verbose, so do it before `set -x`
PATH=$PWD:$PATH

set -ex

which rpmunpack
which rpm2tar

cd test

rm -rf tmp
mkdir tmp
cd tmp

fail=
for rpm in ../rpm/*.rpm ; do
	r=${rpm##*/}
	if ! rpmunpack ${rpm} ; then
		fail+=" ${r}"
		continue
	fi
	# do not track timestamps as some cpio archives
	# only contain info for the files, not the dirs
	tree -apsn -o ../${r}.lst
	mv ../${r}.lst ./
	diff -u ${r}.lst ../lst/
	rm -rf ./*
done

set +x
if [[ -n ${fail} ]] ; then
	echo "FAILED:" ${fail}
else
	echo "ALL PASSED"
fi