Skip to content

Commit

Permalink
Modernize test_project_integration.sh. (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Nov 16, 2023
1 parent 88fcc89 commit 13396c5
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions tests/test_project_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,56 @@
set -xeo pipefail
cd "$( dirname "${BASH_SOURCE[0]}")" # cd here

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

test_install() {
local project="${1}"
local builddir="${BUILDDIR}/${project}/${2}"
local project_dir="${TEST_DIR}/${project}"
local dep_dir="${TEST_DIR}/${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

pushd "${project_dir}"

local build_dir="build"

ln -sf ../../.. "${dep_dir}"

cmake "$@" -B "${build_dir}" .
cmake --build "${build_dir}" --verbose
ctest --test-dir "${build_dir}"

rm -f "${dep_dir}"
rm -rf "${build_dir}"

popd
rm "${TESTDIR}/${project}/deps/HighFive"
}

rm -rf "${BUILDDIR}/highfive"
mkdir -p "${BUILDDIR}/highfive"
pushd "${BUILDDIR}/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}"
cmake --build "${BUILD_DIR}" --target install

for project in test_project test_dependent_library; do
# Case 1. Base case: include subdirectory
test_install "${project}" subdir
test_install "${project}"

# Case 2. We use an install dir and all deps configuration
# Install highfive (no tests required)
test_install "${project}" reuse_deps \
test_install "${project}" \
-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 \
test_install "${project}" \
-DUSE_BUNDLED_HIGHFIVE=NO \
-DHIGHFIVE_USE_INSTALL_DEPS=NO \
-DCMAKE_PREFIX_PATH="${BUILDDIR}/highfive/install"
-DCMAKE_PREFIX_PATH="${INSTALL_DIR}"
done

rm -rf "${BUILD_DIR}"

0 comments on commit 13396c5

Please sign in to comment.