diff --git a/SAS/LSMR/test/t_lsmrapp_scheduling_django.run b/SAS/LSMR/test/t_lsmrapp_scheduling_django.run index dfbd19a1da40e58ae920364985326b59857e916b..c59a50753c3bc6529dac74ffe78638d6ed94fd0f 100755 --- a/SAS/LSMR/test/t_lsmrapp_scheduling_django.run +++ b/SAS/LSMR/test/t_lsmrapp_scheduling_django.run @@ -18,21 +18,9 @@ password=lsrm -#keep track of helper application pids to kill in teardown -PIDS= - # setup propagation of signals to child processes teardown() { echo "tearing down test environment" - for PID in $PIDS - do - # get the full command - CMD="`ps --pid $PID h -o command`" - echo "killing helper application: $CMD" - - # and kill it - kill -TERM $PID - done echo "removing test credentials file: $CREDENTIALS_PATH" rm $CREDENTIALS_PATH @@ -48,7 +36,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME # Run test $LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_scheduling_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner & TEST_PID=$! -PIDS="$TEST_PID $PIDS" wait "$TEST_PID" # wait again (to get the status code of the test) diff --git a/SAS/LSMR/test/t_lsmrapp_scheduling_functional.run b/SAS/LSMR/test/t_lsmrapp_scheduling_functional.run index 0c637fa29ea84af30611af7d1cba8595e8bed682..50eb24e21faeb9f60cb587e4beb9bca0102ed726 100755 --- a/SAS/LSMR/test/t_lsmrapp_scheduling_functional.run +++ b/SAS/LSMR/test/t_lsmrapp_scheduling_functional.run @@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME # Run test ./t_lsmrapp_scheduling_functional.py & TEST_PID=$! -PIDS="$TEST_PID $PIDS" wait "$TEST_PID" # wait again (to get the status code of the test) diff --git a/SAS/LSMR/test/t_lsmrapp_specification_django.run b/SAS/LSMR/test/t_lsmrapp_specification_django.run index d3c9ef68b10f5605e1407aef8d74617a658b0bdd..e43bfde2f14f6dcb871feb73b2e44dae622236e7 100755 --- a/SAS/LSMR/test/t_lsmrapp_specification_django.run +++ b/SAS/LSMR/test/t_lsmrapp_specification_django.run @@ -1,3 +1,54 @@ -#!/bin/sh +#!/bin/bash +set +x + +mkdir -p ~/.lofar/dbcredentials + +DJANGO_TEST_DATABASE_NAME="lsmr_test_`uuidgen | sed 's/-/_/g'`" +CREDENTIALS_PATH="$HOME/.lofar/dbcredentials/$DJANGO_TEST_DATABASE_NAME.ini" + +echo "creating test credentials file: $CREDENTIALS_PATH" +echo "[database:$DJANGO_TEST_DATABASE_NAME] +host=localhost +type=postgres +database=$DJANGO_TEST_DATABASE_NAME +port=7654 +user=lsrm +password=lsrm +" > "$CREDENTIALS_PATH" + + +# setup propagation of signals to child processes +teardown() { + echo "tearing down test environment" + + echo "removing test credentials file: $CREDENTIALS_PATH" + rm $CREDENTIALS_PATH +} + +## Trap upon signals and upon normal exit. +trap 'STATUS=$?; teardown; exit $STATUS' SIGHUP SIGINT SIGQUIT SIGKILL SIGTERM + + +export DJANGO_TEST_PORT=$DJANGO_TEST_PORT +export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME + +# Run test +$LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_specification_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner & +TEST_PID=$! + +wait "$TEST_PID" +# wait again (to get the status code of the test) +wait "$TEST_PID" +TEST_EXIT_CODE=$? + +teardown + +exit $TEST_EXIT_CODE + + + + + + + -$LOFARROOT/lib*/python*/site-packages/lofar/sas/lsmr/manage.py test --pattern="t_lsmrapp_specification_django.py" --testrunner=postgres_testrunner.PostgresqlTestRunner diff --git a/SAS/LSMR/test/t_lsmrapp_specification_functional.run b/SAS/LSMR/test/t_lsmrapp_specification_functional.run index 6722f7a83b80fb6f1811e9af7dc8b6fe0fd7a74c..f552f5b0f012f4899424bb5d01b8767ee7ced7d2 100755 --- a/SAS/LSMR/test/t_lsmrapp_specification_functional.run +++ b/SAS/LSMR/test/t_lsmrapp_specification_functional.run @@ -63,7 +63,6 @@ export LSMR_DBCREDENTIALS=$DJANGO_TEST_DATABASE_NAME # Run test ./t_lsmrapp_specification_functional.py & TEST_PID=$! -PIDS="$TEST_PID $PIDS" wait "$TEST_PID" # wait again (to get the status code of the test)