Permalink
Please sign in to comment.
Browse files
ripped out smoke testing of suma from neurodebian pkg cmake infrastru…
…cture
- Loading branch information...
Showing
with
96 additions
and 0 deletions.
- +14 −0 CMakeLists.txt
- +20 −0 tests/CMakeLists.txt
- +62 −0 tests/xvfb-driver
| @@ -0,0 +1,14 @@ | ||
| +## Rudimentary cmake setup for now just to run tests | ||
| + | ||
| +PROJECT(AFNI) | ||
| + | ||
| +## | ||
| +## Define options to customize the build-process | ||
| +## | ||
| + | ||
| +OPTION(AFNI_BUILD_TESTS | ||
| + "Enable testing and build available tests" | ||
| + OFF) | ||
| + | ||
| +ADD_SUBDIRECTORY(tests) | ||
| + |
| @@ -0,0 +1,20 @@ | ||
| +PROJECT(TESTS) | ||
| +# | ||
| +# Tests -- building/running is aggregated within a separate directory | ||
| +# so they do not interact/pollute main build space | ||
| +# | ||
| +# yoh: for some reason WORKING_DIRECTORY is not quite working for me | ||
| +# says BAD_COMMAND for the binary to be executed. That is why | ||
| +# this solution with tests/ directory | ||
| +# | ||
| + | ||
| +ADD_TEST(afni:start ../../tests/xvfb-driver -- afni -com "OPEN_WINDOW axialimage; SAVE_JPEG axialimage test1; QUIT") | ||
| + | ||
| +# TODO: figure out how to reference it correctly, or just copy to this | ||
| +# target tests/ build directory | ||
| +# Allow for 1 error and 2 failures reported -- due to the ones upon exit | ||
| +ADD_TEST(do.examples ../../tests/xvfb-driver -e 0 -f 0 -- @DO.examples -auto_test) | ||
| +SET_TESTS_PROPERTIES(do.examples PROPERTIES LABELS GLX) | ||
| + | ||
| + | ||
| + |
| @@ -0,0 +1,62 @@ | ||
| +#!/bin/bash | ||
| +set -u | ||
| + | ||
| +# Parse cmdline | ||
| + | ||
| +CLOPTS=`getopt -o e:,f: --long errors:,failures: -n 'xvfb-driver' -- "$@"` | ||
| +if [ $? != 0 ] ; then | ||
| + echo "Terminating..." >&2 | ||
| + exit 1 | ||
| +fi | ||
| +eval set -- "$CLOPTS" | ||
| + | ||
| +# Defaults | ||
| +errors=0 # # of errors expected | ||
| +failures=0 # # of reported failures expected | ||
| + | ||
| +while true ; do | ||
| + case "$1" in | ||
| + -e|--errors) shift; errors=$1; shift;; | ||
| + -f|--failures) shift; failures=$1; shift;; | ||
| + --) shift ; break ;; | ||
| + *) echo "Internal error! ($1)"; exit 1;; | ||
| + esac | ||
| +done | ||
| + | ||
| +# Deduce paths | ||
| + | ||
| +srcdir=$(readlink -f `dirname $0`/..) | ||
| +builddir=$(readlink -f $PWD/..) | ||
| +tempdir=`mktemp -d` | ||
| + | ||
| +cleanup() { rm -r "$tempdir"; } | ||
| +trap 'cleanup' EXIT HUP | ||
| + | ||
| +echo "I: builddir=$builddir srcdir=$srcdir tempdir=$tempdir" | ||
| +cd $tempdir | ||
| +ln -s $srcdir/faces pics | ||
| + | ||
| +AFNI_DETACH=NO AFNI_SYSTEM_AFNIRC=/dev/null \ | ||
| +AFNI_PLUGINPATH=$builddir PATH=$builddir:$builddir/SUMA:$srcdir:$PATH \ | ||
| + xvfb-run --auto-servernum --server-num=20 -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" \ | ||
| + "$@" 2>&1 | tee __outputlog.txt | ||
| +code=${PIPESTATUS[0]} | ||
| + | ||
| +if [ "$code" != "0" ]; then | ||
| + echo "E: Testing $@ failed. Exit code was $code" | ||
| + exit 1 | ||
| +fi | ||
| + | ||
| +cmd="$@" | ||
| +errors_=`grep Error __*log.txt| grep -v -e "Out of Cheese Error" -e SUMA_PositionWindowRelative_current | wc -l` | ||
| +if [ $errors -lt $errors_ ]; then | ||
| + echo "E: Testing '$cmd' failed due to presence of $errors_ Error messages when up to $errors were expected" >&2 | ||
| + exit 1 | ||
| +fi | ||
| + | ||
| +failures_=`grep '^Failed to' __*log.txt| grep -v -e "window attributes" | wc -l` | ||
| +if [ $failures -lt $failures_ ]; then | ||
| + echo "E: Testing '$cmd' failed due to presence of $failures_ 'Failed to ...' messages when up to $failures were expected" >&2 | ||
| + exit 1 | ||
| +fi | ||
| + |
0 comments on commit
e8ff500