This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 8a09113f7 chore(build): remove run.sh in rdsn (#1041)
8a09113f7 is described below
commit 8a09113f7dc03b05085f53b7549037e3414cbb0d
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon Jul 11 11:04:45 2022 +0800
chore(build): remove run.sh in rdsn (#1041)
---
.github/workflows/rdsn_cron_compile_jobs.yaml | 2 -
.github/workflows/test_rdsn.yaml | 33 +-
.github/workflows/test_rdsn_always_pass.yaml | 1 -
.licenserc.yaml | 4 -
rdsn/run.sh | 406 ---------------------
rdsn/scripts/linux/build.sh | 18 +-
rdsn/scripts/linux/clear_zk.sh | 45 ---
rdsn/scripts/linux/start_zk.sh | 105 ------
rdsn/scripts/linux/stop_zk.sh | 43 ---
rdsn/src/failure_detector/test/config-test.ini | 2 +-
.../test/config-whitelist-test-failed.ini | 2 +-
.../test/config-whitelist-test.ini | 2 +-
rdsn/src/meta/test/config-test.ini | 1 -
rdsn/src/meta/test/meta_state/config-test.ini | 2 +-
rdsn/src/zookeeper/test/config-test.ini | 2 +-
run.sh | 128 +++++--
16 files changed, 112 insertions(+), 684 deletions(-)
diff --git a/.github/workflows/rdsn_cron_compile_jobs.yaml
b/.github/workflows/rdsn_cron_compile_jobs.yaml
index 8d747bcdd..9f713577d 100644
--- a/.github/workflows/rdsn_cron_compile_jobs.yaml
+++ b/.github/workflows/rdsn_cron_compile_jobs.yaml
@@ -62,11 +62,9 @@ jobs:
working-directory: rdsn
run: unzip /root/thirdparties-bin.zip -d ./thirdparty
- name: Compilation on GCC
- working-directory: rdsn
if: ${{ matrix.compiler-family == 'gcc' }}
run: ./run.sh build -c --skip_thirdparty
- name: Compilation on Clang
- working-directory: rdsn
if: ${{ matrix.compiler-family == 'clang' }}
env:
COMPILER: ${{ matrix.compiler }}
diff --git a/.github/workflows/test_rdsn.yaml b/.github/workflows/test_rdsn.yaml
index 39ac602be..b6c991554 100644
--- a/.github/workflows/test_rdsn.yaml
+++ b/.github/workflows/test_rdsn.yaml
@@ -33,7 +33,6 @@ on:
- rdsn/bin/**
- rdsn/compile_thrift.py
- rdsn/include/**
- - rdsn/run.sh
- rdsn/scripts/**
- rdsn/src/**
- rdsn/thirdparty/**
@@ -83,15 +82,11 @@ jobs:
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -B build/
cmake --build build/ -j $(($(nproc)/2+1))
- - name: Compilation
- working-directory: rdsn
- run: ./run.sh build -c --skip_thirdparty -j $(($(nproc)/2+1))
- - name: Unit Testing
- working-directory: rdsn
+ - name: Compilation and Unit Testing
run: |
export
LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
ulimit -s unlimited
- ./run.sh test --skip_thirdparty -j $(($(nproc)/2+1))
+ ./run.sh build -c --rdsn --test --skip_thirdparty -j
$(($(nproc)/2+1))
test-with-sanitizer-address:
name: Test With Sanitizer Address
@@ -125,15 +120,11 @@ jobs:
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -B build/
cmake --build build/ -j $(($(nproc)/2+1))
- - name: Compilation
- working-directory: rdsn
- run: ./run.sh build -c --sanitizer address --skip_thirdparty
--disable_gperf -j $(($(nproc)/2+1))
- - name: Unit Testing
- working-directory: rdsn
+ - name: Compilation and Unit Testing
run: |
export
LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
ulimit -s unlimited
- ./run.sh test --sanitizer address --skip_thirdparty --disable_gperf
-j $(($(nproc)/2+1))
+ ./run.sh build -c --rdsn --test --sanitizer address
--skip_thirdparty --disable_gperf -j $(($(nproc)/2+1))
test-with-sanitizer-leak:
name: Test With Sanitizer Leak
@@ -167,15 +158,11 @@ jobs:
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -B build/
cmake --build build/ -j $(($(nproc)/2+1))
- - name: Compilation
- working-directory: rdsn
- run: ./run.sh build -c --sanitizer leak --skip_thirdparty
--disable_gperf -j $(($(nproc)/2+1))
- - name: Unit Testing
- working-directory: rdsn
+ - name: Compilation and Unit Testing
run: |
export
LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
ulimit -s unlimited
- ./run.sh test --sanitizer leak --skip_thirdparty --disable_gperf -j
$(($(nproc)/2+1))
+ ./run.sh build -c --rdsn --test --sanitizer leak --skip_thirdparty
--disable_gperf -j $(($(nproc)/2+1))
test-with-sanitizer-undefined:
name: Test With Sanitizer Undefined
@@ -209,12 +196,8 @@ jobs:
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -B build/
cmake --build build/ -j $(($(nproc)/2+1))
- - name: Compilation
- working-directory: rdsn
- run: ./run.sh build -c --sanitizer undefined --skip_thirdparty
--disable_gperf -j $(($(nproc)/2+1))
- - name: Unit Testing
- working-directory: rdsn
+ - name: Compilation and Unit Testing
run: |
export
LD_LIBRARY_PATH=`pwd`/thirdparty/output/lib:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
ulimit -s unlimited
- ./run.sh test --sanitizer undefined --skip_thirdparty
--disable_gperf -j $(($(nproc)/2+1))
+ ./run.sh build -c --rdsn --test --sanitizer undefined
--skip_thirdparty --disable_gperf -j $(($(nproc)/2+1))
diff --git a/.github/workflows/test_rdsn_always_pass.yaml
b/.github/workflows/test_rdsn_always_pass.yaml
index a05bfaa4e..c39c406a6 100644
--- a/.github/workflows/test_rdsn_always_pass.yaml
+++ b/.github/workflows/test_rdsn_always_pass.yaml
@@ -32,7 +32,6 @@ on:
- rdsn/bin/**
- rdsn/compile_thrift.py
- rdsn/include/**
- - rdsn/run.sh
- rdsn/scripts/**
- rdsn/src/**
- rdsn/thirdparty/**
diff --git a/.licenserc.yaml b/.licenserc.yaml
index eee99b14d..00f931f74 100644
--- a/.licenserc.yaml
+++ b/.licenserc.yaml
@@ -202,13 +202,9 @@ header:
- 'rdsn/include/dsn/utility/utils.h'
- 'rdsn/include/dsn/utility/work_queue.h'
- 'rdsn/include/dsn/utils/time_utils.h'
- - 'rdsn/run.sh'
- 'rdsn/scripts/linux/build.sh'
- - 'rdsn/scripts/linux/clear_zk.sh'
- 'rdsn/scripts/linux/install.sh'
- 'rdsn/scripts/linux/learn_stat.py'
- - 'rdsn/scripts/linux/start_zk.sh'
- - 'rdsn/scripts/linux/stop_zk.sh'
- 'rdsn/src/aio/aio_provider.cpp'
- 'rdsn/src/aio/aio_provider.h'
- 'rdsn/src/aio/disk_engine.cpp'
diff --git a/rdsn/run.sh b/rdsn/run.sh
deleted file mode 100755
index 2ca79e668..000000000
--- a/rdsn/run.sh
+++ /dev/null
@@ -1,406 +0,0 @@
-#!/bin/bash
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Microsoft Corporation
-#
-# -=- Robust Distributed System Nucleus (rDSN) -=-
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-os=linux
-scripts_dir=`pwd`/scripts/$os
-
-function exit_if_fail() {
- if [ $1 != 0 ]; then
- exit $1
- fi
-}
-
-function usage()
-{
- echo "usage: run.sh <command> [<args>]"
- echo
- echo "Command list:"
- echo " help print the help info"
- echo " build build the system"
- echo " install install the system"
- echo " test test the system"
- echo " start_zk start the local single zookeeper server"
- echo " stop_zk stop the local single zookeeper server"
- echo " clear_zk stop the local single zookeeper server and clear the
data"
- echo " deploy deploy the program to remote machine"
- echo " start start program at remote machine"
- echo " stop stop program at remote machine"
- echo " clean clean deployed program at remote machine"
- echo
- echo "Command 'run.sh <command> -h' will print help for subcommands."
-}
-
-#####################
-## build
-#####################
-function usage_build()
-{
- subcommand="build"
- if [ "$ONLY_BUILD" == "NO" ]; then
- subcommand="test"
- fi
- echo "Options for subcommand '$subcommand':"
- echo " -h|--help print the help info"
- echo " -t|--type build type: debug|release, default is debug"
- echo " -c|--clear clear environment before building, but not
clear thirdparty"
- echo " --clear_thirdparty clear environment before building,
including thirdparty"
- echo " --compiler specify c and cxx compiler, sperated by ','"
- echo " e.g., \"gcc,g++\" or
\"clang-3.9,clang++-3.9\""
- echo " default is \"gcc,g++\""
- echo " -j|--jobs <num> the number of jobs to run simultaneously,
default 8"
- echo " --enable_gcov generate gcov code coverage report, default
no"
- echo " -v|--verbose build in verbose mode, default no"
- echo " --notest build without building unit tests, default
no"
- echo " --disable_gperf build without gperftools, this flag is
mainly used"
- echo " to enable valgrind memcheck, default no"
- echo " --use_jemalloc build with jemalloc"
- echo " --skip_thirdparty whether to skip building thirdparties,
default no"
- echo " --sanitizer <type> build with sanitizer to check potential
problems,
- type: address|leak|thread|undefined"
- if [ "$ONLY_BUILD" == "NO" ]; then
- echo " -m|--test_module specify modules to test, split by ',',"
- echo " e.g.,
\"dsn_runtime_tests,dsn_meta_state_tests\","
- echo " if not set, then run all tests"
- fi
-
- echo " --enable_rocksdb_portable build a portable rocksdb binary"
-}
-function run_build()
-{
- # NOTE(jiashuo1): No "memory" check mode, because MemorySanitizer is only
available in Clang for Linux x86_64 targets
- # https://www.jetbrains.com/help/clion/google-sanitizers.html
- SANITIZERS=("address" "leak" "thread" "undefined")
-
- C_COMPILER="gcc"
- CXX_COMPILER="g++"
- BUILD_TYPE="release"
- CLEAR=NO
- CLEAR_THIRDPARTY=NO
- JOB_NUM=8
- ENABLE_GCOV=NO
- RUN_VERBOSE=NO
- NO_TEST=NO
- DISABLE_GPERF=NO
- USE_JEMALLOC=NO
- SKIP_THIRDPARTY=NO
- SANITIZER=""
- TEST_MODULE=""
- ROCKSDB_PORTABLE=OFF
- while [[ $# > 0 ]]; do
- key="$1"
- case $key in
- -h|--help)
- usage_build
- exit 0
- ;;
- -t|--type)
- BUILD_TYPE="$2"
- shift
- ;;
- -c|--clear)
- CLEAR=YES
- ;;
- --clear_thirdparty)
- CLEAR_THIRDPARTY=YES
- ;;
- --compiler)
- C_COMPILER=`echo $2 | awk -F',' '{print $1}'`
- CXX_COMPILER=`echo $2 | awk -F',' '{print $2}'`
- if [ "x"$C_COMPILER == "x" -o "x"$CXX_COMPILER == "x" ]; then
- echo "ERROR: invalid compiler option: $2"
- echo
- usage_build
- exit 1
- fi
- shift
- ;;
- -j|--jobs)
- JOB_NUM="$2"
- shift
- ;;
- --enable_gcov)
- ENABLE_GCOV=YES
- BUILD_TYPE="debug"
- ;;
- -v|--verbose)
- RUN_VERBOSE=YES
- ;;
- --notest)
- NO_TEST=YES
- ;;
- --disable_gperf)
- DISABLE_GPERF=YES
- ;;
- --use_jemalloc)
- DISABLE_GPERF=YES
- USE_JEMALLOC=YES
- ;;
- --skip_thirdparty)
- SKIP_THIRDPARTY=YES
- ;;
- --sanitizer)
- IS_SANITIZERS=`echo ${SANITIZERS[@]} | grep -w $2`
- if [[ -z ${IS_SANITIZERS} ]]; then
- echo "ERROR: unknown sanitizer type \"$2\""
- usage_build
- exit 1
- fi
- SANITIZER="$2"
- shift
- ;;
- -m|--test_module)
- if [ "$ONLY_BUILD" == "YES" ]; then
- echo "ERROR: unknown option \"$key\""
- echo
- usage_build
- exit 1
- fi
- TEST_MODULE="$2"
- shift
- ;;
- --enable_rocksdb_portable)
- ROCKSDB_PORTABLE=ON
- ;;
- *)
- echo "ERROR: unknown option \"$key\""
- echo
- usage_build
- exit 1
- ;;
- esac
- shift
- done
-
- if [ "$(uname)" == "Darwin" ]; then
- MACOS_OPENSSL_ROOT_DIR="/usr/local/opt/openssl"
- CMAKE_OPTIONS="-DMACOS_OPENSSL_ROOT_DIR=${MACOS_OPENSSL_ROOT_DIR}"
- fi
- if [[ ${SKIP_THIRDPARTY} == "YES" ]]; then
- echo "Skip building third-parties..."
- else
- cd thirdparty
- if [[ "$CLEAR_THIRDPARTY" == "YES" ]]; then
- echo "Clear third-parties..."
- rm -rf build
- rm -rf output
- fi
- echo "Start building third-parties..."
- mkdir -p build
- pushd build
- CMAKE_OPTIONS="${CMAKE_OPTIONS}
- -DCMAKE_C_COMPILER=${C_COMPILER}
- -DCMAKE_CXX_COMPILER=${CXX_COMPILER}
- -DCMAKE_BUILD_TYPE=Release
- -DROCKSDB_PORTABLE=${ROCKSDB_PORTABLE}
- -DUSE_JEMALLOC=${USE_JEMALLOC}"
- cmake .. ${CMAKE_OPTIONS}
- make -j$JOB_NUM
- exit_if_fail $?
- popd
- cd ..
- fi
-
- if [ "$BUILD_TYPE" != "debug" -a "$BUILD_TYPE" != "release" ]; then
- echo "ERROR: invalid build type \"$BUILD_TYPE\""
- echo
- usage_build
- exit 1
- fi
- if [ "$ONLY_BUILD" == "NO" ]; then
- run_start_zk
- if [ $? -ne 0 ]; then
- echo "ERROR: start zk failed"
- exit 1
- fi
- fi
- C_COMPILER="$C_COMPILER" CXX_COMPILER="$CXX_COMPILER"
BUILD_TYPE="$BUILD_TYPE" \
- ONLY_BUILD="$ONLY_BUILD" CLEAR="$CLEAR" JOB_NUM="$JOB_NUM" \
- ENABLE_GCOV="$ENABLE_GCOV" SANITIZER="$SANITIZER" \
- RUN_VERBOSE="$RUN_VERBOSE" TEST_MODULE="$TEST_MODULE"
NO_TEST="$NO_TEST" \
- DISABLE_GPERF="$DISABLE_GPERF" USE_JEMALLOC="$USE_JEMALLOC" \
- MACOS_OPENSSL_ROOT_DIR="$MACOS_OPENSSL_ROOT_DIR" $scripts_dir/build.sh
-}
-
-#####################
-## start_zk
-#####################
-function usage_start_zk()
-{
- echo "Options for subcommand 'start_zk':"
- echo " -h|--help print the help info"
- echo " -d|--install_dir <dir>"
- echo " zookeeper install directory,"
- echo " if not set, then default is './.zk_install'"
- echo " -p|--port <port> listen port of zookeeper, default is 12181"
-}
-
-function run_start_zk()
-{
- # first we check the environment that zk need: java and nc command
- # check java
- type java >/dev/null 2>&1 || { echo >&2 "start zk failed, need install
jre..."; exit 1;}
-
- # check nc command
- type nc >/dev/null 2>&1 || { echo >&2 "start zk failed, need install
netcat command..."; exit 1;}
-
- INSTALL_DIR=`pwd`/.zk_install
- PORT=12181
- while [[ $# > 0 ]]; do
- key="$1"
- case $key in
- -h|--help)
- usage_start_zk
- exit 0
- ;;
- -d|--install_dir)
- INSTALL_DIR=$2
- shift
- ;;
- -p|--port)
- PORT=$2
- shift
- ;;
- *)
- echo "ERROR: unknown option \"$key\""
- echo
- usage_start_zk
- exit 1
- ;;
- esac
- shift
- done
- INSTALL_DIR="$INSTALL_DIR" PORT="$PORT" ./scripts/linux/start_zk.sh
-}
-
-#####################
-## stop_zk
-#####################
-function usage_stop_zk()
-{
- echo "Options for subcommand 'stop_zk':"
- echo " -h|--help print the help info"
- echo " -d|--install_dir <dir>"
- echo " zookeeper install directory,"
- echo " if not set, then default is './.zk_install'"
-}
-function run_stop_zk()
-{
- INSTALL_DIR=`pwd`/.zk_install
- while [[ $# > 0 ]]; do
- key="$1"
- case $key in
- -h|--help)
- usage_stop_zk
- exit 0
- ;;
- -d|--install_dir)
- INSTALL_DIR=$2
- shift
- ;;
- *)
- echo "ERROR: unknown option \"$key\""
- echo
- usage_stop_zk
- exit 1
- ;;
- esac
- shift
- done
- INSTALL_DIR="$INSTALL_DIR" ./scripts/linux/stop_zk.sh
-}
-
-#####################
-## clear_zk
-#####################
-function usage_clear_zk()
-{
- echo "Options for subcommand 'clear_zk':"
- echo " -h|--help print the help info"
- echo " -d|--install_dir <dir>"
- echo " zookeeper install directory,"
- echo " if not set, then default is './.zk_install'"
-}
-function run_clear_zk()
-{
- INSTALL_DIR=`pwd`/.zk_install
- while [[ $# > 0 ]]; do
- key="$1"
- case $key in
- -h|--help)
- usage_clear_zk
- exit 0
- ;;
- -d|--install_dir)
- INSTALL_DIR=$2
- shift
- ;;
- *)
- echo "ERROR: unknown option \"$key\""
- echo
- usage_clear__zk
- exit 1
- ;;
- esac
- shift
- done
- INSTALL_DIR="$INSTALL_DIR" ./scripts/linux/clear_zk.sh
-}
-
-####################################################################
-
-if [ $# -eq 0 ]; then
- usage
- exit 0
-fi
-cmd=$1
-case $cmd in
- help)
- usage ;;
- build)
- shift
- ONLY_BUILD=YES
- run_build $* ;;
- test)
- shift
- ONLY_BUILD=NO
- run_build $* ;;
- start_zk)
- shift
- run_start_zk $* ;;
- stop_zk)
- shift
- run_stop_zk $* ;;
- clear_zk)
- shift
- run_clear_zk $* ;;
- deploy|start|stop|clean)
- $scripts_dir/deploy.sh $* ;;
- *)
- echo "ERROR: unknown command $cmd"
- echo
- usage
- exit 1
-esac
-
diff --git a/rdsn/scripts/linux/build.sh b/rdsn/scripts/linux/build.sh
index fce51428e..fe44cc510 100755
--- a/rdsn/scripts/linux/build.sh
+++ b/rdsn/scripts/linux/build.sh
@@ -31,7 +31,6 @@
# BUILD_TYPE debug|release
# C_COMPILER <str>
# CXX_COMPILER <str>
-# ONLY_BUILD YES|NO
# RUN_VERBOSE YES|NO
# ENABLE_GCOV YES|NO
# TEST_MODULE "<module1> <module2> ..."
@@ -70,13 +69,6 @@ else
echo "BUILD_TYPE=release"
fi
-if [ "$ONLY_BUILD" == "YES" ]
-then
- echo "ONLY_BUILD=YES"
-else
- echo "ONLY_BUILD=NO"
-fi
-
if [ "$RUN_VERBOSE" == "YES" ]
then
echo "RUN_VERBOSE=YES"
@@ -93,12 +85,12 @@ else
echo "ENABLE_GCOV=NO"
fi
-if [ "$NO_TEST" == "YES" ]
+if [ "$TEST" == "NO" ]
then
- echo "NO_TEST=YES"
+ echo "TEST=NO"
CMAKE_OPTIONS="$CMAKE_OPTIONS -DBUILD_TEST=OFF"
else
- echo "NO_TEST=NO"
+ echo "TEST=YES"
fi
# valgrind can not work together with gpertools
@@ -111,7 +103,7 @@ else
echo "DISABLE_GPERF=NO"
fi
-if [ "$USE_JEMALLOC" == "YES" ]
+if [ "$USE_JEMALLOC" == "ON" ]
then
echo "USE_JEMALLOC=YES"
CMAKE_OPTIONS="$CMAKE_OPTIONS -DUSE_JEMALLOC=ON"
@@ -175,7 +167,7 @@ else
fi
cd ..
-if [ "$ONLY_BUILD" == "YES" ]
+if [ "$TEST" == "NO" ]
then
exit 0
fi
diff --git a/rdsn/scripts/linux/clear_zk.sh b/rdsn/scripts/linux/clear_zk.sh
deleted file mode 100755
index 1f7b98822..000000000
--- a/rdsn/scripts/linux/clear_zk.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Microsoft Corporation
-#
-# -=- Robust Distributed System Nucleus (rDSN) -=-
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-#
-# Options:
-# INSTALL_DIR <dir>
-
-if [ -z "$INSTALL_DIR" ]
-then
- echo "ERROR: no INSTALL_DIR specified"
- exit 1
-fi
-
-cd $INSTALL_DIR
-
-ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin
-
-if [ -d "$ZOOKEEPER_HOME" ]
-then
- $ZOOKEEPER_HOME/bin/zkServer.sh stop
- rm -rf $ZOOKEEPER_HOME/data &>/dev/null
- echo "Clearing zookeeper ... CLEARED"
-fi
diff --git a/rdsn/scripts/linux/start_zk.sh b/rdsn/scripts/linux/start_zk.sh
deleted file mode 100755
index 9bb38408d..000000000
--- a/rdsn/scripts/linux/start_zk.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/bash
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Microsoft Corporation
-#
-# -=- Robust Distributed System Nucleus (rDSN) -=-
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-#
-# Options:
-# INSTALL_DIR <dir>
-# PORT <port>
-
-PROJECT_DIR=$(realpath $(dirname $(dirname $(dirname "${BASH_SOURCE[0]}"))))
-
-if [ -z "$INSTALL_DIR" ]
-then
- echo "ERROR: no INSTALL_DIR specified"
- exit 1
-fi
-
-if [ -z "$PORT" ]
-then
- echo "ERROR: no PORT specified"
- exit 1
-fi
-
-mkdir -p $INSTALL_DIR
-if [ $? -ne 0 ]
-then
- echo "ERROR: mkdir $PREFIX failed"
- exit 1
-fi
-
-cd $INSTALL_DIR
-
-ZOOKEEPER_ROOT=apache-zookeeper-3.7.0-bin
-ZOOKEEPER_TAR_NAME=${ZOOKEEPER_ROOT}.tar.gz
-ZOOKEEPER_TAR_MD5_VALUE="8ffa97e7e6b0b2cf1d022e5156a7561a"
-
-if [ ! -f $ZOOKEEPER_TAR_NAME ]; then
- echo "Downloading zookeeper..."
-
download_url="http://pegasus-thirdparty-package.oss-cn-beijing.aliyuncs.com/apache-zookeeper-3.7.0-bin.tar.gz"
- if ! wget -T 5 -t 1 $download_url; then
- echo "ERROR: download zookeeper failed"
- exit 1
- fi
- if [ `md5sum $ZOOKEEPER_TAR_NAME | awk '{print$1}'` !=
$ZOOKEEPER_TAR_MD5_VALUE ]; then
- echo "check file $ZOOKEEPER_TAR_NAME md5sum failed!"
- exit 1
- fi
-fi
-
-if [ ! -d $ZOOKEEPER_ROOT ]; then
- echo "Decompressing zookeeper..."
- if ! tar xf $ZOOKEEPER_TAR_NAME; then
- echo "ERROR: decompress zookeeper failed"
- exit 1
- fi
-fi
-
-ZOOKEEPER_HOME=`pwd`/$ZOOKEEPER_ROOT
-ZOOKEEPER_PORT=$PORT
-
-cp $ZOOKEEPER_HOME/conf/zoo_sample.cfg $ZOOKEEPER_HOME/conf/zoo.cfg
-sed -i "s@dataDir=/tmp/zookeeper@dataDir=$ZOOKEEPER_HOME/data@"
$ZOOKEEPER_HOME/conf/zoo.cfg
-sed -i "s@clientPort=2181@clientPort=$ZOOKEEPER_PORT@"
$ZOOKEEPER_HOME/conf/zoo.cfg
-echo "admin.enableServer=false" >> $ZOOKEEPER_HOME/conf/zoo.cfg
-echo "4lw.commands.whitelist=ruok" >> $ZOOKEEPER_HOME/conf/zoo.cfg
-
-mkdir -p $ZOOKEEPER_HOME/data
-$ZOOKEEPER_HOME/bin/zkServer.sh start
-sleep 1
-
-zk_check_count=0
-while true; do
- sleep 1 # wait until zookeeper bootstrapped
- if echo ruok | nc localhost "$ZOOKEEPER_PORT" | grep -q imok; then
- echo "Zookeeper started at port $ZOOKEEPER_PORT"
- exit 0
- fi
- zk_check_count=$((zk_check_count+1))
- echo "ERROR: starting zookeeper has failed ${zk_check_count} times"
- if [ $zk_check_count -gt 30 ]; then
- echo "ERROR: failed to start zookeeper in 30 seconds"
- exit 1
- fi
-done
diff --git a/rdsn/scripts/linux/stop_zk.sh b/rdsn/scripts/linux/stop_zk.sh
deleted file mode 100755
index 0ed7357a7..000000000
--- a/rdsn/scripts/linux/stop_zk.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Microsoft Corporation
-#
-# -=- Robust Distributed System Nucleus (rDSN) -=-
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-#
-# Options:
-# INSTALL_DIR <dir>
-
-if [ -z "$INSTALL_DIR" ]
-then
- echo "ERROR: no INSTALL_DIR specified"
- exit 1
-fi
-
-cd $INSTALL_DIR
-
-ZOOKEEPER_HOME=`pwd`/apache-zookeeper-3.7.0-bin
-
-if [ -d "$ZOOKEEPER_HOME" ]
-then
- $ZOOKEEPER_HOME/bin/zkServer.sh stop
-fi
diff --git a/rdsn/src/failure_detector/test/config-test.ini
b/rdsn/src/failure_detector/test/config-test.ini
index 2a23e17f7..9f03be49d 100644
--- a/rdsn/src/failure_detector/test/config-test.ini
+++ b/rdsn/src/failure_detector/test/config-test.ini
@@ -124,7 +124,7 @@ worker_count = 8
partitioned = true
[zookeeper]
-hosts_list = localhost:12181
+hosts_list = localhost:22181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/rdsn/src/failure_detector/test/config-whitelist-test-failed.ini
b/rdsn/src/failure_detector/test/config-whitelist-test-failed.ini
index 47ff23fbb..0bf9f4621 100644
--- a/rdsn/src/failure_detector/test/config-whitelist-test-failed.ini
+++ b/rdsn/src/failure_detector/test/config-whitelist-test-failed.ini
@@ -125,7 +125,7 @@ worker_count = 8
partitioned = true
[zookeeper]
-hosts_list = localhost:12181
+hosts_list = localhost:22181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/rdsn/src/failure_detector/test/config-whitelist-test.ini
b/rdsn/src/failure_detector/test/config-whitelist-test.ini
index a1bd2fd9e..4d977761e 100644
--- a/rdsn/src/failure_detector/test/config-whitelist-test.ini
+++ b/rdsn/src/failure_detector/test/config-whitelist-test.ini
@@ -125,7 +125,7 @@ worker_count = 8
partitioned = true
[zookeeper]
-hosts_list = localhost:12181
+hosts_list = localhost:22181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/rdsn/src/meta/test/config-test.ini
b/rdsn/src/meta/test/config-test.ini
index 950f8ec38..e24f4d946 100644
--- a/rdsn/src/meta/test/config-test.ini
+++ b/rdsn/src/meta/test/config-test.ini
@@ -120,7 +120,6 @@ max_replica_count = 3
[zookeeper]
hosts_list = localhost:22181
-;hosts_list = localhost:12181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/rdsn/src/meta/test/meta_state/config-test.ini
b/rdsn/src/meta/test/meta_state/config-test.ini
index 978316991..75f4fe553 100644
--- a/rdsn/src/meta/test/meta_state/config-test.ini
+++ b/rdsn/src/meta/test/meta_state/config-test.ini
@@ -108,6 +108,6 @@ worker_count = 8
partitioned = true
[zookeeper]
-hosts_list = localhost:12181
+hosts_list = localhost:22181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/rdsn/src/zookeeper/test/config-test.ini
b/rdsn/src/zookeeper/test/config-test.ini
index 46dd4adff..46be534fa 100644
--- a/rdsn/src/zookeeper/test/config-test.ini
+++ b/rdsn/src/zookeeper/test/config-test.ini
@@ -116,6 +116,6 @@ worker_count = 8
partitioned = true
[zookeeper]
-hosts_list = localhost:12181
+hosts_list = localhost:22181
timeout_ms = 30000
logfile = zoolog.log
diff --git a/run.sh b/run.sh
index 99ca741a7..acc48ebaf 100755
--- a/run.sh
+++ b/run.sh
@@ -86,11 +86,25 @@ function usage_build()
echo " -v|--verbose build in verbose mode, default no"
echo " --disable_gperf build without gperftools, this flag is
mainly used"
echo " to enable valgrind memcheck, default no"
+ echo " --use_jemalloc build with jemalloc"
echo " --sanitizer <type> build with sanitizer to check potential
problems,
type: address|leak|thread|undefined"
echo " --skip_thirdparty whether to skip building thirdparties,
default no"
echo " --enable_rocksdb_portable build a portable rocksdb binary"
+ echo " --rdsn whether to build/test rdsn module only"
+ if [ "$TEST" == "YES" ]; then
+ echo " -m|--test_module specify modules to test, split by ',',"
+ echo " e.g.,
\"dsn_runtime_tests,dsn_meta_state_tests\","
+ echo " if not set, then run all tests"
+ fi
}
+
+function exit_if_fail() {
+ if [ $1 != 0 ]; then
+ exit $1
+ fi
+}
+
function run_build()
{
# Note(jiashuo1): No "memory" check mode, because MemorySanitizer is only
available in Clang for Linux x86_64 targets
@@ -111,7 +125,10 @@ function run_build()
SKIP_THIRDPARTY=NO
SANITIZER=""
TEST_MODULE=""
- ENABLE_ROCKSDB_PORTABLE=NO
+ ENABLE_ROCKSDB_PORTABLE=OFF
+ USE_JEMALLOC=OFF
+ TEST=NO
+ ONLY_RDSN=NO
while [[ $# > 0 ]]; do
key="$1"
case $key in
@@ -173,7 +190,21 @@ function run_build()
SKIP_THIRDPARTY=YES
;;
--enable_rocksdb_portable)
- ENABLE_ROCKSDB_PORTABLE=YES
+ ENABLE_ROCKSDB_PORTABLE=ON
+ ;;
+ --use_jemalloc)
+ DISABLE_GPERF=YES
+ USE_JEMALLOC=ON
+ ;;
+ -m|--test_module)
+ TEST_MODULE="$2"
+ shift
+ ;;
+ --test)
+ TEST=YES
+ ;;
+ --rdsn)
+ ONLY_RDSN=YES
;;
*)
echo "ERROR: unknown option \"$key\""
@@ -184,6 +215,19 @@ function run_build()
esac
shift
done
+
+ if [ "$TEST" == "NO" -a "$TEST_MODULE" != "" ]; then
+ echo "ERROR: invalid option: --test is off but -m|--test_module is on"
+ echo
+ usage_build
+ exit 1
+ fi
+
+ if [ "$(uname)" == "Darwin" ]; then
+ MACOS_OPENSSL_ROOT_DIR="/usr/local/opt/openssl"
+ CMAKE_OPTIONS="-DMACOS_OPENSSL_ROOT_DIR=${MACOS_OPENSSL_ROOT_DIR}"
+ fi
+
if [ "$BUILD_TYPE" != "debug" -a "$BUILD_TYPE" != "release" ]; then
echo "ERROR: invalid build type \"$BUILD_TYPE\""
echo
@@ -207,38 +251,54 @@ function run_build()
echo "INFO: start build rdsn..."
cd $ROOT/rdsn
- OPT="-t $BUILD_TYPE -j $JOB_NUM --compiler $C_COMPILER,$CXX_COMPILER"
- if [ "$CLEAR" == "YES" ]; then
- OPT="$OPT -c"
- fi
- if [ "$CLEAR_THIRDPARTY" == "YES" ]; then
- OPT="$OPT --clear_thirdparty"
- fi
- if [ "$WARNING_ALL" == "YES" ]; then
- OPT="$OPT -w"
- fi
- if [ "$RUN_VERBOSE" == "YES" ]; then
- OPT="$OPT -v"
- fi
- if [ "$ENABLE_GCOV" == "YES" ]; then
- OPT="$OPT --enable_gcov"
- fi
- if [ "$DISABLE_GPERF" == "YES" ]; then
- OPT="$OPT --disable_gperf"
- fi
- if [ "$SKIP_THIRDPARTY" == "YES" ]; then
- OPT="$OPT --skip_thirdparty"
+ if [[ ${SKIP_THIRDPARTY} == "YES" ]]; then
+ echo "Skip building third-parties..."
+ else
+ cd thirdparty
+ if [[ "$CLEAR_THIRDPARTY" == "YES" ]]; then
+ echo "Clear third-parties..."
+ rm -rf build
+ rm -rf output
+ fi
+ echo "Start building third-parties..."
+ mkdir -p build
+ pushd build
+ CMAKE_OPTIONS="${CMAKE_OPTIONS}
+ -DCMAKE_C_COMPILER=${C_COMPILER}
+ -DCMAKE_CXX_COMPILER=${CXX_COMPILER}
+ -DCMAKE_BUILD_TYPE=Release
+ -DROCKSDB_PORTABLE=${ENABLE_ROCKSDB_PORTABLE}
+ -DUSE_JEMALLOC=${USE_JEMALLOC}"
+ cmake .. ${CMAKE_OPTIONS}
+ make -j$JOB_NUM
+ exit_if_fail $?
+ popd
+ cd ..
fi
- if [ ! -z $SANITIZER ]; then
- OPT="$OPT --sanitizer $SANITIZER"
+
+ if [ "$BUILD_TYPE" != "debug" -a "$BUILD_TYPE" != "release" ]; then
+ echo "ERROR: invalid build type \"$BUILD_TYPE\""
+ echo
+ usage_build
+ exit 1
fi
- if [ "$ENABLE_ROCKSDB_PORTABLE" == "YES" ]; then
- OPT="$OPT --enable_rocksdb_portable"
+ if [ "$TEST" == "YES" ]; then
+ run_start_zk
+ if [ $? -ne 0 ]; then
+ echo "ERROR: start zk failed"
+ exit 1
+ fi
fi
- ./run.sh build $OPT --notest
- if [ $? -ne 0 ]; then
- echo "ERROR: build rdsn failed"
- exit 1
+ C_COMPILER="$C_COMPILER" CXX_COMPILER="$CXX_COMPILER"
BUILD_TYPE="$BUILD_TYPE" \
+ CLEAR="$CLEAR" JOB_NUM="$JOB_NUM" \
+ ENABLE_GCOV="$ENABLE_GCOV" SANITIZER="$SANITIZER" \
+ RUN_VERBOSE="$RUN_VERBOSE" TEST_MODULE="$TEST_MODULE" TEST="$TEST" \
+ DISABLE_GPERF="$DISABLE_GPERF" USE_JEMALLOC="$USE_JEMALLOC" \
+ MACOS_OPENSSL_ROOT_DIR="$MACOS_OPENSSL_ROOT_DIR"
./scripts/linux/build.sh
+ exit_if_fail $?
+
+ if [ "$ONLY_RDSN" == "YES" ]; then
+ exit 0
fi
echo "INFO: start build pegasus..."
@@ -396,7 +456,7 @@ function run_start_zk()
shift
done
- INSTALL_DIR="$INSTALL_DIR" PORT="$PORT" ./scripts/start_zk.sh
+ INSTALL_DIR="$INSTALL_DIR" PORT="$PORT" $ROOT/scripts/start_zk.sh
if [ $? -ne 0 ]; then
exit 1
fi
@@ -436,7 +496,7 @@ function run_stop_zk()
esac
shift
done
- INSTALL_DIR="$INSTALL_DIR" ./scripts/stop_zk.sh
+ INSTALL_DIR="$INSTALL_DIR" $ROOT/scripts/stop_zk.sh
}
#####################
@@ -473,7 +533,7 @@ function run_clear_zk()
esac
shift
done
- INSTALL_DIR="$INSTALL_DIR" ./scripts/clear_zk.sh
+ INSTALL_DIR="$INSTALL_DIR" $ROOT/scripts/clear_zk.sh
}
#####################
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]