diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-08-22 23:18:45 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-08-22 23:18:45 -0400 |
commit | a16c5c0917fd255b954677a9ffe36ffae6b85fd0 (patch) | |
tree | f1d18cafbec65e0da282e862ccfeaf0a21503d05 | |
parent | add support for xz compressed rpms (diff) | |
download | rpm2targz-a16c5c0917fd255b954677a9ffe36ffae6b85fd0.tar.gz rpm2targz-a16c5c0917fd255b954677a9ffe36ffae6b85fd0.tar.bz2 rpm2targz-a16c5c0917fd255b954677a9ffe36ffae6b85fd0.zip |
add a small test framework
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | test.sh | 51 |
3 files changed, 56 insertions, 0 deletions
@@ -9,3 +9,5 @@ core rpm2tar rpmoffset + +/test @@ -35,4 +35,7 @@ install: rpmoffset done $(dosym) rpm2targz $(DESTDIR)$(bindir)/rpmunpack +check test: + ./test.sh + .PHONY: all clean install @@ -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 |