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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
TEMP=/tmp
testfull () {
# $1 title
# $2 type
# $3 file
# $4 params
# $5 cmd
echo -n "$1"
echo -n "."
ds9 $5 -$2 $3$4 -backup foo.bck -sleep 1 -exit
echo -n "*"
ds9 -restore foo.bck -sleep 1 -exit
rm -rf foo.bck*
echo -n "."
cat $3 | ds9 $5 -$2 -$4 -backup foo.bck -sleep 1 -exit
echo -n "*"
ds9 -restore foo.bck -sleep 1 -exit
rm -rf foo.bck*
echo -n "."
echo "PASSED"
}
testhalf () {
# $1 title
# $2 type
# $3 file
echo -n "$1"
echo -n "."
ds9 -$2 ${3%.arr}.hdr $3 -backup foo.bck -sleep 1 -exit
echo -n "*"
ds9 -restore foo.bck -sleep 1 -exit
rm -rf foo.bck*
echo -n "."
echo "PASSED"
}
echo
echo "*** backup.sh ***"
rm -rf foo.bck*
if [ "$TEMP" = "" ]; then
echo "No TEMP directory defined."
echo "Be sure to define TEMP first..."
exit
fi
if [ "$1" = "fits" -o -z "$1" ]; then
testfull fits fits fits/float.fits
testfull "fits original" fits fits/float.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "rgbcube" -o -z "$1" ]; then
testfull rgbcube rgbcube rgbcube/float.fits
testfull "rgbcube original" rgbcube rgbcube/float.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "rgbimage" -o -z "$1" ]; then
testfull rgbimage rgbimage mecube/float.fits
testfull "rgbimage original" rgbimage mecube/float.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "mecube" -o -z "$1" ]; then
testfull mecube mecube mecube/float.fits
testfull "mecube original" mecube mecube/float.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "multiframe" -o -z "$1" ]; then
testfull multiframe multiframe mecube/float.fits
testfull "multiframe original" multiframe mecube/float.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "mosaicimage" -o -z "$1" ]; then
testfull mosaicimagewcs mosaicimagewcs mosaic/mosaicimage.fits
testfull "mosaicimagewcs original" mosaicimagewcs mosaic/mosaicimage.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "mosaic" -o -z "$1" ]; then
testfull mosaicwcs mosaicwcs mosaic/mosaicimage.fits
testfull "mosaicwcs original" mosaicwcs mosaic/mosaicimage.fits " -source aux/pds9.tcl "
fi
if [ "$1" = "sfits" -o -z "$1" ]; then
testhalf sfits sfits sfits/float.arr
testhalf "sfits original" sfits sfits/float.arr " -source aux/pds9.tcl "
fi
if [ "$1" = "srgbcube" -o -z "$1" ]; then
testhalf srgbcube srgbcube srgbcube/float.arr
testhalf "srgbcube original" srgbcube srgbcube/float.arr " -source aux/pds9.tcl "
fi
if [ "$1" = "array" -o -z "$1" ]; then
testfull array array array/float_big.arr [dim=256,bitpix=-32,endian=big]
testfull "array original" array array/float_big.arr [dim=256,bitpix=-32,endian=big] " -source aux/pds9.tcl "
fi
if [ "$1" = "rgbarray" -o -z "$1" ]; then
testfull rgbarray rgbarray rgbarray/float_big.rgb [dim=256,bitpix=-32,endian=big] -rgb
testfull "rgbarray original" rgbarray rgbarray/float_big.rgb [dim=256,bitpix=-32,endian=big] " -rgb -source aux/pds9.tcl "
fi
if [ "$1" = "nrrd" -o -z "$1" ]; then
testfull nrrd nrrd nrrd/float_big_raw.nrrd
testfull "nrrd original" nrrd nrrd/float_big_raw.nrrd " -source aux/pds9.tcl "
fi
if [ "$1" = "photo" -o -z "$1" ]; then
testfull photo tiff photo/rose.tiff
testfull "photo original" tiff photo/rose.tiff " -source aux/pds9.tcl "
fi
if [ "$1" = "photorgb" -o -z "$1" ]; then
testfull photorgb tiff photo/rose.tiff "" -rgb
testfull "photorgb original" tiff photo/rose.tiff "" " -rgb -source aux/pds9.tcl "
fi
# previous backups
if [ "$1" = "old" -o -z "$1" ]; then
for f in backup/*.bck
do
echo "Testing $f"
ds9 -restore $f
echo "PASSED"
done
fi
echo "DONE"
|