From a16c5c0917fd255b954677a9ffe36ffae6b85fd0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 22 Aug 2010 23:18:45 -0400 Subject: add a small test framework Signed-off-by: Mike Frysinger --- test.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 test.sh (limited to 'test.sh') diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..e8d20b7 --- /dev/null +++ b/test.sh @@ -0,0 +1,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 -- cgit v1.2.3-65-gdbad