Skip to content

Commit

Permalink
Modernize test_project_integration.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Nov 15, 2023
1 parent 88fcc89 commit 4d2c93c
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions tests/test_project_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@
set -xeo pipefail
cd "$( dirname "${BASH_SOURCE[0]}")" # cd here

BUILDDIR="${PWD}/build"
BUILD_DIR="${PWD}/build"
ROOT="${PWD}/.."
TESTDIR="${PWD}"
TEST_DIR="${PWD}"
INSTALL_DIR="${BUILD_DIR}/highfive/install"

test_install() {
local project="${1}"
local builddir="${BUILDDIR}/${project}/${2}"
local build_dir="${BUILD_DIR}/${project}/${2}"
local highfive_dir="${TESTDIR}/${project}/deps/HighFive"
shift
shift
ln -sf ../../.. "${TESTDIR}/${project}/deps/HighFive"
rm -rf "${builddir}"
mkdir -p "${builddir}"
pushd "${builddir}"
cmake "${TESTDIR}/${project}" "$@"
cmake --build . --verbose
ctest
popd
rm "${TESTDIR}/${project}/deps/HighFive"
rm -f "${highfive_dir}"
ln -sf ../../.. "${highfive_dir}"
rm -rf "${build_dir}"
cmake "$@" -B "${build_dir}" "${TEST_DIR}/${project}"
cmake --build "${build_dir}" --verbose
ctest --test-dir "${build_dir}"
}

rm -rf "${BUILDDIR}/highfive"
mkdir -p "${BUILDDIR}/highfive"
pushd "${BUILDDIR}/highfive"
rm -rf "${BUILD_DIR}/highfive"
cmake "${ROOT}" \
-DHIGHFIVE_EXAMPLES=OFF \
-DHIGHFIVE_UNIT_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX="${PWD}/install"
cmake --build . --target install
popd
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-B "${BUILD_DIR}/highfive"
cmake --build "${BUILD_DIR}/highfive" --target install

for project in test_project test_dependent_library; do
# Case 1. Base case: include subdirectory
Expand All @@ -41,11 +38,11 @@ for project in test_project test_dependent_library; do
test_install "${project}" reuse_deps \
-DUSE_BUNDLED_HIGHFIVE=NO \
-DHIGHFIVE_USE_INSTALL_DEPS=YES \
-DCMAKE_PREFIX_PATH="${BUILDDIR}/highfive/install"
-DCMAKE_PREFIX_PATH="${INSTALL_DIR}"
#
# Case 3. We redetect-dependencies
test_install "${project}" install_new_deps \
-DUSE_BUNDLED_HIGHFIVE=NO \
-DHIGHFIVE_USE_INSTALL_DEPS=NO \
-DCMAKE_PREFIX_PATH="${BUILDDIR}/highfive/install"
-DCMAKE_PREFIX_PATH="${BUILD_DIR}"
done

0 comments on commit 4d2c93c

Please sign in to comment.