1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
#!/bin/bash
set -e
pkg=odin
export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
check_n_cleanup () {
local process="$1"
local pids="$(
ps aux \
| awk "/^$USER"'.*bin[/]'"$process"'/ {print$2}' \
| xargs
)"
local xvfb_pids="$(
ps aux \
| awk -vORS=' ' "/^$USER"'.*[X]vfb/ {print$2}' \
| xargs
)"
if [ -n "$pids" ]
then
kill $pids
else
echo "error: $process crashed before the end of the test" >&2
exit 1
fi
test -n "$xvfb_pids" && kill $xvfb_pids
}
cd "${AUTOPKGTEST_TMP}"
mkdir home
export HOME="${AUTOPKGTEST_TMP}/home"
set -x
# Generate a radially inhomogenous coil
gencoil -rad -n 16 -fov 90 -R 50% -o coil1.out
# Generate an array coil by rotating pre-existing image file
gencoil -rot -n 16 -fov 90 -nc 1 -i coil1.out -sl 1 -o coil2.out
# Generate an array coil consisting of simple loops
gencoil -arr -n 16 -nc 16 -fov 90 -R 16 -o coil3.out
# Generate coil with a B1 gradient
gencoil -grad -n 16 -fov 90 -g 1 -o coil4.out
# Generate makefile for odin methods
genmakefile src > Makefile
file Makefile | grep -q 'Makefile: makefile script'
# Create a point-spread function
gensample -psf -t1 1 -t2 2 -o sample1.out
# Create rectangle of uniform spin distribution about origin in all 3 spatial
# dimensions
gensample -uni -n 16 -f 9 -o sample2.out
# Create an isochromat distribution
gensample -iso -n 16 -df 20 -t1 1 -t2 2 -o sample3.out
# Create a homogenous disk with given radius
gensample -dsk -n 16 -f 90 -R 16 -o sample4.out
# Create coaxial cylinder
gensample -cyl -n 16 -f 90 -Xi 200 -Xo 400 -Ri 4 -Ro 32 -o sample5.out
# Mirror bytes
printf '12345678' > bytes1.out
swab 2 bytes1.out bytes2.out
swab 4 bytes1.out bytes4.out
swab 8 bytes1.out bytes8.out
test "$(cat bytes1.out)" = 12345678
test "$(cat bytes2.out)" = 21436587
test "$(cat bytes4.out)" = 43218765
test "$(cat bytes8.out)" = 87654321
# Superficial GUI checks
xvfb-run --auto-servernum /usr/bin/odin &
sleep 10
check_n_cleanup odin
xvfb-run --auto-servernum /usr/bin/geoedit &
sleep 10
check_n_cleanup geoedit
xvfb-run --auto-servernum /usr/bin/pulsar &
sleep 10
check_n_cleanup pulsar
|