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

pengzheng pushed a commit to branch hotfix/shaky-framework-test
in repository https://gitbox.apache.org/repos/asf/celix.git

commit ab2f7ba05f4691672b7cf60cdb2599d39fce8860
Author: PengZheng <[email protected]>
AuthorDate: Wed Apr 17 18:02:24 2024 +0800

    Use more reliable synchronization method in test case.
---
 libs/framework/gtest/src/CelixFrameworkTestSuite.cc | 16 ++++++++--------
 libs/framework/src/framework_private.h              |  5 -----
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc 
b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
index ea3920ec..3eae055c 100644
--- a/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
+++ b/libs/framework/gtest/src/CelixFrameworkTestSuite.cc
@@ -26,7 +26,7 @@
 #include "celix_launcher.h"
 #include "celix_framework_factory.h"
 #include "celix_framework.h"
-#include "framework.h"
+#include "framework_private.h"
 #include "celix_constants.h"
 #include "celix_utils.h"
 
@@ -105,27 +105,27 @@ TEST_F(CelixFrameworkTestSuite, 
AsyncInstallStartStopUpdateAndUninstallBundleTes
     EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_startBundleAsync(framework.get(), bndId);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_TRUE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_TRUE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_stopBundleAsync(framework.get(), bndId);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_updateBundleAsync(framework.get(), bndId, NULL);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_unloadBundleAsync(framework.get(), bndId);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_FALSE(celix_framework_isBundleInstalled(framework.get(), bndId));
 
     // reloaded bundle should reuse the same bundle id
@@ -134,7 +134,7 @@ TEST_F(CelixFrameworkTestSuite, 
AsyncInstallStartStopUpdateAndUninstallBundleTes
     EXPECT_FALSE(celix_framework_isBundleActive(framework.get(), bndId));
 
     celix_framework_uninstallBundleAsync(framework.get(), bndId);
-    std::this_thread::sleep_for(std::chrono::milliseconds{100});
+    celix_framework_waitForBundleLifecycleHandlers(framework.get());
     EXPECT_FALSE(celix_framework_isBundleInstalled(framework.get(), bndId));
 }
 
diff --git a/libs/framework/src/framework_private.h 
b/libs/framework/src/framework_private.h
index 162eec4a..a00d6d8c 100644
--- a/libs/framework/src/framework_private.h
+++ b/libs/framework/src/framework_private.h
@@ -344,11 +344,6 @@ void 
celix_framework_waitForAsyncRegistration(celix_framework_t *fw, long svcId)
  */
 void celix_framework_waitForAsyncUnregistration(celix_framework_t *fw, long 
svcId);
 
-/**
- * Returns whether the current thread is the Celix framework event loop thread.
- */
-bool celix_framework_isCurrentThreadTheEventLoop(celix_framework_t* fw);
-
 /**
  * Increase the use count of a bundle and ensure that a bundle cannot be 
uninstalled.
  */

Reply via email to