#!/bin/sh
#
# test.sh
#
# Shell script to test QPipeline and QScan builds on sample S5
# H1 detector noise contiaining a similuted binary black hole
# inspiral event.

# Shourov K. Chatterji
# shourov@ligo.caltech.edu

# $Id: test.sh,v 1.5 2007/05/14 13:57:38 shourov Exp $

# change to directory containing this script
cd `dirname $0`

# remove any previous test
rm -rf test

# create output directory
mkdir -p test

# initialize exit status
exitStatus=0

# run example qpipeline analysis
echo "testing qpipeline..."
mkdir -p test/qpipeline
./bin/qpipeline.sh 822191360 822191424 @test @test test/qpipeline
if [ $? -ne 0 ]; then
  echo "ERROR: See ./test/qpipeline/log/status/status_822191360-822191424.txt"
  exitStatus=1
else
  echo "done."
fi

# run example qevent analysis
echo "testing qevent..."
mkdir -p test/qevent
./bin/qevent.sh 822191381.5 2.0 @test @test test/qevent
if [ $? -ne 0 ]; then
  echo "ERROR: See ./test/qevent/822191381.5/log.txt"
  exitStatus=1
else
  echo "done."
fi

# run example qscan analysis
echo "testing qscan..."
mkdir -p test/qscan
./bin/qscan.sh 822191381.5 @test @test test/qscan
if [ $? -ne 0 ]; then
  echo "ERROR: See ./test/qscan/822191381.5/log.txt"
  exitStatus=1
else
  echo "done."
fi

# run example qscanlist analysis
echo "testing qscanlite..."
mkdir -p test/qscanlite
./bin/qscanlite.sh 822191381.5 @test @test test/qscanlite
if [ $? -ne 0 ]; then
  echo "ERROR: See ./test/qscanlite/822191381.5/log.txt"
  exitStatus=1
else
  echo "done."
fi

# return to calling function
exit ${exitStatus}

