Blame SOURCES/run-lit-tests

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