summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-01-04 20:26:27 -0800
committerRoland McGrath <roland@redhat.com>2009-01-04 20:26:27 -0800
commit4fdfbfb7a8b76f7fb06d16264c57f60671246423 (patch)
tree3a0767c8575450544e09d81327d4915944cc5989
parent2542b3131ea4d56f52b5bfeef15d9a63f03611e0 (diff)
downloaddebuginfo-test-scripts-4fdfbfb7a8b76f7fb06d16264c57f60671246423.tar.gz
debuginfo-test-scripts-4fdfbfb7a8b76f7fb06d16264c57f60671246423.tar.xz
debuginfo-test-scripts-4fdfbfb7a8b76f7fb06d16264c57f60671246423.zip
script for mass testing on isolated files
-rw-r--r--.gitignore2
-rwxr-xr-xsingle-file-test.sh61
2 files changed, 63 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index fb6a0b4..d5cb82f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,7 @@
*.x86_64
*.ppc
*.ppc64
+*.list
+
lost+found
*~
diff --git a/single-file-test.sh b/single-file-test.sh
new file mode 100755
index 0000000..26287cf
--- /dev/null
+++ b/single-file-test.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+PATH="$(dirname $0):$PATH"
+
+which=$1
+shift
+
+run_all()
+{
+ set -e
+ make -s -r -f - ${which}.list <<\EOF
+%.list: */summary
+ (echo 'all:\'; \
+ list-files.sh $* | sed 's,^.*$$,test@/&\\,'; \
+ echo \;) > $@.new
+ mv -f $@.new $@
+EOF
+
+ # The spawn of make run copies that do run_one(), below.
+ make -s -j$(getconf _NPROCESSORS_ONLN) -r -f ${which}.list -f - <<EOF
+test@/%:; $0 subr \$* $*
+EOF
+}
+
+run_one()
+{
+ file=$1
+ shift
+
+ dir=${file//\//:}
+ name=${file##*/}
+
+ mkdir -p work/$dir &&
+ bunzip2 < $file.bz2 > work/$dir/$name &&
+ echo "${*//{\}/$name}" > work/$dir/cmd && {
+
+ (cd work/$dir && . cmd) > work/$dir/log 2>&1
+ status=$?
+ echo $status > work/$dir/status
+
+ if [ $status -ne 0 ] || [ -s work/$dir/log ]; then
+ # Test failed, leave everything there.
+ echo "FAIL ($status) $file $dir"
+ return 0
+ fi
+ # Look for excess files. Consider it failed if there are any.
+ ls -A work/$dir | fgrep -q -v "$name
+cmd
+log
+status" && { echo "FAIL (files) $file $dir"; return 0; }
+
+ # Fully clean test, erase the evidence.
+ rm -rf work/$dir
+ }
+}
+
+if [ "$which" = subr ]; then
+ run_one "$@"
+else
+ run_all "$@"
+fi