#!/bin/sh

set -ev

export Python=${Python:?}
export WORKSPACE=${WORKSPACE:?}

if [ "${Python}" = "2" ]
then
  NOSE="nosetests-2.7"
elif [ "${Python}" = "3" ]
then
  NOSE="nosetests3"
fi

export LD_LIBRARY_PATH=${WORKSPACE}/install/lib
export PYTHONPATH=${WORKSPACE}/install/$(python${Python} -c "from distutils.sysconfig import *; print(get_python_lib(True, prefix=''))")

cd ${WORKSPACE}/build
"${WORKSPACE}/tests/run" --nose ${NOSE}
