Commit ce673b55 authored by gejun's avatar gejun

tweak params of some UT

parent 2a1d50d6
...@@ -648,8 +648,8 @@ TEST_F(BuiltinServiceTest, pprof) { ...@@ -648,8 +648,8 @@ TEST_F(BuiltinServiceTest, pprof) {
ClosureChecker done; ClosureChecker done;
brpc::Controller cntl; brpc::Controller cntl;
service.heap(&cntl, NULL, NULL, &done); service.heap(&cntl, NULL, NULL, &done);
// MUST fail since tcmalloc hasn't been linked in const int rc = getenv("TCMALLOC_SAMPLE_PARAMETER") ? 0 : brpc::ENOMETHOD;
EXPECT_EQ(brpc::ENOMETHOD, cntl.ErrorCode()); EXPECT_EQ(rc, cntl.ErrorCode());
} }
{ {
ClosureChecker done; ClosureChecker done;
......
...@@ -105,7 +105,7 @@ TEST(CondTest, sanity) { ...@@ -105,7 +105,7 @@ TEST(CondTest, sanity) {
long delta = wake_time[i] - last_time - SIGNAL_INTERVAL_US; long delta = wake_time[i] - last_time - SIGNAL_INTERVAL_US;
EXPECT_GT(wake_time[i], last_time); EXPECT_GT(wake_time[i], last_time);
square_sum += delta * delta; square_sum += delta * delta;
EXPECT_LT(abs(delta), 1000L) << "error[" << i << "]=" << delta << "=" EXPECT_LT(abs(delta), 2000L) << "error[" << i << "]=" << delta << "="
<< wake_time[i] << " - " << last_time; << wake_time[i] << " - " << last_time;
} }
printf("Average error is %fus\n", sqrt(square_sum / std::max(nbeforestop, 1UL))); printf("Average error is %fus\n", sqrt(square_sum / std::max(nbeforestop, 1UL)));
......
...@@ -49,7 +49,7 @@ TEST_F(ReducerTest, adder) { ...@@ -49,7 +49,7 @@ TEST_F(ReducerTest, adder) {
ASSERT_EQ(-5, reducer3.get_value()); ASSERT_EQ(-5, reducer3.get_value());
} }
const size_t OPS_PER_THREAD = 5000000; const size_t OPS_PER_THREAD = 500000;
static void *thread_counter(void *arg) { static void *thread_counter(void *arg) {
bvar::Adder<uint64_t> *reducer = (bvar::Adder<uint64_t> *)arg; bvar::Adder<uint64_t> *reducer = (bvar::Adder<uint64_t> *)arg;
...@@ -297,7 +297,7 @@ TEST_F(ReducerTest, non_primitive_mt) { ...@@ -297,7 +297,7 @@ TEST_F(ReducerTest, non_primitive_mt) {
for (size_t i = 0; i < arraysize(th); ++i) { for (size_t i = 0; i < arraysize(th); ++i) {
pthread_create(&th[i], NULL, string_appender, &cater); pthread_create(&th[i], NULL, string_appender, &cater);
} }
usleep(10000); usleep(50000);
g_stop = true; g_stop = true;
butil::hash_map<pthread_t, int> appended_count; butil::hash_map<pthread_t, int> appended_count;
for (size_t i = 0; i < arraysize(th); ++i) { for (size_t i = 0; i < arraysize(th); ++i) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment