Skip to content
Snippets Groups Projects
Commit e4988081 authored by BaM's avatar BaM
Browse files

cleaning + add internet co check for test build

parent f865d7a7
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,11 @@ echo "--------------------------------------------"
exit 418
}
J="1"
BUILD=false
CLEAN=false
GTEST=false
function build ()
{
if [ ! -d "bld" ]; then
......@@ -40,21 +45,14 @@ function build ()
fi
cd bld
if [ "$1" == "WithNoTest" ]; then
cmake ..
if [ "$GTEST" == "false" ]; then
make -j ${J} CLASSpkg_root CLASSpkg CLASSGui
fi
if [ "$1" == "WithTest" ]; then
cmake ..
exit 0
else
make -j ${J}
../bin/RunTest
fi
if [ "$1" == "TestOnly" ]; then
cmake ..
make -j ${J} RunTest
../bin/RunTest
exit 0
fi
}
......@@ -69,16 +67,17 @@ function clean ()
rm -rf source/src/*Dict.cxx
rm -rf lib
rm -rf bin
if [ "$BUILD" = "false" ]; then
exit 0
fi
}
##############################################################################
### calls of all functions
##############################################################################
J="1"
BUILD=false
CLEAN=false
GTEST=false
# Help if no argument
if [ -z "$*" ]; then usage; fi
......@@ -91,7 +90,7 @@ for arg in "$@"; do
--build|-build|build )
BUILD=true ;;
--gtest|-gtest|gtest )
GTEST=true ;;
BUILD=true;GTEST=true ;;
--clean|-clean|clean )
CLEAN=true ;;
--clean-build )
......@@ -103,22 +102,27 @@ for arg in "$@"; do
esac
done
if [ "${CLEAN}" = true ]; then
clean
fi
if [ "${BUILD}" = true ] && [ "${GTEST}" = false ]; then
build "WithNoTest"
# Test is gtest is already there or if we have an internet connection
if [ "${GTEST}" = true ]; then
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
if [ ! $? -eq 0 ] && [ ! -d "bld/GTest/gtest/src/gtest" ]; then
echo "An internet connection is required to compile the test"
exit 1
fi
fi
if [ "${BUILD}" = true ] && [ "${GTEST}" = true ]; then
build "WithTest"
if [ "${CLEAN}" = true ]; then
clean
fi
if [ "${BUILD}" = false ] && [ "${GTEST}" = true ]; then
build "TestOnly"
if [ "${BUILD}" = true ]; then
build
fi
usage
exit 0
EOF
......
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