allow for multiple "build" dirs to exist

Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
This commit is contained in:
Yuval Lifshitz 2019-08-21 09:27:42 +03:00
parent c9863fbd7e
commit b8b43fe59d
15 changed files with 71 additions and 43 deletions

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -x set -x
git submodule update --init --recursive 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 exit 1
fi fi
@ -46,8 +50,8 @@ if [ -n "$WITH_RADOSGW_AMQP_ENDPOINT" ] ; then
ARGS="$ARGS -DWITH_RADOSGW_AMQP_ENDPOINT=$WITH_RADOSGW_AMQP_ENDPOINT" ARGS="$ARGS -DWITH_RADOSGW_AMQP_ENDPOINT=$WITH_RADOSGW_AMQP_ENDPOINT"
fi fi
mkdir build mkdir $BUILD_DIR
cd build cd $BUILD_DIR
if type cmake3 > /dev/null 2>&1 ; then if type cmake3 > /dev/null 2>&1 ; then
CMAKE=cmake3 CMAKE=cmake3
else else

View File

@ -24,16 +24,18 @@ CMAKE_C_FLAGS_DEBUG="$C_FLAGS_DEBUG $COMPILE_FLAGS"
# dashboard, because versions fetched are not working on FreeBSD. # dashboard, because versions fetched are not working on FreeBSD.
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
echo Keeping the old build echo Keeping the old build
if [ -d build.old ]; then if [ -d ${BUILD_DIR}.old ]; then
sudo mv build.old build.del sudo mv ${BUILD_DIR}.old ${BUILD_DIR}.del
sudo rm -rf build.del & sudo rm -rf ${BUILD_DIR}.del &
fi fi
if [ -d build ]; then if [ -d ${BUILD_DIR} ]; then
sudo mv build build.old sudo mv ${BUILD_DIR} ${BUILD_DIR}.old
fi fi
mkdir build mkdir ${BUILD_DIR}
./do_cmake.sh "$*" \ ./do_cmake.sh "$*" \
-D WITH_CCACHE=ON \ -D WITH_CCACHE=ON \
-D CMAKE_BUILD_TYPE=Debug \ -D CMAKE_BUILD_TYPE=Debug \
@ -61,7 +63,7 @@ mkdir build
echo -n "start building: "; date echo -n "start building: "; date
printenv printenv
cd build cd ${BUILD_DIR}
gmake -j$CPUS V=1 VERBOSE=1 gmake -j$CPUS V=1 VERBOSE=1
gmake tests gmake tests
echo -n "start testing: "; date ; echo -n "start testing: "; date ;

View File

@ -5,6 +5,7 @@ lttng create -o traces librbd
lttng enable-event -u 'librbd:*' lttng enable-event -u 'librbd:*'
lttng add-context -u -t pthread_id lttng add-context -u -t pthread_id
lttng start 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 stop
lttng view > trace.log lttng view > trace.log

View File

@ -72,7 +72,9 @@ if type cmake3 > /dev/null 2>&1 ; then
else else
CMAKE=cmake CMAKE=cmake
fi 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 make rocksdb_env_librados_test -j8
echo "Copy ceph.conf" echo "Copy ceph.conf"

View File

@ -12,10 +12,12 @@ port=$2
## ##
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ -e CMakeCache.txt ]; then if [ -e CMakeCache.txt ]; then
BIN_PATH=$PWD/bin BIN_PATH=$PWD/bin
elif [ -e $root_path/../build/CMakeCache.txt ]; then elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then
cd $root_path/../build cd $root_path/../${BUILD_DIR}
BIN_PATH=$PWD/bin BIN_PATH=$PWD/bin
fi fi
PATH=$PATH:$BIN_PATH PATH=$PATH:$BIN_PATH

View File

@ -17,6 +17,8 @@ if [ -e /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions . /lib/lsb/init-functions
fi fi
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
# looks like an autotools src dir build # looks like an autotools src dir build
BINDIR=. BINDIR=.
@ -33,7 +35,7 @@ else
LIBEXECDIR=$CEPH_ROOT/src LIBEXECDIR=$CEPH_ROOT/src
ETCDIR=. ETCDIR=.
ASSUME_DEV=1 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 "$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 "$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 echo "$DYLD_LIBRARY_PATH" | grep -q $CEPH_LIB || export DYLD_LIBRARY_PATH=$CEPH_LIB:$DYLD_LIBRARY_PATH

View File

@ -5,10 +5,11 @@ set -e
rgw_frontend=${RGW_FRONTEND:-"beast"} rgw_frontend=${RGW_FRONTEND:-"beast"}
script_root=`dirname $0` script_root=`dirname $0`
script_root=`(cd $script_root;pwd)` script_root=`(cd $script_root;pwd)`
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ -e CMakeCache.txt ]; then if [ -e CMakeCache.txt ]; then
script_root=$PWD script_root=$PWD
elif [ -e $script_root/../build/CMakeCache.txt ]; then elif [ -e $script_root/../${BUILD_DIR}/CMakeCache.txt ]; then
cd $script_root/../build cd $script_root/../${BUILD_DIR}
script_root=$PWD script_root=$PWD
fi fi
ceph_bin=$script_root/bin ceph_bin=$script_root/bin

View File

@ -8,11 +8,13 @@ command=$2
CEPH_BIN=$root CEPH_BIN=$root
CEPH_CONF_PATH=$root/run/$run_name CEPH_CONF_PATH=$root/run/$run_name
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ -e CMakeCache.txt ]; then if [ -e CMakeCache.txt ]; then
CEPH_BIN=$PWD/bin CEPH_BIN=$PWD/bin
CEPH_CONF_PATH=$PWD/run/$run_name CEPH_CONF_PATH=$PWD/run/$run_name
elif [ -e $root/../build/CMakeCache.txt ]; then elif [ -e $root/../${BUILD_DIR}/CMakeCache.txt ]; then
cd $root/../build cd $root/../${BUILD_DIR}
CEPH_BIN=$PWD/bin CEPH_BIN=$PWD/bin
CEPH_CONF_PATH=$PWD/run/$run_name CEPH_CONF_PATH=$PWD/run/$run_name
fi fi

View File

@ -18,10 +18,12 @@ vstart_path=`dirname $0`
root_path=`dirname $0` root_path=`dirname $0`
root_path=`(cd $root_path; pwd)` root_path=`(cd $root_path; pwd)`
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ -e CMakeCache.txt ]; then if [ -e CMakeCache.txt ]; then
root_path=$PWD root_path=$PWD
elif [ -e $root_path/../build/CMakeCache.txt ]; then elif [ -e $root_path/../${BUILD_DIR}/CMakeCache.txt ]; then
cd $root_path/../build cd $root_path/../${BUILD_DIR}
root_path=$PWD root_path=$PWD
fi fi
RUN_ROOT_PATH=${root_path}/run RUN_ROOT_PATH=${root_path}/run

View File

@ -4,10 +4,12 @@ set -e
script_root=`dirname $0` script_root=`dirname $0`
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ -e CMakeCache.txt ]; then if [ -e CMakeCache.txt ]; then
script_root=$PWD script_root=$PWD
elif [ -e $script_root/../build/CMakeCache.txt ]; then elif [ -e $script_root/../${BUILD_DIR}/CMakeCache.txt ]; then
script_root=`(cd $script_root/../build; pwd)` script_root=`(cd $script_root/../${BUILD_DIR}; pwd)`
fi fi
[ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1 [ "$#" -lt 1 ] && echo "usage: $0 <name> [entity [id]]" && exit 1

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
CURR_DIR=`pwd` 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'` API_URL=`./bin/ceph mgr services 2>/dev/null | jq .dashboard | sed -e 's/"//g' -e 's!/$!!g'`
if [ "$API_URL" = "null" ]; then if [ "$API_URL" = "null" ]; then
echo "Couldn't retrieve API URL, exiting..." >&2 echo "Couldn't retrieve API URL, exiting..." >&2

View File

@ -24,10 +24,12 @@ get_cmake_variable() {
grep "$variable" CMakeCache.txt | cut -d "=" -f 2 grep "$variable" CMakeCache.txt | cut -d "=" -f 2
} }
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
get_build_py_version() { get_build_py_version() {
CURR_DIR=`pwd` CURR_DIR=`pwd`
BUILD_DIR="$CURR_DIR/../../../../build" LOCAL_BUILD_DIR="$CURR_DIR/../../../../$BUILD_DIR"
cd $BUILD_DIR cd "$LOCAL_BUILD_DIR"
CEPH_MGR_PY_VERSION_MAJOR=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1) CEPH_MGR_PY_VERSION_MAJOR=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1)
if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then
@ -104,7 +106,7 @@ setup_coverage() {
on_tests_error() { on_tests_error() {
if [[ -n "$JENKINS_HOME" ]]; then 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_FILES=$(find "$CEPH_OUT_DIR" -iname "mgr.*.log" | tr '\n' ' ')
MGR_LOG_FILE_LAST_LINES=60000 MGR_LOG_FILE_LAST_LINES=60000
for mgr_log_file in ${MGR_LOG_FILES[@]}; do for mgr_log_file in ${MGR_LOG_FILES[@]}; do
@ -119,13 +121,13 @@ on_tests_error() {
run_teuthology_tests() { run_teuthology_tests() {
trap on_tests_error ERR trap on_tests_error ERR
cd "$BUILD_DIR" cd "$LOCAL_BUILD_DIR"
find ../src/pybind/mgr/dashboard/ -name '*.pyc' -exec rm -f {} \; find ../src/pybind/mgr/dashboard/ -name '*.pyc' -exec rm -f {} \;
OPTIONS='' OPTIONS=''
TEST_CASES='' TEST_CASES=''
if [[ "$@" == '' || "$@" == '--create-cluster-only' ]]; then 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. # 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" TEST_CASES="tasks.mgr.test_dashboard $TEST_CASES tasks.mgr.test_module_selftest"
if [[ "$@" == '--create-cluster-only' ]]; then if [[ "$@" == '--create-cluster-only' ]]; then
@ -137,18 +139,18 @@ run_teuthology_tests() {
done done
fi 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. 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 export LD_LIBRARY_PATH=$LOCAL_BUILD_DIR/lib/cython_modules/lib.${CEPH_PY_VERSION_MAJOR}/:$LOCAL_BUILD_DIR/lib
local source_dir=$(dirname "$BUILD_DIR") local source_dir=$(dirname "$LOCAL_BUILD_DIR")
local pybind_dir=$source_dir/src/pybind local pybind_dir=$source_dir/src/pybind
local python_common_dir=$source_dir/src/python-common 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). # In CI environment we set python paths inside build (where you find the required frontend build: "dist" dir).
if [[ -n "$JENKINS_HOME" ]]; then if [[ -n "$JENKINS_HOME" ]]; then
export PYBIND=$BUILD_DIR/src/pybind export PYBIND=$LOCAL_BUILD_DIR/src/pybind
pybind_dir=$PYBIND pybind_dir=$PYBIND
fi 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 RGW=${RGW:-1}
export COVERAGE_ENABLED=true export COVERAGE_ENABLED=true
@ -162,7 +164,7 @@ run_teuthology_tests() {
} }
cleanup_teuthology() { cleanup_teuthology() {
cd "$BUILD_DIR" cd "$LOCAL_BUILD_DIR"
killall ceph-mgr killall ceph-mgr
sleep 10 sleep 10
if [[ "$COVERAGE_ENABLED" == 'true' ]]; then if [[ "$COVERAGE_ENABLED" == 'true' ]]; then
@ -178,7 +180,7 @@ cleanup_teuthology() {
unset TEMP_DIR unset TEMP_DIR
unset CURR_DIR unset CURR_DIR
unset BUILD_DIR unset LOCAL_BUILD_DIR
unset COVERAGE_PATH unset COVERAGE_PATH
unset get_build_py_version unset get_build_py_version
unset setup_teuthology unset setup_teuthology

View File

@ -4,7 +4,7 @@ set -e
stop() { stop() {
if [ "$REMOTE" == "false" ]; then if [ "$REMOTE" == "false" ]; then
cd $BUILD_DIR cd ${FULL_PATH_BUILD_DIR}
../src/stop.sh ../src/stop.sh
fi fi
exit $1 exit $1
@ -39,8 +39,10 @@ fi
DASH_DIR=`pwd` DASH_DIR=`pwd`
cd ../../../../build [ -z "$BUILD_DIR" ] && BUILD_DIR=build
BUILD_DIR=`pwd`
cd ../../../../${BUILD_DIR}
FULL_PATH_BUILD_DIR=`pwd`
if [ "$BASE_URL" == "" ]; then if [ "$BASE_URL" == "" ]; then
MGR=2 RGW=1 ../src/vstart.sh -n -d MGR=2 RGW=1 ../src/vstart.sh -n -d
@ -64,7 +66,7 @@ export BASE_URL
cd $DASH_DIR/frontend cd $DASH_DIR/frontend
jq .[].target=\"$BASE_URL\" proxy.conf.json.sample > proxy.conf.json 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 if [ "$DEVICE" == "chrome" ]; then
npm run e2e:ci || stop 1 npm run e2e:ci || stop 1

View File

@ -3,8 +3,9 @@
failed=false failed=false
: ${CEPH_ROOT:=$PWD/../../../../} : ${CEPH_ROOT:=$PWD/../../../../}
cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
if [ `uname` != "FreeBSD" ]; then 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 fi
# Build # Build

View File

@ -13,6 +13,8 @@ function get_jobs() {
fi fi
} }
[ -z "$BUILD_DIR" ] && BUILD_DIR=build
function build() { function build() {
local encode_dump_path=$1 local encode_dump_path=$1
shift shift
@ -22,7 +24,7 @@ function build() {
-DWITH_DPDK=OFF \ -DWITH_DPDK=OFF \
-DWITH_SPDK=OFF \ -DWITH_SPDK=OFF \
-DCMAKE_CXX_FLAGS="-DENCODE_DUMP_PATH=${encode_dump_path}" -DCMAKE_CXX_FLAGS="-DENCODE_DUMP_PATH=${encode_dump_path}"
cd build cd ${BUILD_DIR}
cmake --build . -- -j$(get_jobs) cmake --build . -- -j$(get_jobs)
} }