#!/bin/sh

if [ "$1" = "--python" ]; then
    shift
    PYTHON="$1"
    shift
else
    PYTHON=python
fi

if [ "$1" = "--root" ]; then
    shift
    ROOT="$1"
    shift
else
    ROOT=$(dirname $PWD)
fi

if [ "$1" = "--tests" ]; then
    shift
    TESTS="$1"
    shift
else
    TESTS=../tests
fi

export ROOT

LD_LIBRARY_PATH="$PWD/src:$LD_LIBRARY_PATH" \
PATH="$PWD/src:$PATH" \
  "$PYTHON" "$ROOT/tests/cram.py" "$@" "$TESTS"
