@@ -172,6 +172,7 @@ TEST_P(TestVm, AlwaysApplyCanary) {
172172 // For each create Wasm, canary should be done.
173173 EXPECT_EQ (canary_count, 1 );
174174
175+ bool first = true ;
175176 std::unordered_set<std::shared_ptr<WasmHandleBase>> reference_holder;
176177
177178 for (const auto &root_id : root_ids) {
@@ -196,8 +197,15 @@ TEST_P(TestVm, AlwaysApplyCanary) {
196197 auto wasm_handle_comp =
197198 createWasm (vm_key, source, plugin_comp, wasm_handle_factory_comp,
198199 wasm_handle_clone_factory_for_canary, false );
199- // For each create Wasm, canary should be done.
200- EXPECT_EQ (canary_count, 1 );
200+ // Validate that canarying is cached for the first baseline plugin variant.
201+ if (first) {
202+ first = false ;
203+ EXPECT_EQ (canary_count, 0 );
204+ } else {
205+ // For each create Wasm, canary should be done.
206+ EXPECT_EQ (canary_count, 1 );
207+ EXPECT_TRUE (TestContext::isGlobalLogged (" onConfigure: " + root_id));
208+ }
201209
202210 if (plugin_config.empty ()) {
203211 // canary_check.wasm should raise the error at `onConfigure` in canary when the
@@ -212,8 +220,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
212220 // destroyed for each iteration.
213221 reference_holder.insert (wasm_handle_comp);
214222
215- EXPECT_TRUE (TestContext::isGlobalLogged (" onConfigure: " + root_id));
216-
217223 // Wasm VM is unique for vm_key.
218224 if (vm_key == vm_key_baseline) {
219225 EXPECT_EQ (wasm_handle_baseline->wasm (), wasm_handle_comp->wasm ());
0 commit comments