Blame SOURCES/run-lit-tests

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