This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 754eeb98 Stabilize butex stop-before-running test (#3556)
754eeb98 is described below

commit 754eeb98d316a5199e0080d374d51d12682af362
Author: Xiaofeng Wang <[email protected]>
AuthorDate: Mon Sep 21 14:36:05 2026 +0800

    Stabilize butex stop-before-running test (#3556)
    
    Remove the 5 ms completion-time assertion from the stop-before-running test.
    Scheduler latency is not part of the tested API contract, while the existing
    assertions still verify interruption, joining, and repeated stop behavior.
---
 test/bthread_butex_unittest.cpp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/test/bthread_butex_unittest.cpp b/test/bthread_butex_unittest.cpp
index b3f73b40..a92f447d 100644
--- a/test/bthread_butex_unittest.cpp
+++ b/test/bthread_butex_unittest.cpp
@@ -268,7 +268,6 @@ TEST(ButexTest, stop_after_running) {
 TEST(ButexTest, stop_before_running) {
     int* butex = bthread::butex_create_checked<int>();
     *butex = 7;
-    butil::Timer tm;
     const long WAIT_MSEC = 500;
 
     for (int i = 0; i < 2; ++i) {
@@ -276,17 +275,11 @@ TEST(ButexTest, stop_before_running) {
             (i == 0 ? BTHREAD_ATTR_PTHREAD : BTHREAD_ATTR_NORMAL) | 
BTHREAD_NOSIGNAL;
         bthread_t th;
         ButexWaitArg arg = { butex, *butex, WAIT_MSEC, EINTR };
-        
-        tm.start();
+
         ASSERT_EQ(0, bthread_start_background(&th, &attr, wait_butex, &arg));
         ASSERT_EQ(0, bthread_stop(th));
         bthread_flush();
         ASSERT_EQ(0, bthread_join(th, nullptr));
-        tm.stop();
-        
-        ASSERT_LT(tm.m_elapsed(), 5);
-        // ASSERT_TRUE(bthread::get_task_control()->
-        //             timer_thread()._idset.empty());
         ASSERT_EQ(EINVAL, bthread_stop(th));
     }
     bthread::butex_destroy(butex);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to