]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
allow for multiple "build" dirs to exist 29786/head
authorYuval Lifshitz <yuvalif@yahoo.com>
Wed, 21 Aug 2019 06:27:42 +0000 (09:27 +0300)
committerYuval Lifshitz <yuvalif@yahoo.com>
Fri, 6 Sep 2019 06:38:32 +0000 (09:38 +0300)
Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
15 files changed:
do_cmake.sh
do_freebsd.sh
examples/rbd-replay/trace
qa/workunits/rados/test_envlibrados_for_rocksdb.sh
qa/workunits/rgw/run-s3tests.sh
src/init-ceph.in
src/mrgw.sh
src/mrun
src/mstart.sh
src/mstop.sh
src/pybind/mgr/dashboard/run-backend-api-request.sh
src/pybind/mgr/dashboard/run-backend-api-tests.sh
src/pybind/mgr/dashboard/run-frontend-e2e-tests.sh
src/pybind/mgr/dashboard/run-frontend-unittests.sh
src/script/gen-corpus.sh

index 2e1593ec2fc85ad02f963754a67b018f5b5e1781..5e54fc4b7fd029b8b70df025d038b349a298e709 100755 (executable)
@@ -1,8 +1,12 @@
 #!/usr/bin/env bash
 set -x
+
 git submodule update --init --recursive
-if test -e build; then
-    echo 'build dir already exists; rm -rf build and re-run'
+
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
+if [ -e $BUILD_DIR ]; then
+    echo "'$BUILD_DIR' dir already exists; either rm -rf '$BUILD_DIR' and re-run, or set BUILD_DIR env var to a different directory name"
     exit 1
 fi
 
@@ -46,8 +50,8 @@ if [ -n "$WITH_RADOSGW_AMQP_ENDPOINT" ] ; then
     ARGS="$ARGS -DWITH_RADOSGW_AMQP_ENDPOINT=$WITH_RADOSGW_AMQP_ENDPOINT"
 fi
 
-mkdir build
-cd build
+mkdir $BUILD_DIR
+cd $BUILD_DIR
 if type cmake3 > /dev/null 2>&1 ; then
     CMAKE=cmake3
 else
index d3f60a26558e8ab455c2743cc05123edb1018f74..509384bee579ee9c2433521d050e0fac9d63d323 100755 (executable)
@@ -24,16 +24,18 @@ CMAKE_C_FLAGS_DEBUG="$C_FLAGS_DEBUG $COMPILE_FLAGS"
 #   dashboard, because versions fetched are not working on FreeBSD.
  
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 echo Keeping the old build
-if [ -d build.old ]; then
-    sudo mv build.old build.del
-    sudo rm -rf build.del &
+if [ -d ${BUILD_DIR}.old ]; then
+    sudo mv ${BUILD_DIR}.old ${BUILD_DIR}.del
+    sudo rm -rf ${BUILD_DIR}.del &
 fi
-if [ -d build ]; then
-    sudo mv build build.old
+if [ -d ${BUILD_DIR} ]; then
+    sudo mv ${BUILD_DIR} ${BUILD_DIR}.old
 fi
 
-mkdir build
+mkdir ${BUILD_DIR}
 ./do_cmake.sh "$*" \
        -D WITH_CCACHE=ON \
        -D CMAKE_BUILD_TYPE=Debug \
@@ -61,7 +63,7 @@ mkdir build
 echo -n "start building: "; date
 printenv
 
-cd build
+cd ${BUILD_DIR}
   gmake -j$CPUS V=1 VERBOSE=1 
   gmake tests 
   echo -n "start testing: "; date ;
index 43697b086a365e6b25ed0b89c189d63170da2eab..8739d46e174c14370f03d0f2694d36ef905e80ad 100755 (executable)
@@ -5,6 +5,7 @@ lttng create -o traces librbd
 lttng enable-event -u 'librbd:*'
 lttng add-context -u -t pthread_id
 lttng start
-LD_LIBRARY_PATH=../../build/lib qemu-system-i386 -m 1024 rbd:rbd/my-image:conf=../../src/ceph.conf
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+LD_LIBRARY_PATH=../../${BUILD_DIR}/lib qemu-system-i386 -m 1024 rbd:rbd/my-image:conf=../../src/ceph.conf
 lttng stop
 lttng view > trace.log
index 1360f6dfe5b4832f09742b4026789958a4403807..a78b3ad890fd0aaae1d9d26145caff39a00aa653 100755 (executable)
@@ -72,7 +72,9 @@ if type cmake3 > /dev/null 2>&1 ; then
 else
     CMAKE=cmake
 fi
-mkdir build && cd build && ${CMAKE} -DWITH_LIBRADOS=ON -DWITH_SNAPPY=ON -DWITH_GFLAGS=OFF -DFAIL_ON_WARNINGS=OFF ..
+
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+mkdir ${BUILD_DIR} && cd ${BUILD_DIR} && ${CMAKE} -DWITH_LIBRADOS=ON -DWITH_SNAPPY=ON -DWITH_GFLAGS=OFF -DFAIL_ON_WARNINGS=OFF ..
 make rocksdb_env_librados_test -j8
 
 echo "Copy ceph.conf"
index 307eea01b56aaf69a122a08939d26087a8cea1e1..9ecbae30554d5bb7ef65cd38572972eb7478dfba 100755 (executable)
@@ -12,10 +12,12 @@ port=$2
 
 ##
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 if [ -e CMakeCache.txt ]; then
     BIN_PATH=$PWD/bin
-elif [ -e $root_path/../build/CMakeCache.txt ]; then
-    cd $root_path/../build
+elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then
+    cd $root_path/../${BUILD_DIR}
     BIN_PATH=$PWD/bin
 fi
 PATH=$PATH:$BIN_PATH
index 8ea9ef076edbc5ff7e44fe08adbc24e582ba53f5..e1915bbfb6d6d37fa0f214f83f55837ea0372454 100755 (executable)
@@ -17,6 +17,8 @@ if [ -e /lib/lsb/init-functions ]; then
     . /lib/lsb/init-functions
 fi
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
     # looks like an autotools src dir build
     BINDIR=.
@@ -33,7 +35,7 @@ else
        LIBEXECDIR=$CEPH_ROOT/src
        ETCDIR=.
        ASSUME_DEV=1
-       CEPH_LIB=$CEPH_ROOT/build/lib
+       CEPH_LIB=$CEPH_ROOT/${BUILD_DIR}/lib
        echo "$PYTHONPATH" | grep -q $CEPH_LIB || export PYTHONPATH=$CEPH_LIB/cython_modules/lib.@MGR_PYTHON_VERSION_MAJOR@:$PYTHONPATH
        echo "$LD_LIBRARY_PATH" | grep -q $CEPH_LIB || export LD_LIBRARY_PATH=$CEPH_LIB:$LD_LIBRARY_PATH
        echo "$DYLD_LIBRARY_PATH" | grep -q $CEPH_LIB || export DYLD_LIBRARY_PATH=$CEPH_LIB:$DYLD_LIBRARY_PATH
index 54e8039e643d6ab8b1b0e8f589102dc5c656e75b..c27ba25bcab118d5e5599926d2ecfc1f75ac0aa8 100755 (executable)
@@ -5,10 +5,11 @@ set -e
 rgw_frontend=${RGW_FRONTEND:-"beast"}
 script_root=`dirname $0`
 script_root=`(cd $script_root;pwd)`
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
 if [ -e CMakeCache.txt ]; then
     script_root=$PWD
-elif [ -e $script_root/../build/CMakeCache.txt ]; then
-    cd $script_root/../build
+elif [ -e $script_root/../${BUILD_DIR}/CMakeCache.txt ]; then
+    cd $script_root/../${BUILD_DIR}
     script_root=$PWD
 fi
 ceph_bin=$script_root/bin
index cdf34a83b63a651f651698455190ffcf4cbee5ef..5f2d4646ffb4207717938661c0608aac94ca9992 100755 (executable)
--- a/src/mrun
+++ b/src/mrun
@@ -8,11 +8,13 @@ command=$2
 CEPH_BIN=$root
 CEPH_CONF_PATH=$root/run/$run_name
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 if [ -e CMakeCache.txt ]; then
     CEPH_BIN=$PWD/bin
     CEPH_CONF_PATH=$PWD/run/$run_name
-elif [ -e $root/../build/CMakeCache.txt ]; then
-    cd $root/../build
+elif [ -e $root/../${BUILD_DIR}/CMakeCache.txt ]; then
+    cd $root/../${BUILD_DIR}
     CEPH_BIN=$PWD/bin
     CEPH_CONF_PATH=$PWD/run/$run_name
 fi
index 327591751849c989b52eef000433de448683ea1c..4bf3bde4b69c76b990b20695fff29cbbd232eb5f 100755 (executable)
@@ -18,10 +18,12 @@ vstart_path=`dirname $0`
 root_path=`dirname $0`
 root_path=`(cd $root_path; pwd)`
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 if [ -e CMakeCache.txt ]; then
     root_path=$PWD
-elif [ -e $root_path/../build/CMakeCache.txt ]; then
-    cd $root_path/../build
+elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then
+    cd $root_path/../${BUILD_DIR}
     root_path=$PWD
 fi
 RUN_ROOT_PATH=${root_path}/run
index 0dfe715e86b5bb1b68c2da3bb89f221751590c43..702d1765941e5f7224b805dd270e8e5ba8fd508c 100755 (executable)
@@ -4,10 +4,12 @@ set -e
 
 script_root=`dirname $0`
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 if [ -e CMakeCache.txt ]; then
     script_root=$PWD
-elif [ -e $script_root/../build/CMakeCache.txt ]; then
-    script_root=`(cd $script_root/../build; pwd)`
+elif [ -e $script_root/../${BUILD_DIR}/CMakeCache.txt ]; then
+    script_root=`(cd $script_root/../${BUILD_DIR}; pwd)`
 fi
 
 [ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1
index 5c4c155943bef767b1fa36f19d79ef0168c64525..ad5c42939a6ffd510beccf28829b36b501d0d18e 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/bash
 
 CURR_DIR=`pwd`
-cd ../../../../build
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+cd ../../../../${BUILD_DIR}
 API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
 if [ "$API_URL" = "null" ]; then
        echo "Couldn't retrieve API URL, exiting..." >&2
index 1e11b612e5c4ad225f372c556bb14fcd6343b75b..47aa8d0f4095f78c497671a78f1be9b72d110fcf 100755 (executable)
@@ -24,10 +24,12 @@ get_cmake_variable() {
     grep "$variable" CMakeCache.txt | cut -d "=" -f 2
 }
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 get_build_py_version() {
     CURR_DIR=`pwd`
-    BUILD_DIR="$CURR_DIR/../../../../build"
-    cd $BUILD_DIR
+    LOCAL_BUILD_DIR="$CURR_DIR/../../../../$BUILD_DIR"
+    cd "$LOCAL_BUILD_DIR"
 
     CEPH_MGR_PY_VERSION_MAJOR=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1)
     if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then
@@ -104,7 +106,7 @@ setup_coverage() {
 
 on_tests_error() {
     if [[ -n "$JENKINS_HOME" ]]; then
-        CEPH_OUT_DIR=${CEPH_OUT_DIR:-"$BUILD_DIR"/out}
+        CEPH_OUT_DIR=${CEPH_OUT_DIR:-"$LOCAL_BUILD_DIR"/out}
         MGR_LOG_FILES=$(find "$CEPH_OUT_DIR" -iname "mgr.*.log" | tr '\n' ' ')
         MGR_LOG_FILE_LAST_LINES=60000
         for mgr_log_file in ${MGR_LOG_FILES[@]}; do
@@ -119,13 +121,13 @@ on_tests_error() {
 run_teuthology_tests() {
     trap on_tests_error ERR
 
-    cd "$BUILD_DIR"
+    cd "$LOCAL_BUILD_DIR"
     find ../src/pybind/mgr/dashboard/ -name '*.pyc' -exec rm -f {} \;
 
     OPTIONS=''
     TEST_CASES=''
     if [[ "$@" == '' || "$@" == '--create-cluster-only' ]]; then
-      TEST_CASES=`for i in \`ls $BUILD_DIR/../qa/tasks/mgr/dashboard/test_*\`; do F=$(basename $i); M="${F%.*}"; echo -n " tasks.mgr.dashboard.$M"; done`
+      TEST_CASES=`for i in \`ls $LOCAL_BUILD_DIR/../qa/tasks/mgr/dashboard/test_*\`; do F=$(basename $i); M="${F%.*}"; echo -n " tasks.mgr.dashboard.$M"; done`
       # Mgr selftest module tests have to be run at the end as they stress the mgr daemon.
       TEST_CASES="tasks.mgr.test_dashboard $TEST_CASES tasks.mgr.test_module_selftest"
       if [[ "$@" == '--create-cluster-only' ]]; then
@@ -137,18 +139,18 @@ run_teuthology_tests() {
       done
     fi
 
-    export PATH=$BUILD_DIR/bin:$PATH
+    export PATH=$LOCAL_BUILD_DIR/bin:$PATH
     source $TEMP_DIR/venv/bin/activate # Run after setting PATH as it does the last PATH export.
-    export LD_LIBRARY_PATH=$BUILD_DIR/lib/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}/:$BUILD_DIR/lib
-    local source_dir=$(dirname "$BUILD_DIR")
+    export LD_LIBRARY_PATH=$LOCAL_BUILD_DIR/lib/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}/:$LOCAL_BUILD_DIR/lib
+    local source_dir=$(dirname "$LOCAL_BUILD_DIR")
     local pybind_dir=$source_dir/src/pybind
     local python_common_dir=$source_dir/src/python-common
     # In CI environment we set python paths inside build (where you find the required frontend build: "dist" dir).
     if [[ -n "$JENKINS_HOME" ]]; then
-        export PYBIND=$BUILD_DIR/src/pybind
+        export PYBIND=$LOCAL_BUILD_DIR/src/pybind
         pybind_dir=$PYBIND
     fi
-    export PYTHONPATH=$TEMP_DIR/teuthology:$source_dir/qa:$BUILD_DIR/lib/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}/:$pybind_dir:$python_common_dir:${COVERAGE_PATH}
+    export PYTHONPATH=$TEMP_DIR/teuthology:$source_dir/qa:$LOCAL_BUILD_DIR/lib/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}/:$pybind_dir:$python_common_dir:${COVERAGE_PATH}
     export RGW=${RGW:-1}
 
     export COVERAGE_ENABLED=true
@@ -162,7 +164,7 @@ run_teuthology_tests() {
 }
 
 cleanup_teuthology() {
-    cd "$BUILD_DIR"
+    cd "$LOCAL_BUILD_DIR"
     killall ceph-mgr
     sleep 10
     if [[ "$COVERAGE_ENABLED" == 'true' ]]; then
@@ -178,7 +180,7 @@ cleanup_teuthology() {
 
     unset TEMP_DIR
     unset CURR_DIR
-    unset BUILD_DIR
+    unset LOCAL_BUILD_DIR
     unset COVERAGE_PATH
     unset get_build_py_version
     unset setup_teuthology
index cf7ee4bce6021710aabc3c4ff643666f92c87793..ad4c64f5b26bf1d7aaba11cb7333e34867eea47b 100755 (executable)
@@ -4,7 +4,7 @@ set -e
 
 stop() {
     if [ "$REMOTE" == "false" ]; then
-        cd $BUILD_DIR
+        cd ${FULL_PATH_BUILD_DIR}
         ../src/stop.sh
     fi
     exit $1
@@ -39,8 +39,10 @@ fi
 
 DASH_DIR=`pwd`
 
-cd ../../../../build
-BUILD_DIR=`pwd`
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
+cd ../../../../${BUILD_DIR}
+FULL_PATH_BUILD_DIR=`pwd`
 
 if [ "$BASE_URL" == "" ]; then
     MGR=2 RGW=1 ../src/vstart.sh -n -d
@@ -64,7 +66,7 @@ export BASE_URL
 cd $DASH_DIR/frontend
 jq .[].target=\"$BASE_URL\" proxy.conf.json.sample > proxy.conf.json
 
-. $BUILD_DIR/src/pybind/mgr/dashboard/node-env/bin/activate
+. ${FULL_PATH_BUILD_DIR}/src/pybind/mgr/dashboard/node-env/bin/activate
 
 if [ "$DEVICE" == "chrome" ]; then
     npm run e2e:ci || stop 1
index 0186e872d759a46f0b3ff0d3bdce5da1e80aeb54..b64ac44630609fcf9aef157839bbfbb617036120 100755 (executable)
@@ -3,8 +3,9 @@
 failed=false
 : ${CEPH_ROOT:=$PWD/../../../../}
 cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
 if [ `uname` != "FreeBSD" ]; then
-  .  $CEPH_ROOT/build/src/pybind/mgr/dashboard/node-env/bin/activate
+  .  $CEPH_ROOT/${BUILD_DIR}/src/pybind/mgr/dashboard/node-env/bin/activate
 fi
 
 # Build
index 7f9b61ce4ed2bc39e1ab0859cc20847a173d67cc..018e2bd9d089513d7fe0245ea54bdbe487acb676 100755 (executable)
@@ -13,6 +13,8 @@ function get_jobs() {
     fi
 }
 
+[ -z "$BUILD_DIR" ] && BUILD_DIR=build
+
 function build() {
     local encode_dump_path=$1
     shift
@@ -22,7 +24,7 @@ function build() {
         -DWITH_DPDK=OFF \
         -DWITH_SPDK=OFF \
         -DCMAKE_CXX_FLAGS="-DENCODE_DUMP_PATH=${encode_dump_path}"
-    cd build
+    cd ${BUILD_DIR}
     cmake --build . -- -j$(get_jobs)
 }