# -----------------------------------------------------------------------
# Handling passed arguments to the script
# -----------------------------------------------------------------------
-while getopts ays option
+while getopts ayst option
do
case "${option}"
in
a) AUTOSTART=1;;
y) YES=1;;
s) SAMPLEDATA=--load-all-sample;;
+ t) LIVETEST=1;;
esac
done
apt-get -yq dist-upgrade;
apt-get -yq install build-essential automake git psmisc ntp rsyslog;
+if [ $LIVETEST ]; then
+ cpan TAP::Parser::SourceHandler::pgTAP
+fi;
cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/
ldconfig;
OPENSRF_REPO='git://git.evergreen-ils.org/OpenSRF.git'
OPENSRF_BRANCH='master'
EVERGREEN_REPO='git://git.evergreen-ils.org/working/Evergreen.git'
-EVERGREEN_BRANCH='collab/berick/per-distro-install-makefiles'
+EVERGREEN_BRANCH='collab/phasefx/pgtap-and-per-distro-install-makefiles'
OSRF_COMMAND="
cd /home/opensrf;
git clone --depth 0 --branch $OPENSRF_BRANCH $OPENSRF_REPO OpenSRF;
--admin-user $ADMIN_USER \
--admin-pass $ADMIN_PASS;
+if [ $LIVETEST ]; then
+ PG_CMD="
+ git clone --depth 0 https://github.com/theory/pgtap.git \
+ && cd pgtap \
+ && make \
+ && make installcheck
+ "
+ su - postgres -c "$PG_CMD"
+ cd /var/lib/postgresql/pgtap \
+ && make install;
+ echo 'CREATE EXTENSION pgtap;' | su - postgres -c "psql evergreen"
+fi;
+
# Copy apache configs into place and create SSL cert
cp Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/
cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
echo Restarting Apache
/etc/init.d/apache2 restart
-cat <<EOF
+if [ $LIVETEST ]; then
+# TODO: Eventually move these tests into a Make target within Evergreen
+ cd /home/opensrf/Evergreen
+ echo Running pgTAP tests
+ su - postgres -c 'cd /home/opensrf/Evergreen ; pg_prove -vr -d evergreen Open-ILS/src/sql/Pg/t/'
+
+else
+ cat <<EOF
* Test the system
# as opensrf user
echo "request open-ils.cstore open-ils.cstore.direct.actor.user.retrieve 1" | srfsh
EOF
+fi;
else