Skip to content
Snippets Groups Projects
Commit 7c622b02 authored by Akash Kothari's avatar Akash Kothari
Browse files

Adding automated testing support during installation time

parent 76107341
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
SCRIPTS_DIR=scripts
BASH=/bin/bash
# Run installer script # Run installer script
/bin/bash llvm_installer/llvm_installer.sh $BASH $SCRIPTS_DIR/llvm_installer.sh
# Run the tests
$BASH $SCRIPTS_DIR/automate_tests.sh
File added
#!/bin/bash
CURRENT_DIR=`pwd`
BUILD_DIR=$CURRENT_DIR/build
if [ -x $BUILD_DIR/tools/hpvm/projects/$HPVM_RT ]; then
true
else
echo HPVM not installed! Exiting without running tests!.
exit 0
fi
LIT_DIR=$BUILD_DIR/bin/
LIT_TOOL=$LIT_DIR/llvm-lit
TEST_DIR=$CURRENT_DIR/test
REG_TEST_DIR=$TEST_DIR/regressionTests
UNIT_TEST_DIR=$TEST_DIR/unitTests
echo
echo Running tests ...
echo
# Run regression tests
$LIT_TOOL -v $REG_TEST_DIR
# Run unit tests
#$LIT_TOOL -v $UNIT_TEST_DIR
#!/bin/bash
VERSION="9.0.0"
URL="http://releases.llvm.org"
WGET=wget
CURRENT_DIR=`pwd`
INSTALL_DIR=`pwd`/install
BUILD_DIR=$CURRENT_DIR/$LLVM_SRC/build
# Using 2 threads by default
NUM_THREADS=2
SUFFIX=".tar.xz"
CLANG_SRC="cfe-$VERSION.src"
LLVM_SRC="llvm-$VERSION.src"
LIBCXX_SRC="libcxx-$VERSION.src"
LIBCXXABI_SRC="libcxxabi-$VERSION.src"
HPVM_RT=hpvm-rt.bc
AUTOMATE="y"
read -p "Build and install HPVM automatically? (y or n): " AUTOMATE
if [ ! $AUTOMATE == "y" ] && [ ! $AUTOMATE == "n" ]; then
echo invalid input!
exit -1
fi
echo
read -p "Number of threads: " NUM_THREADS
if [ ! $NUM_THREADS -gt 0 ]; then
NUM_THREADS = 2
echo
echo Using $NUM_THREADS threads by default.
echo
fi
if [ -d $LLVM_SRC ]; then
echo Found $LLVM_SRC!
elif [ -d llvm ]; then
echo Found llvm, not downloading $LLVM_SRC!
else
echo $WGET $URL/$VERSION/$LLVM_SRC$SUFFIX
$WGET $URL/$VERSION/$LLVM_SRC$SUFFIX
tar xf $LLVM_SRC$SUFFIX
rm $LLVM_SRC$SUFFIX
fi
if [ -d $LLVM_SRC ]; then
echo Everything looks sane.
mv $LLVM_SRC llvm
elif [ -d llvm ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
LLVM_SRC=llvm
if [ -d $CURRENT_DIR/$LLVM_SRC/tools ]; then
cd $CURRENT_DIR/$LLVM_SRC/tools
echo In tools.
else
echo Fail! Something is wrong with your $LLVM_SRC checkout!
exit 1
fi
if [ -d clang ]; then
echo Found clang! Not downloading clang again.
else
$WGET $URL/$VERSION/$CLANG_SRC$SUFFIX
tar xf $CLANG_SRC$SUFFIX
rm $CLANG_SRC$SUFFIX
mv $CLANG_SRC clang
if [ -d clang ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
cd $CURRENT_DIR
if [ -d $CURRENT_DIR/$LLVM_SRC/projects ]; then
cd $CURRENT_DIR/$LLVM_SRC/projects
else
echo Fail! Something is wrong wint $LLVM_SRC.
exit 1
fi
if [ -d libcxx ]; then
echo Found libcxx! Not downloading libcxx again.
else
$WGET $URL/$VERSION/$LIBCXX_SRC$SUFFIX
tar xf $LIBCXX_SRC$SUFFIX
rm $LIBCXX_SRC$SUFFIX
mv $LIBCXX_SRC libcxx
if [ -d libcxx ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
if [ $LIBCXXABI_SRC != "" ]; then
if [ -d libcxxabi ]; then
echo Found libcxxabi! Not downloading libcxx again.
else
$WGET $URL/$VERSION/$LIBCXXABI_SRC$SUFFIX
tar xf $LIBCXXABI_SRC$SUFFIX
rm $LIBCXXABI_SRC$SUFFIX
mv $LIBCXXABI_SRC libcxxabi
if [ -d libcxxabi ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
fi
HPVM_DIR=$CURRENT_DIR/$LLVM_SRC/tools/hpvm
if [ ! -d $HPVM_DIR ]; then
echo Adding HPVM sources to tree
mkdir -p $HPVM_DIR
ln -s $CURRENT_DIR/CMakeLists.txt $HPVM_DIR
ln -s $CURRENT_DIR/include $HPVM_DIR/
ln -s $CURRENT_DIR/lib $HPVM_DIR/
ln -s $CURRENT_DIR/projects $HPVM_DIR/
ln -s $CURRENT_DIR/test $HPVM_DIR/
else
echo $CURRENT_DIR/$LLVM_SRC/tools/hpvm exists.
fi
export LLVM_SRC_ROOT=$CURRENT_DIR/$LLVM_SRC
echo Applying HPVM patches
cd $CURRENT_DIR/llvm_patches
/bin/bash ./construct_patch.sh
/bin/bash ./apply_patch.sh
echo Patches applied.
if [ ! $AUTOMATE == "y" ]; then
echo
echo HPVM not installed. Exiting.
exit
fi
echo
echo Now building...
echo Using $NUM_THREADS threads to build HPVM.
echo
cd $CURRENT_DIR
if [ ! -d $BUILD_DIR ]; then
mkdir -p $BUILD_DIR
fi
if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR
fi
cd $BUILD_DIR
echo cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
echo make -j$NUM_THREADS
make -j$NUM_THREADS
#make install
if [ -x $BUILD_DIR/tools/hpvm/projects/$HPVM_RT ]; then
true
else
echo HPVM not installed properly.
exit 0
fi
cd $CURRENT_DIR
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment