This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit e0f7e2d702bb15fb402fce36b10e660b5d355c8d
Author: Benjamin Bannier <[email protected]>
AuthorDate: Mon Sep 9 09:19:54 2019 +0200

    Added a `distcheck` target to the cmake build.
    
    This patch adds a `distcheck` target to the cmake build which mimics the
    target of the same name provided by the autotools build. `distcheck`
    depends on the `dist` target to create a distribution archive and then
    ensures that with the distributed sources the `check` targets succeeds.
    
    Review: https://reviews.apache.org/r/71241/
---
 CMakeLists.txt     |  4 ++++
 cmake/distcheck.sh | 31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 319ce99..a1ca5c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,3 +98,7 @@ include(CPack)
 
 add_custom_target(dist
   COMMAND ${CMAKE_SOURCE_DIR}/cmake/dist.sh ${MESOS_PACKAGE_VERSION})
+
+add_custom_target(distcheck
+  COMMAND ${CMAKE_SOURCE_DIR}/cmake/distcheck.sh ${MESOS_PACKAGE_VERSION}
+  DEPENDS dist)
diff --git a/cmake/distcheck.sh b/cmake/distcheck.sh
new file mode 100755
index 0000000..282c551
--- /dev/null
+++ b/cmake/distcheck.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+ORIGIN=${PWD}
+
+VERSION=$1
+if [ -z "${VERSION}" ]; then
+  echo "Specify a version number as first argument"
+  exit 1
+fi
+
+WORKDIR=$(mktemp -d)
+trap 'rm -rf ${WORKDIR}' EXIT
+
+pushd "${WORKDIR}" || exit 1
+
+tar xf "${ORIGIN}"/mesos-"${VERSION}".tar.gz
+pushd mesos-"${VERSION}"
+mkdir build
+pushd  build
+
+# TODO(bbannier): Also check `install` target once the CMake build supports it.
+cmake .. ${DISTCHECK_CMAKE_FLAGS}
+cmake --build . --target check -j "$(nproc)"
+
+popd
+popd
+
+popd

Reply via email to