ctdb-tests: Porting tests should ignore unsupported features
authorAmitay Isaacs <amitay@gmail.com>
Wed, 11 Jul 2018 07:23:43 +0000 (17:23 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 28 Jul 2018 01:50:11 +0000 (03:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/tests/cunit/porting_tests_001.sh
ctdb/tests/src/porting_tests.c

index ba69fb95c44d90dd0360924b508dcac7f7dafbbc..45ae619461070a89fa93b3305f4b09b29ac407c6 100755 (executable)
@@ -11,11 +11,16 @@ remove_socket ()
 
 test_cleanup remove_socket
 
-uid=$(id -u)
-if [ "$uid" -eq 0 ] ; then
-    ok "ctdb_sys_check_iface_exists: Interface 'fake' not found"
+os=$(uname)
+if [ "$os" = "Linux" ] ; then
+       uid=$(id -u)
+       if [ "$uid" -eq 0 ] ; then
+               ok "ctdb_sys_check_iface_exists: Interface 'fake' not found"
+       else
+               ok "ctdb_sys_check_iface_exists: Failed to open raw socket"
+       fi
 else
-    ok "ctdb_sys_check_iface_exists: Failed to open raw socket"
+       ok_null
 fi
 
 unit_test porting_tests --socket=${socket}
index 74dbf0781b46ef5856425c9c2104e6a1cce04b0f..8902c34dfc2a30469d9f4dda41a839057f292497 100644 (file)
@@ -192,11 +192,15 @@ static int test_ctdb_get_peer_pid(void)
        fd = socket_server_wait_peer();
 
        ret = ctdb_get_peer_pid(fd, &peer_pid);
-       assert(ret == 0);
+       assert(ret == 0 || ret == ENOSYS);
 
-       assert(peer_pid == globals.helper_pid);
+       if (ret == 0) {
+               assert(peer_pid == globals.helper_pid);
 
-       kill(peer_pid, SIGTERM);
+               kill(peer_pid, SIGTERM);
+       } else {
+               kill(globals.helper_pid, SIGTERM);
+       }
 
        close(fd);
        return 0;