未验证 提交 3242f091 编写于 作者: W Wu Tao 提交者: GitHub

scripts: travis supports format (#358)

上级 1bcc9112
......@@ -94,3 +94,4 @@ LOG
PACKAGE
scripts/py_utils/*.pyc
cmake-build-debug
packages
......@@ -13,6 +13,7 @@ addons:
packages:
- libsnappy-dev
- liblz4-dev
- clang-format-3.9
cache:
- ccache
......@@ -30,6 +31,7 @@ install:
- wget https://github.com/facebook/zstd/archive/v1.3.7.zip; unzip v1.3.7; cd zstd-1.3.7;
- mkdir cmake-build; cd cmake-build; cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DZSTD_BUILD_PROGRAMS=OFF ../build/cmake; sudo make install -j8;
- cd ../..
- rm -rf v1.3.7.zip zstd-1.3.7;
before_script:
- cd rdsn/thirdparty
......@@ -40,7 +42,7 @@ before_script:
- ulimit -c unlimited -S
script:
- ./run.sh build --skip_thirdparty --disable_gperf && ./run.sh test
- ./scripts/travis.sh
after_script:
- ./run.sh stop_zk
......
......@@ -10,13 +10,13 @@ sds=./src/shell/sds
if [ $# -eq 0 ]; then
echo "formating all .h/.cpp files in $root_dir ..."
find . -type f -not \( -wholename "$linenoise/*" -o -wholename "$sds/*" -o -wholename "./rocksdb/*" -o -wholename "./rdsn/*" \) \
-regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format -i -style=file
-regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format-3.9 -i -style=file
elif [ $1 = "-h" ]; then
echo "USAGE: ./format-files.sh [<relative_path>] -- format .h/.cpp files in $root_dir/relative_path"
echo " ./format-files.sh means format all .h/.cpp files in $root_dir"
else
echo "formating all .h/.cpp files in $root_dir/$1 ..."
find ./$1 -type f -not \( -wholename "$linenoise/*" -o -wholename "$sds/*" -o -wholename "./rocksdb/*" -o -wholename "./rdsn/*" \) \
-regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format -i -style=file
-regextype posix-egrep -regex ".*\.(cpp|h)" | xargs clang-format-3.9 -i -style=file
fi
#!/bin/bash
# to project root directory
script_dir=$(cd "$(dirname "$0")" && pwd)
root=$(dirname "$script_dir")
cd "${root}" || exit 1
# ensure source files are well formatted
"${root}"/scripts/format_files.sh
# ignore updates of submodules
modified=$(git status -s --ignore-submodules)
if [ "$modified" ]; then
echo "$modified"
echo "please format the above files before commit"
exit 1
fi
"${root}"/run.sh build -c --skip_thirdparty --disable_gperf && ./run.sh test
if [ $? ]; then
echo "travis failed with exit code $?"
fi
......@@ -16,6 +16,6 @@ set(MY_PROJ_LIBS
set(MY_BOOST_LIBS Boost::system Boost::filesystem)
set(MY_BINPLACES "config.ini")
set(MY_BINPLACES config.ini run.sh)
dsn_add_test()
#!/usr/bin/env bash
exit_if_fail() {
if [ $1 != 0 ]; then
echo $2
exit 1
fi
}
./base_test
exit_if_fail $? "run unit test failed"
......@@ -89,7 +89,7 @@ int main(int argc, char **argv)
uint64_t start = env->NowNanos();
std::atomic<uint64_t> count(test_count);
dsn::utils::notify_event get_completed;
// test search_radial by lat & lng
for (int i = 0; i < test_count; ++i) {
S2LatLng latlng(S2Testing::SamplePoint(rect));
......
......@@ -115,8 +115,7 @@ public:
got_a_message = false;
entry_index = 0;
rr.length = 6;
rr.buffers = {
{"GEORADIUS"}, {""}, {"123.4"}, {"56.78"}, {"100"}, {"m"}};
rr.buffers = {{"GEORADIUS"}, {""}, {"123.4"}, {"56.78"}, {"100"}, {"m"}};
const char *request_data = "*6\r\n$9\r\nGEORADIUS\r\n$0\r\n\r\n$5\r\n123.4\r\n$5\r\n56."
"78\r\n$3\r\n100\r\n$1\r\nm\r\n";
......@@ -130,8 +129,7 @@ public:
got_a_message = false;
entry_index = 0;
rr.length = 5;
rr.buffers = {
{"GEORADIUSBYMEMBER"}, {""}, {"member1"}, {"1000.5"}, {"km"}};
rr.buffers = {{"GEORADIUSBYMEMBER"}, {""}, {"member1"}, {"1000.5"}, {"km"}};
const char *request_data = "*5\r\n$17\r\nGEORADIUSBYMEMBER\r\n$0\r\n\r\n$"
"7\r\nmember1\r\n$6\r\n1000.5\r\n$2\r\nkm\r\n";
......
......@@ -133,8 +133,7 @@ TEST_F(pegasus_compression_options_test, compression_types_convert_fail)
TEST_F(pegasus_compression_options_test, check_rocksdb_compression_types_default)
{
start();
check_db_compression_types({none, none, lz4, lz4, lz4, lz4},
"start with default");
check_db_compression_types({none, none, lz4, lz4, lz4, lz4}, "start with default");
}
} // namespace server
......
......@@ -2548,19 +2548,23 @@ print_current_scan_state(const std::vector<std::unique_ptr<scan_data_context>> &
fprintf(stderr,
"\n============================[hash_key_size]============================\n"
"%s=======================================================================",
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::HASH_KEY_SIZE)).c_str());
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::HASH_KEY_SIZE))
.c_str());
fprintf(stderr,
"\n============================[sort_key_size]============================\n"
"%s=======================================================================",
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::SORT_KEY_SIZE)).c_str());
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::SORT_KEY_SIZE))
.c_str());
fprintf(stderr,
"\n==============================[value_size]=============================\n"
"%s=======================================================================",
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::VALUE_SIZE)).c_str());
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::VALUE_SIZE))
.c_str());
fprintf(stderr,
"\n===============================[row_size]==============================\n"
"%s=======================================================================\n\n",
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::ROW_SIZE)).c_str());
statistics->getHistogramString(static_cast<uint32_t>(histogram_type::ROW_SIZE))
.c_str());
}
}
......
......@@ -42,8 +42,7 @@ protected:
system("sed -i \"/^perf_counter_enable_logging/c perf_counter_enable_logging = false\" "
"config-server-test-recovery.ini");
system(
"./run.sh start_onebox -m 1 -r 3 --config_path config-server-test-recovery.ini");
system("./run.sh start_onebox -m 1 -r 3 --config_path config-server-test-recovery.ini");
std::cout << "sleep for a while to wait the new onebox start" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册