Commit 932bd558 authored by Hilko Bengen's avatar Hilko Bengen

Imported Upstream version 0.53

parents
.
..
.CFUserTextEncoding
.DS_Store
.Spotlight-V100
.TemporaryItems
.Trash
.Trashes
.Xauthority
.Xmodmap
.Xmodmap.darwin
.Xresources
.abook
.abookrc
.anyconnect
.backup
.backup-to-icsi
.backup-to-icsi.exclude
.backup.exclude
.bash
.bash_history
.bash_profile
.bashrc
.bashrc.local
.cups
.dropbox
.elinks
.fontconfig
.fseventsd
.gem
.gnupg
.growl-buffy
.hostnames
.inputrc
.ispell_american
.jed
.jedrc
.jedrecent
.lesshst
.mairix
.mairix.history
.mairixrc
.mutt
.muttprintrc
.muttrc
.offlineimap
.offlineimap.py
.offlineimap.pyc
.offlineimaprc
.offlineimaprc.bagend
.python
.rxvt-unicode-254.59.242.10.in-addr.arpa
.rxvt-unicode-bagend.local
.rxvt-unicode-wifi189.icsi.berkeley.edu
.screen
.serverauth.11038
.serverauth.1452
.serverauth.203
.serverauth.206
.serverauth.220
.serverauth.23460
.serverauth.23866
.serverauth.270
.serverauth.305
.serverauth.378
.serverauth.53652
.serverauth.55639
.signature
.sleepwatcher
.ssh
.subversion
.unison
.unison.home.prf
.urlview
.viminfo
.whitelist
.xdvirc
.xinitrc.d
.xinitrc.darwin.leopard
.xinitrc.darwin.tiger
.yanag
Desktop
Documents
Downloads
Dropbox
Library
Mail
Movies
Music
Pictures
Public
Sites
bin
bro
data
down
etc
generic
include
jed
lib
man
mbox
memos
scripts
share
src
synchronized
tex
tmp
work
www
Part 1 - /Users/robin/bro/docs/aux/btest/.tmp/examples.t7/t7.sh#1
Part 2 - /Users/robin/bro/docs/aux/btest/.tmp/examples.t7/t7.sh#2
This diff is collapsed.
Copyright (c) 1995-2013, The Regents of the University of California
through the Lawrence Berkeley National Laboratory and the
International Computer Science Institute. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley
National Laboratory, U.S. Dept. of Energy, International Computer
Science Institute, nor the names of contributors may be used to endorse
or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Note that some files in the distribution may carry their own copyright
notices.
include CHANGES
include COPYING
include MANIFEST
include MANIFEST.in
include Makefile
include README
include VERSION
include btest.cfg.example
include setup.py
graft Baseline
graft examples
graft testing
all:
.PHONY: dist
dist:
rm -rf build/*.tar.gz
python setup.py sdist -d build
@printf "Package: "; echo build/*.tar.gz
test:
@(cd testing && make)
Metadata-Version: 1.0
Name: btest
Version: 0.53
Summary: A simple unit testing framework
Home-page: http://www.icir.org/robin/btest
Author: Robin Sommer
Author-email: robin@icir.org
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
This diff is collapsed.
This diff is collapsed.
#! /usr/bin/env bash
#
# Helper script that asks whether the user wants to update a baseline.
#
# Return code:
#
# 0: Yes, update and continue.
# 1: No, don't update but continue.
# 200: No, don't update and abort.
while true; do
echo " failed" >>/dev/tty
echo ">> Type 'c' to continue, 'd' to see diagnostics, 'u' to update baseline, and 'a' to abort." >/dev/tty
read -s -n 1 key </dev/tty
case $key in
[uU]) echo ">> Updating baseline ..." >/dev/tty; exit 0;;
[cC]) echo ">> Continuing ..." >/dev/tty; exit 1;;
[aA]) echo ">> Aborting ..." >/dev/tty; exit 200;;
[dD])
if [ "$TEST_DIAGNOSTICS" != "" -a "$TEST_DIAGNOSTICS" != "/dev/stdout" ]; then
less -S $TEST_DIAGNOSTICS </dev/tty >/dev/tty
else
echo "Do not have diagnostics." >/dev/tty
fi
;;
*) echo ">> Answer not recognized, try again ..." >/dev/tty ;;
esac
done
#! /usr/bin/env bash
#
# Usage: btest-bg-run <tag> <cmdline>
#
# Creates a new empty working directory <tag> within the current directory
# and spawns <cmdline> in there in the background. It also records
# a set of meta information that btest-bg-wait will read.
if [ "$#" -le 1 ]; then
echo "usage: `basename $0` <tag> <cmdline>"
exit 1
fi
cwd=`pwd`
cd `dirname $0`
helper=`pwd`/btest-bg-run-helper
setsid=`pwd`/btest-setsid
cd $cwd
bname=`basename $0`
dir=$1
shift
if [ -e $dir ]; then
echo "directory '$dir' already exists" >&2
exit 1;
fi
echo $dir >>.bgprocs
mkdir $dir
cd $dir
echo $@ >.cmdline
$setsid $helper "$@" >.stdout 2>.stderr &
sleep 1
#! /usr/bin/env bash
#
# Internal helper for btest-bg-run.
cleanup ()
{
if [ ! -e .exitcode ]; then
echo 15 >.exitcode
kill 0 &>/dev/null
if [ ! -z "$pid" ]; then
kill -0 $pid &>/dev/null && kill $pid
sleep 1
kill -0 $pid &>/dev/null && kill -9 $pid && echo 9 >.exitcode
fi
fi
}
trap "cleanup" EXIT
eval "$@ &"
pid=$!
echo $$ >.pid
wait $pid
echo $? >.exitcode
pid=""
#! /usr/bin/env bash
#
# Usage: btest-bg-wait [-k] <timeout>
#
# Waits until all of the background process spawned by btest-bg-run
# have finished, or the given timeout (in seconds) has been exceeded.
#
# If the timeout triggers, all remaining processed are killed. If -k
# is not given, this is considered an error and the script abort with
# error code 1. If -k is given, a timeout is not considered an error.
#
# Once all processes have finished (or were killed), the scripts
# merges their stdout and stderr. If one of them returned an error,
# this script does so as well
if [ "$1" == "-k" ]; then
timeout_ok=1
shift
else
timeout_ok=0
fi
if [ $# != 1 ]; then
echo "usage: `basename $0` [-k] <timeout>"
exit 1
fi
timeout=$1
procs=`cat .bgprocs`
rm -f .timeout
touch .timeout
function check_procs
{
for p in $procs; do
if [ ! -e $p/.exitcode ]; then
return 1;
fi
done
# All done.
return 0;
}
function kill_procs
{
for p in $procs; do
if [ ! -e $p/.exitcode ]; then
kill -1 `cat $p/.pid` 2>/dev/null
cat $p/.cmdline >>.timeout
if [ "$1" == "timeout" ]; then
touch $p/.timeout
fi
fi
done
sleep 1
for p in $procs; do
if [ ! -e $p/.exitcode ]; then
kill -9 `cat $p/.pid` 2>/dev/null
sleep 1
fi
done
}
function collect_output
{
rm -f .stdout .stderr
if [ $timeout_ok != 1 -a -s .timeout ]; then
echo "The following processes did not terminate:" >>.stderr
echo >>.stderr
cat .timeout >>.stderr
echo >>.stderr
echo "-----------" >>.stderr
fi
for p in $procs; do
pid=`cat $p/.pid`
cmdline=`cat $p/.cmdline`
printf "<<< [%s] %s\\n" "$pid" "$cmdline" >> .stdout
cat $p/.stdout >>.stdout
echo ">>>" >>.stdout
printf "<<< [%s] %s\\n" "$pid" "$cmdline" >> .stderr
cat $p/.stderr >>.stderr
echo ">>>" >>.stderr
done
}
trap kill_procs EXIT
while true; do
if check_procs; then
# All done.
break
fi
timeout=`expr $timeout - 1`
if [ $timeout -le 0 ]; then
# Timeout exceeded.
kill_procs timeout
if [ $timeout_ok == 1 ]; then
# Just continue.
break;
fi
# Exit with error.
collect_output
exit 1
fi
sleep 1
done
trap - EXIT
# All terminated either by themselves, or with a benign timeout.
collect_output
# See if any returned an error.
result=0
for p in $procs; do
if [ -e $p/.timeout ]; then
# we're here because timeouts are ok, so don't mind the exit code
# if we initiated killing the process due to timeout
continue
fi
rc=`cat $p/.exitcode`
pid=`cat $p/.pid`
cmdline=`cat $p/.cmdline`
if [ $rc != 0 ]; then
echo ">>> process $pid failed with exitcode $rc: $cmdline" >> .stderr
result=1
fi
done
exit $result
#! /usr/bin/env bash
#
# TEST_MODE={TEST|UPDATE|UPDATE_INTERACTIVE}
# TEST_BASELINE
# TEST_DIAGNOSTICS
# TEST_NAME
#
# TEST_DIFF_CANONIFIER
# TEST_DIFF_BRIEF
# Maximum number of lines to show from mismatching input file.
MAX_LINES=5000
if [ "$TEST_DIAGNOSTICS" = "" ]; then
TEST_DIAGNOSTICS=/dev/stdout
fi
if [ "$#" -lt 1 ]; then
echo "btest-diff: wrong number of arguments" >$TEST_DIAGNOSTICS
exit 1
fi
input=$1
canon=`echo $input | sed 's#/#.#g'`
shift
if [ ! -f $input ]; then
echo "btest-diff: input $input does not exist." >$TEST_DIAGNOSTICS
exit 1
fi
tmpfiles=""
function delete_tmps {
rm -f $tmpfiles 2>/dev/null
}
trap delete_tmps 0
result=2
rm -f $TEST_DIAGNOSTICS 2>/dev/null
echo "== File ===============================" >>$TEST_DIAGNOSTICS
if [ "$TEST_DIFF_BRIEF" == "" -o ! -e $TEST_BASELINE/$canon ]; then
if [ `wc -l $input | awk '{print $1}'` -le $MAX_LINES ]; then
cat $input >>$TEST_DIAGNOSTICS
else
head -$MAX_LINES $input >>$TEST_DIAGNOSTICS
echo "[... File too long, truncated ...]" >>$TEST_DIAGNOSTICS
fi
else
echo "<Content not shown>" >>$TEST_DIAGNOSTICS
fi
if [ -e $TEST_BASELINE/$canon ]; then
if [ "$TEST_DIFF_CANONIFIER" != "" ]; then
diff1=/tmp/test-diff.$$.$canon.baseline.tmp
diff2=/tmp/test-diff.$$.$canon.tmp
tmpfiles="$tmpfiles $diff1 $diff2"
eval $TEST_DIFF_CANONIFIER $input <$TEST_BASELINE/$canon >$diff1
eval $TEST_DIFF_CANONIFIER $input <$input >$diff2
else
diff1=$TEST_BASELINE/$canon
diff2=$input
fi
echo "== Diff ===============================" >>$TEST_DIAGNOSTICS
diff -au $@ $diff1 $diff2 >>$TEST_DIAGNOSTICS
result=$?
else
echo "== Error ===============================" >>$TEST_DIAGNOSTICS
echo "test-diff: no baseline found." >>$TEST_DIAGNOSTICS
result=100
fi
echo "=======================================" >>$TEST_DIAGNOSTICS
if [ "$TEST_MODE" == "TEST" ]; then
exit $result
elif [ "$TEST_MODE" == "UPDATE_INTERACTIVE" ]; then
if [ "$result" == 0 ]; then
exit 0
fi
btest-ask-update
rc=$?
echo -n "$TEST_NAME ..." >/dev/tty
if [ $rc == 0 ]; then
cp $input $TEST_BASELINE/$canon
exit 0
fi
exit $rc
elif [ "$TEST_MODE" == "UPDATE" ]; then
cp $input $TEST_BASELINE/$canon
exit 0
fi
echo "test-diff: unknown test mode $TEST_MODE" >$TEST_DIAGNOSTICS
exit 1
#! /usr/bin/env python
import os
import sys
try:
os.setsid()
except:
pass
prog = sys.argv[1]
try:
args = sys.argv[1:]
except:
args = []
os.execvp(prog, args)
[btest]
TestDirs = examples
TmpDir = %(testbase)s/.tmp
BaselineDir = %(testbase)s/Baseline
IgnoreDirs = .svn CVS .tmp
IgnoreFiles = *.tmp *.swp #*
[environment]
CFLAGS=-O3
PATH=%(testbase)s/bin:%(default_path)s
[filter-myalternative]
cat=%(testbase)s/examples/my-filter
[substitution-myalternative]
original=filtered
[environment-myalternative]
MYALT=1
# @TEST-EXEC: cat %INPUT >output
# @TEST-EXEC: cat output | grep original
# @TEST-EXEC: set | grep MY >envs
original input
# @TEST-IGNORE
cat $1 | sed 's/original/filtered/g' >$2
_*
.btest.failed.dat
.. code-block:: none
# echo Hello, world! Again.
Hello, world! Again.
.. code-block:: none
# echo Hello, world! Again. Again.
Hello, world! Again. Again.
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
all: html
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/* .tmp
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."