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