diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..d9dec183144da4e6e9939e05141d9f6b8b514250 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +sudo: required +dist: trusty + +language: cpp + +os: linux + +compiler: + - gcc + +before_install: + - wget https://raw.githubusercontent.com/xiaomi/pegasus-common/master/build-depends.tar.gz + - tar xf build-depends.tar.gz + - cd packages + - ls | xargs sudo dpkg -i --force-depends + - cd .. + +install: + - sudo apt-get -f install + - sudo apt-get -y install libsnappy-dev + +before_script: + - cd rdsn/thirdparty + - wget https://raw.githubusercontent.com/xiaomi/pegasus-common/master/pegasus-thirdparty-prebuild.tar.gz + - tar xf pegasus-thirdparty-prebuild.tar.gz + - rm -rf pegasus-thirdparty-prebuild.tar.gz + - cd ../.. + - ulimit -c unlimited -S + +script: + - ./run.sh build && ./run.sh test + +notifications: + email: false diff --git a/rdsn b/rdsn index f19ad49dd37420f59f0e72f5bb70d4aaac04e3db..9f5c4144a8f64d875f734b6f38f764855a4e941d 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit f19ad49dd37420f59f0e72f5bb70d4aaac04e3db +Subproject commit 9f5c4144a8f64d875f734b6f38f764855a4e941d diff --git a/run.sh b/run.sh index 06b80328ef3ba5cb9066bc48b45afc0ec0dc707c..40994434cfd87e8098028dc44ea5db3c09c3e57a 100755 --- a/run.sh +++ b/run.sh @@ -206,7 +206,7 @@ function run_test() done if [ "$test_modules" == "" ]; then - test_modules="pegasus_rproxy_test pegasus_function_test" + test_modules="pegasus_rproxy_test pegasus_function_test pegasus_unit_test" fi ./run.sh clear_onebox #clear the onebox before test diff --git a/src/server/test/CMakeLists.txt b/src/server/test/CMakeLists.txt index 9333a1621a23815d597e80984635e4de1c779534..711fbcfa8f18d68a0f802fddb61c8edb1ea552b2 100644 --- a/src/server/test/CMakeLists.txt +++ b/src/server/test/CMakeLists.txt @@ -40,6 +40,6 @@ add_definitions(-DPEGASUS_UNIT_TEST) set(MY_BOOST_PACKAGES system filesystem) -set(MY_BINPLACES config.ini) +set(MY_BINPLACES config.ini run.sh) dsn_add_executable() diff --git a/src/server/test/main.cpp b/src/server/test/main.cpp index d0aee397f50e7abb6a69385c6c5e4fb9e7d4208e..25f8b83c9952a026889162e8bef5d786f4875971 100644 --- a/src/server/test/main.cpp +++ b/src/server/test/main.cpp @@ -6,6 +6,9 @@ #include #include +#include "server/pegasus_perf_counter.h" +#include "server/pegasus_server_impl.h" + std::atomic_bool gtest_done{false}; class gtest_app : public ::dsn::replication::replication_service_app @@ -29,6 +32,18 @@ GTEST_API_ int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); + // register perf counter. + dsn::tools::internal_use_only::register_component_provider( + "pegasus::server::pegasus_perf_counter", + pegasus::server::pegasus_perf_counter_factory, + ::dsn::PROVIDER_TYPE_MAIN); + + dsn::service_app::register_factory("replica"); + + dsn::replication::replication_app_base::register_storage_engine( + "pegasus", + dsn::replication::replication_app_base::create); + dsn::service_app::register_factory("replica"); dsn_run_config("config.ini", false); diff --git a/src/server/test/pegasus_server_test_base.h b/src/server/test/pegasus_server_test_base.h index e7b8a25c5e8b7fe1df254ac4e2bdcf852ab153c0..d5cacbd1575fc35108b982a8b47a2a34f6301bdf 100644 --- a/src/server/test/pegasus_server_test_base.h +++ b/src/server/test/pegasus_server_test_base.h @@ -24,7 +24,7 @@ public: _gpid = dsn::gpid(100, 1); dsn::app_info app_info; - app_info.app_type = "replica"; + app_info.app_type = "pegasus"; _replica = dsn::replication::create_test_replica(_replica_stub, _gpid, app_info, "./", false); diff --git a/src/server/test/run.sh b/src/server/test/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..fd25fbdd4fed910686347917f61d1e4c2f6cd673 --- /dev/null +++ b/src/server/test/run.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +./pegasus_unit_test