28ce86
#!/bin/bash
28ce86
28ce86
usage() {
28ce86
    echo "usage: `basename $0` [OPTIONS]"
28ce86
    echo "  --threads NUM         The number of threads to use for running tests."
28ce86
    echo "  --multilib-arch ARCH  Use this option to test 32-bit libs/binaries on"
28ce86
    echo "                        64-bit hosts."
28ce86
}
28ce86
28ce86
threads_arg=''
28ce86
28ce86
while [ $# -gt 0 ]; do
28ce86
    case $1 in
28ce86
        --threads)
28ce86
            shift
28ce86
            threads_arg="--threads $1"
28ce86
            ;;
28ce86
	--multilib-arch)
28ce86
            shift
28ce86
	    ARCH=$1
28ce86
	    ;;
28ce86
        * )
28ce86
            echo "unknown option: $1"
28ce86
            echo ""
28ce86
            usage
28ce86
            exit 1
28ce86
            ;;
28ce86
    esac
28ce86
    shift
28ce86
done
28ce86
28ce86
set -xe
28ce86
28ce86
if [ -z "$ARCH" ]; then
28ce86
    ARCH=`rpm --eval '%_arch'`
28ce86
fi
28ce86
28ce86
case $ARCH in
28ce86
    arm)
28ce86
	;&
28ce86
    i686)
28ce86
        LIB_DIR="/usr/lib/"
28ce86
        ;;
28ce86
    *)
28ce86
        LIB_DIR="/usr/lib64/"
28ce86
        ;;
28ce86
esac
28ce86
28ce86
cd $(mktemp -d)
28ce86
ln -s /usr/include include
28ce86
ln -s /usr/share/llvm/src/docs docs
28ce86
tar -xzf /usr/share/llvm/src/test.tar.gz
28ce86
ln -s /usr/share/llvm/src/$ARCH.site.cfg.py test/lit.site.cfg.py
28ce86
ln -s /usr/share/llvm/src/$ARCH.Unit.site.cfg.py test/Unit/lit.site.cfg.py
28ce86
lit -v -s $threads_arg test \
28ce86
	-Dllvm_obj_root=`pwd` \
28ce86
	-Dllvm_test_root=`pwd`/test \
28ce86
	-Dllvm_unittest_bindir=$LIB_DIR/llvm \
28ce86
	-Dllvm_shlib_dir=$LIB_DIR