Skip to content

Commit

Permalink
make it so that pycbc_test_suite will run from anywhere within the gi…
Browse files Browse the repository at this point in the history
…t repo
  • Loading branch information
GarethCabournDavies committed Jun 6, 2024
1 parent c082c36 commit 03d6b8e
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions tools/pycbc_test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ echo -e "\\n>> [`date`] Python Major Version:" $PYTHON_VERSION
PYTHON_MINOR_VERSION=`python -c 'import sys; print(sys.version_info.minor)'`
echo -e "\\n>> [`date`] Python Minor Version:" $PYTHON_MINOR_VERSION

# This will work from anywhere within the pycbc directory
PYCBC_BASE_DIR=`git rev-parse --show-toplevel`

LOG_FILE=$(mktemp -t pycbc-test-log.XXXXXXXXXX)

RESULT=0

if [ "$PYCBC_TEST_TYPE" = "unittest" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
for prog in `find test -name '*.py' -print | egrep -v '(long|lalsim|test_waveform)'`
for prog in `find $PYCBC_BASE_DIR/test -name '*.py' -print | egrep -v '(long|lalsim|test_waveform)'`
do
echo -e ">> [`date`] running unit test for $prog"
prog_short=`echo $prog | rev | cut -d"/" -f1 | rev`
echo -e ">> [`date`] running unit test for $prog_short"
python $prog &> $LOG_FILE
if test $? -ne 0 ; then
RESULT=1
Expand Down Expand Up @@ -61,7 +65,7 @@ fi

if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
# run pycbc inspiral test
pushd examples/inspiral
pushd $PYCBC_BASE_DIR/examples/inspiral
bash -e run.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -73,7 +77,7 @@ if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

# run a quick bank placement example
pushd examples/tmpltbank
pushd $PYCBC_BASE_DIR/examples/tmpltbank
bash -e testNonspin2.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -88,7 +92,7 @@ if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
if ((${PYTHON_MINOR_VERSION} > 7)); then
# ligo.skymap is only supporting python3.8+, and older releases are
# broken by a new release of python-ligo-lw
pushd examples/live
pushd $PYCBC_BASE_DIR/examples/live
bash -e run.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -101,7 +105,7 @@ if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
fi

# run pycbc_multi_inspiral (PyGRB) test
pushd examples/multi_inspiral
pushd $PYCBC_BASE_DIR/examples/multi_inspiral
bash -e run.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -116,7 +120,7 @@ fi
if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
# Run Inference Scripts
## Run inference on 2D-normal analytic likelihood function
pushd examples/inference/analytic-normal2d
pushd $PYCBC_BASE_DIR/examples/inference/analytic-normal2d
bash -e run.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -129,7 +133,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then

## Run inference on BBH example; this will also run
## a test of create_injections
pushd examples/inference/bbh-injection
pushd $PYCBC_BASE_DIR/examples/inference/bbh-injection
bash -e make_injection.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -150,7 +154,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

## Run inference on GW150914 data
pushd examples/inference/gw150914
pushd $PYCBC_BASE_DIR/examples/inference/gw150914
bash -e run_test.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -162,7 +166,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

## Run inference using single template model
pushd examples/inference/single
pushd $PYCBC_BASE_DIR/examples/inference/single
bash -e get.sh
bash -e run.sh
if test $? -ne 0 ; then
Expand All @@ -175,7 +179,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

## Run inference using relative model
pushd examples/inference/relative
pushd $PYCBC_BASE_DIR/examples/inference/relative
bash -e get.sh
bash -e run.sh
if test $? -ne 0 ; then
Expand All @@ -188,7 +192,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

## Run inference using the hierarchical model
pushd examples/inference/hierarchical
pushd $PYCBC_BASE_DIR/examples/inference/hierarchical
bash -e run_test.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -200,7 +204,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
popd

## Run inference samplers
pushd examples/inference/samplers
pushd $PYCBC_BASE_DIR/examples/inference/samplers
bash -e run.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -215,7 +219,7 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
if ((${PYTHON_MINOR_VERSION} > 7)); then
# ligo.skymap is only supporting python3.8+, and older releases are
# broken by a new release of python-ligo-lw
pushd examples/make_skymap
pushd $PYCBC_BASE_DIR/examples/make_skymap
bash -e simulated_data.sh
if test $? -ne 0 ; then
RESULT=1
Expand All @@ -231,7 +235,7 @@ fi
if [ "$PYCBC_TEST_TYPE" = "docs" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then
echo -e "\\n>> [`date`] Building documentation"

python setup.py build_gh_pages
python $PYCBC_BASE_DIR/setup.py build_gh_pages
if test $? -ne 0 ; then
echo -e " FAILED!"
echo -e "---------------------------------------------------------"
Expand Down

0 comments on commit 03d6b8e

Please sign in to comment.