MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / TEST

Function TEST

common/test/test_objcache.cpp:73–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73TEST(ObjectCache, release_cycle) {
74 set_log_output_level(ALOG_INFO);
75 DEFER(set_log_output_level(ALOG_DEBUG));
76 ObjectCache<int, ShowOnDtor*> ocache(1000UL * 1000 * 10);
77 // 10s, during the test, nothing will be free if not set recycle
78 std::vector<photon::join_handle*> handles;
79 std::vector<OCArg> args;
80 cycle_cnt = 0;
81 release_cnt = 0;
82 for (int i = 0; i < 100; i++) {
83 args.emplace_back(OCArg({&ocache, i + 1}));
84 }
85 for (auto& arg : args) {
86 handles.emplace_back(
87 photon::thread_enable_join(photon::thread_create(&objcache, &arg)));
88 }
89 for (const auto& handle : handles) {
90 photon::thread_join(handle);
91 }
92 EXPECT_EQ(cycle_cnt, release_cnt);
93}
94
95TEST(ObjectCache, timeout_refresh) {
96 release_cnt = 0;

Callers

nothing calls this directly

Calls 15

OCArgClass · 0.85
thread_enable_joinFunction · 0.85
thread_createFunction · 0.85
thread_joinFunction · 0.85
vcpu_initFunction · 0.85
vcpu_finiFunction · 0.85
OCArgV2Class · 0.85
thread_yieldFunction · 0.85
expireMethod · 0.80
set_log_output_levelFunction · 0.50
thread_usleepFunction · 0.50
thread_create11Function · 0.50

Tested by

no test coverage detected