From fb3028ce1729a5fc06b30b6918052a8479bae204 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Fri, 6 Oct 2017 14:24:45 +0200 Subject: [PATCH] custom install dir test --- .gitlab-ci.yml | 15 +++++++-------- ci/scripts/build.sh | 2 +- ci/scripts/config.sh | 10 ++++++++-- ci/scripts/install.sh | 11 +++++++++-- ci/scripts/test.sh | 10 ++++++++-- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eae45d02d..7f5fdaa1c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,8 +15,8 @@ config:ubuntu_zesty: image: keckj/hysop:ubuntu_zesty stage: configure script: - - "sh ci/scripts/config.sh ./build/gcc-6 gcc-6 g++-6 gfortran-6" - - "sh ci/scripts/config.sh ./build/clang-6 clang-6.0 clang++-6.0 gfortran-6" + - "sh ci/scripts/config.sh ./build/gcc-6 ./install/gcc-6 gcc-6 g++-6 gfortran-6" + - "sh ci/scripts/config.sh ./build/clang-6 ./install/clang-6 clang-6.0 clang++-6.0 gfortran-6" dependencies: - env:ubuntu_zesty artifacts: @@ -27,7 +27,7 @@ build:ubuntu_zesty: image: keckj/hysop:ubuntu_zesty stage: build script: - - "sh ci/scripts/build.sh ./build/gcc-6 gcc-6 g++-6 gfortran-6" + - "sh ci/scripts/build.sh ./build/gcc-6 gcc-6 g++-6 gfortran-6" - "sh ci/scripts/build.sh ./build/clang-6 clang-6.0 clang++-6.0 gfortran-6" dependencies: - config:ubuntu_zesty @@ -39,7 +39,7 @@ install:ubuntu_zesty: image: keckj/hysop:ubuntu_zesty stage: install script: - - "sh ci/scripts/install.sh ./build/gcc-6" + - "sh ci/scripts/install.sh ./build/gcc-6 ./install/gcc-6" dependencies: - build:ubuntu_zesty artifacts: @@ -55,10 +55,9 @@ test:ubuntu_zesty: - mkdir -p "/home/hysoprunner" - chown hysoprunner:hysoprunner "/home/hysoprunner" - chmod u+rw "/home/hysoprunner" - - chown hysoprunner:hysoprunner "/root/.local/lib/python2.7/site-packages/hysop" - - chmod u+rx "/root/.local/lib/python2.7/site-packages/hysop" - - export PYTHON_PATH="/root/.local/lib/python2.7/site-packages/hysop" - - su hysoprunner -c "sh ci/scripts/test.sh" + - chown hysoprunner:hysoprunner "./install/gcc-6/lib/python2.7/site-packages/hysop" + - chmod u+rx "./install/gcc-6/python2.7/site-packages/hysop" + - su hysoprunner -c "sh ci/scripts/test.sh ./install/gcc-6" dependencies: - install:ubuntu_zesty cache: diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index 1b894cab1..a10c8bd2c 100644 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -if [ $# -ne 4 ]; then +if [ $# -ne 5 ]; then echo "Usage ./build build_folder CC CXX FC" exit 1 fi diff --git a/ci/scripts/config.sh b/ci/scripts/config.sh index d49b319e2..6bec62e67 100644 --- a/ci/scripts/config.sh +++ b/ci/scripts/config.sh @@ -2,7 +2,7 @@ set -e if [ $# -ne 4 ]; then - echo "Usage ./config build_folder CC CXX FC" + echo "Usage ./config build_folder install_folder CC CXX FC" exit 1 fi @@ -11,12 +11,18 @@ if [ -d "$1" ]; then exit 1 fi +if [ -d "$2" ]; then + echo "Folder $2 already exists." + exit 1 +fi + ROOT_DIR="$(pwd)" BUILD_DIR="$1" +INSTALL_DIR="$2" mkdir -p $BUILD_DIR cd $BUILD_DIR -CC="$2" CXX="$3" FC="$4" cmake -DCMAKE_BUILD_TYPE=Release $ROOT_DIR +CC="$3" CXX="$4" FC="$5" cmake -DCMAKE_BUILD_TYPE=Release -DHYSOP_INSTALL=$INSTALL_DIR $ROOT_DIR if [ ! -f Makefile ]; then echo "The makefile has not been generated." diff --git a/ci/scripts/install.sh b/ci/scripts/install.sh index 1c79f78c8..ba708d3e5 100644 --- a/ci/scripts/install.sh +++ b/ci/scripts/install.sh @@ -2,8 +2,8 @@ #!/bin/bash set -e -if [ $# -ne 1 ]; then - echo "Usage ./install build_folder" +if [ $# -ne 2 ]; then + echo "Usage ./install build_folder install_folder" exit 1 fi @@ -12,10 +12,17 @@ if [ ! -d "$1" ]; then exit 1 fi +if [ ! -d "$2" ]; then + echo "Folder {} does not exist." + exit 1 +fi + BUILD_FOLDER="$1" +INSTALL_FOLDER="$2" cd $BUILD_FOLDER make install +export PYTHONPATH=$INSTALL_FOLDER python -c 'import hysop; print hysop' exit 0 diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh index ebaa01885..f960eee24 100644 --- a/ci/scripts/test.sh +++ b/ci/scripts/test.sh @@ -1,11 +1,17 @@ #!/bin/bash set -e -if [ $# -ne 0 ]; then - echo "Usage ./test" +if [ $# -ne 1 ]; then + echo "Usage ./test install_folder" exit 1 fi +if [ ! -d "$0" ]; then + echo "Folder {} does not exist." + exit 1 +fi + +export PYTHONPATH=$0 python -c 'import hysop; print hysop' python './hysop/operator/test_transpose.py' exit 0 -- GitLab