]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: script that sets env vars for unit tests
authorAli Maredia <amaredia@redhat.com>
Fri, 22 Apr 2016 00:32:47 +0000 (20:32 -0400)
committerLoic Dachary <ldachary@redhat.com>
Tue, 9 Aug 2016 10:25:40 +0000 (12:25 +0200)
Signed-off-by: Ali Maredia <amaredia@redhat.com>
(cherry picked from commit 15a669435aaa78562746f6728bb185b1e99a4274)

src/test/detect-build-env-vars.sh [new file with mode: 0644]

diff --git a/src/test/detect-build-env-vars.sh b/src/test/detect-build-env-vars.sh
new file mode 100644 (file)
index 0000000..83bcc86
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+if [ -n "$CEPH_BUILD_DIR" ] && [ -n "$CEPH_ROOT" ] && [ -n "$CEPH_BIN" ] && [ -n "$CEPH_LIB" ]; then
+  echo "Enivronment Variables Already Set"
+elif [ -e CMakeCache.txt ]; then
+  echo "Environment Variables Not All Set, Detected Build System CMake"
+  echo "Setting Environment Variables"
+  export CEPH_ROOT=`grep Ceph_SOURCE_DIR CMakeCache.txt | cut -d "=" -f 2`
+  export CEPH_BUILD_DIR=`pwd`
+  export CEPH_BIN=$CEPH_BUILD_DIR/bin
+  export CEPH_LIB=$CEPH_BUILD_DIR/lib
+  export PATH=$CEPH_BIN:$PATH
+  export LD_LIBRARY_PATH=$CEPH_LIB
+elif [ -e .libs ]; then
+  echo "Environment Variables Not All Set, Detected Build System Autotools"
+  echo "Setting Environment Variables"
+  export CEPH_ROOT=".."
+  export CEPH_BUILD_DIR="."
+  export CEPH_BIN="."
+  export CEPH_LIB=".libs"
+  export PATH=.:$PATH
+  export LD_LIBRARY_PATH=".libs"
+else
+  echo "Please execute this command out of the proper directory"
+  exit 1
+fi
+
+