tests: skip netlink based tests when resources are not available
* tests/netlink_inet_diag.c (main): Return 77 if socket, bind, or listen syscall fail. * tests/netlink_unix_diag.c (main): Likewise.
This commit is contained in:
parent
babe7f6a30
commit
6add1b09d6
@ -81,11 +81,10 @@ int main(void)
|
||||
close(0);
|
||||
close(1);
|
||||
|
||||
assert(socket(PF_INET, SOCK_STREAM, 0) == 0);
|
||||
assert(bind(0, (struct sockaddr *) &addr, len) == 0);
|
||||
assert(listen(0, 5) == 0);
|
||||
|
||||
if (socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG) != 1)
|
||||
if (socket(PF_INET, SOCK_STREAM, 0) ||
|
||||
bind(0, (struct sockaddr *) &addr, len) ||
|
||||
listen(0, 5) ||
|
||||
socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG) != 1)
|
||||
return 77;
|
||||
|
||||
return (send_query(1, AF_INET, IPPROTO_TCP) &&
|
||||
|
@ -90,9 +90,11 @@ int main(void)
|
||||
close(1);
|
||||
|
||||
(void) unlink(SUN_PATH);
|
||||
assert(socket(PF_LOCAL, SOCK_STREAM, 0) == 0);
|
||||
assert(bind(0, (struct sockaddr *) &addr, len) == 0);
|
||||
assert(listen(0, 5) == 0);
|
||||
if (socket(PF_LOCAL, SOCK_STREAM, 0) ||
|
||||
bind(0, (struct sockaddr *) &addr, len) ||
|
||||
listen(0, 5))
|
||||
return 77;
|
||||
|
||||
assert(unlink(SUN_PATH) == 0);
|
||||
|
||||
if (socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG) != 1)
|
||||
|
Loading…
Reference in New Issue
Block a user