lease-server-test: Destroy server on shutdown
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>
Tue, 9 Mar 2021 04:25:41 +0000 (13:25 +0900)
committerDamian Hobson-Garcia <dhobsong@igel.co.jp>
Wed, 31 Mar 2021 01:23:17 +0000 (10:23 +0900)
libcheck tests normally run each test in a separate process
so the server objects will automatically be destroyed after
each test.  If the test suite is run with CK_FORK=no, for
example when debugging the test with gdb, failing to
destory the server object will leave the test sockets
from the previous test open, which will stop the next
test from creating its own sockets.

Bug-AGL: SPEC-3816

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Change-Id: I63b86d692490c4cce7107839c7bd558a35855b0a

drm-lease-manager/test/lease-server-test.c

index f8e000e..2672820 100644 (file)
@@ -197,6 +197,7 @@ START_TEST(issue_lease_request_and_release)
        get_and_check_request(ls, &test_lease, LS_REQ_GET_LEASE);
        test_client_stop(cstate);
        get_and_check_request(ls, &test_lease, LS_REQ_RELEASE_LEASE);
+       ls_destroy(ls);
 }
 END_TEST
 
@@ -216,6 +217,7 @@ START_TEST(issue_lease_request_and_early_release)
        test_client_stop(cstate);
        get_and_check_request(ls, &test_lease, LS_REQ_GET_LEASE);
        get_and_check_request(ls, &test_lease, LS_REQ_RELEASE_LEASE);
+       ls_destroy(ls);
 }
 END_TEST
 
@@ -269,6 +271,7 @@ START_TEST(issue_multiple_lease_requests)
        ck_assert_int_eq(accepted_config.connection_completed, true);
        for (int i = 0; i < nextra_clients; i++)
                ck_assert_int_eq(extra_configs[i].connection_completed, false);
+       ls_destroy(ls);
 }
 END_TEST
 
@@ -316,6 +319,7 @@ START_TEST(send_fd_to_client)
        ck_assert_int_eq(default_test_config.connection_completed, true);
        ck_assert_int_eq(default_test_config.has_data, true);
        check_fd_equality(test_fd, default_test_config.received_fd);
+       ls_destroy(ls);
 }
 END_TEST
 
@@ -345,6 +349,7 @@ START_TEST(ls_send_fd_is_noop_when_fd_is_invalid)
        get_and_check_request(ls, &test_lease, LS_REQ_RELEASE_LEASE);
        ck_assert_int_eq(default_test_config.connection_completed, true);
        ck_assert_int_eq(default_test_config.has_data, false);
+       ls_destroy(ls);
 }
 END_TEST