Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8689a03 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Gracefully shutdown SUT in cert

* After each test suite, shutdown the stack before closing rootcanal
* Don't stop gRPC server twice
* Crash the stack when can't build gRPC server

Test: cert/run_cert.sh
Change-Id: Ie4c8d749079e99b46d63fb70d157db26d9aa2474
parent 8019a7e2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@ class GdBaseTestClass(BaseTestClass):
            builtin=True)

    def teardown_class(self):
        self.unregister_controllers()
        self.rootcanal_process.send_signal(signal.SIGINT)
        self.rootcanal_process.wait()
        self.rootcanal_logs.close()
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ class GdDevice:
    def clean_up(self):
        self.grpc_channel.close()
        self.backing_process.send_signal(signal.SIGINT)
        self.backing_process.wait()
        self.backing_process_logs.close()

class GdDeviceLoggerAdapter(logging.LoggerAdapter):
+0 −1
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ int main(int argc, const char** argv) {
  auto wait_thread = std::thread([grpc_module] { grpc_module->RunGrpcLoop(); });
  wait_thread.join();

  grpc_module->StopServer();
  stack->ShutDown();
  delete stack;

+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ void GrpcModule::StartServer(const std::string& address, int port) {
  builder.AddListeningPort(listening_port, ::grpc::InsecureServerCredentials());
  completion_queue_ = builder.AddCompletionQueue();
  server_ = builder.BuildAndStart();
  ASSERT(server_ != nullptr);

  for (const auto& facade : facades_) {
    facade->OnServerStarted(completion_queue_.get());