提交 af174a4d 编写于 作者: H HuangWei 提交者: Wu Tao

fix: unit tests & travis.sh exit with err (#385)

上级 dea2bd9b
......@@ -17,7 +17,9 @@ if [ "$modified" ]; then
fi
"${root}"/run.sh build -c --skip_thirdparty --disable_gperf && ./run.sh test --on_travis
if [ $? ]; then
echo "travis failed with exit code $?"
ret=$?
if [ $ret ]; then
echo "travis failed with exit code $ret"
fi
exit $ret
......@@ -8,6 +8,6 @@
GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
int ans = RUN_ALL_TESTS();
dsn_exit(ans);
int ret = RUN_ALL_TESTS();
dsn_exit(ret);
}
......@@ -8,6 +8,6 @@
GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
int ans = RUN_ALL_TESTS();
dsn_exit(ans);
int ret = RUN_ALL_TESTS();
dsn_exit(ret);
}
......@@ -602,6 +602,6 @@ GTEST_API_ int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
dsn_init();
int ans = RUN_ALL_TESTS();
dsn_exit(ans);
int ret = RUN_ALL_TESTS();
dsn_exit(ret);
}
......@@ -8,6 +8,7 @@
#include "server/pegasus_server_impl.h"
std::atomic_bool gtest_done{false};
std::atomic_int gtest_ret{false};
class gtest_app : public dsn::service_app
{
......@@ -17,7 +18,7 @@ public:
dsn::error_code start(const std::vector<std::string> &args) override
{
dsn::service_app::start(args);
RUN_ALL_TESTS();
gtest_ret = RUN_ALL_TESTS();
gtest_done = true;
return dsn::ERR_OK;
}
......@@ -37,6 +38,5 @@ GTEST_API_ int main(int argc, char **argv)
while (!gtest_done) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
dsn_exit(0);
dsn_exit(gtest_ret);
}
......@@ -43,6 +43,6 @@ GTEST_API_ int main(int argc, char **argv)
int gargc = argc - 2;
testing::InitGoogleTest(&gargc, argv + 2);
int ans = RUN_ALL_TESTS();
dsn_exit(ans);
int ret = RUN_ALL_TESTS();
dsn_exit(ret);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册