qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r593531 - /incubator/qpid/trunk/qpid/cpp/examples/verify_functions
Date Fri, 09 Nov 2007 14:12:10 GMT
Author: aconway
Date: Fri Nov  9 06:12:09 2007
New Revision: 593531

URL: http://svn.apache.org/viewvc?rev=593531&view=rev
Log:
Functions for scripts that verify examples.

Added:
    incubator/qpid/trunk/qpid/cpp/examples/verify_functions   (with props)

Added: incubator/qpid/trunk/qpid/cpp/examples/verify_functions
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/verify_functions?rev=593531&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/verify_functions (added)
+++ incubator/qpid/trunk/qpid/cpp/examples/verify_functions Fri Nov  9 06:12:09 2007
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+new_tag() {
+    for t in $TAGS; do
+	if test "$t" = "$1"; then
+	    echo "Duplicate tag $t" 1>&2 ; exit 1
+	fi
+    done
+    TAGS="$TAGS $tag"
+}
+
+# Usage: run tag program args ...
+# Runs 'program args ...' with output to tag.out and tag.err
+run() {
+    tag=$1; shift
+    test -n "$*" || { echo "No command for tag: $tag" 1>&2; exit 1; }
+    new_tag $tag
+    rm -f $tag.out $tag.err $tag.diff
+    "$@" > $tag.out 2> $tag.err || echo "exit status $?" >> $tag.err &
+}
+
+# Genereate error report
+errors() {
+    for tag in "$@"; do
+	DIFF=`diff $tag.out $tag.expect 2>&1` || {
+	    echo "==== $tag.out != $tag.expect ===="
+	    echo $DIFF
+	}
+	test -s $tag.err && {
+	    echo "==== $tag.err ===="
+	    cat $tag.err
+	}
+    done
+}
+
+# Wait for processes, verify output.
+# Verifies tag.expect == tag.out and ! tag.err for each tag,
+# creates errors.txt if there are any discrepancies.
+# 
+verify() {
+    wait
+    rm -f errors.txt
+    ERRORS=`errors $TAGS`
+    if test -n "$ERRORS"; then
+	echo "$ERRORS" 1>&2
+	return 1
+    fi
+    return 0
+}
+

Propchange: incubator/qpid/trunk/qpid/cpp/examples/verify_functions
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message