#!/bin/bash
P=lhcs-bench
DEFAULT_VERSION=1.5
. $SHELLPACK_INCLUDE/common.sh

# Basic argument parser
while [ "$1" != "" ]; do
	case "$1" in
	-v)
		VERSION=$2
		shift 2
		;;
	--install-only)
		INSTALL_ONLY=yes
		shift
		;;
	--install-force)
		INSTALL_FORCE=yes
		shift
		;;
	*)
		echo Unrecognised option: $1
		shift
	esac
done
if [ -z "$VERSION" ]; then
	VERSION=$DEFAULT_VERSION
fi

if [ "$INSTALL_FORCE" = "yes" ]; then
	rm -rf $SHELLPACK_SOURCES/lhcs-${VERSION}
fi
if [ ! -d $SHELLPACK_SOURCES/lhcs-${VERSION}-installed ]; then
	$SHELLPACK_INCLUDE/shellpack-install-lhcs -v ${VERSION}  || die lhcs install script returned error
fi
cd $SHELLPACK_SOURCES/lhcs-${VERSION}-installed || die Failed to cd to lhcs install directory
if [ "$INSTALL_ONLY" = "yes" ]; then
	echo lhcs installed only as requested.
	exit $SHELLPACK_SUCCESS
fi

# Run test
cd $SHELLPACK_SOURCES/lhcs-${VERSION}-installed || die Failed to cd to lhcs directory
./runtests.sh

exit $SHELLPACK_SUCCESS
#### Description Linux Hotplug CPU Support
#### Details lhcs-bench 7
