tests: make unload test more comprehensive.
authorDavin McCall <davmac@davmac.org>
Thu, 12 Jul 2018 17:27:48 +0000 (18:27 +0100)
committerDavin McCall <davmac@davmac.org>
Thu, 12 Jul 2018 17:27:48 +0000 (18:27 +0100)
Specifically, make sure that the service that we request to unload is
not loaded afterwards.

src/tests/cptests/cptests.cc

index c75061bdac9ec544bc34df7f7e8a7a5a280dc452..89034ca14b91846a6da6d545674fb4768e44c7cb 100644 (file)
@@ -527,6 +527,19 @@ void cptest_unload()
     assert(wdata.size() == 1);
     assert(wdata[0] = DINIT_RP_NAK);
 
+    // If we try to FIND service 1 now, it should not be there:
+    cmd = { DINIT_CP_FINDSERVICE };
+    cmd.insert(cmd.end(), name_len_cptr, name_len_cptr + sizeof(name_len));
+    cmd.insert(cmd.end(), service_name1, service_name1 + name_len);
+
+    bp_sys::supply_read_data(fd, std::move(cmd));
+
+    event_loop.regd_bidi_watchers[fd]->read_ready(event_loop, fd);
+
+    bp_sys::extract_written_data(fd, wdata);
+    assert(wdata.size() == 1);
+    assert(wdata[0] = DINIT_RP_NOSERVICE);
+
     delete cc;
 }