Changeset 896f068 in rtems-libbsd


Ignore:
Timestamp:
Nov 10, 2017, 10:53:07 AM (20 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
eeb3fd5d9b07ac9a2e280cff60a1b762bd273a8d, 1e989998de954bef51e6c19cc3d64d39f32100aa
Children:
7e52ab9
Parents:
23cd284
Message:

tests/syscalls01: Fix shutdown() test

The socket must be connected for a shutdown().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuite/syscalls01/test_main.c

    r23cd284 r896f068  
    5454
    5555#include <rtems.h>
     56#include <rtems/bsd/bsd.h>
    5657#include <rtems/libcsupport.h>
    5758
     
    423424        mode_t cansend = S_IWUSR | S_IWGRP | S_IWOTH;
    424425        rtems_resource_snapshot snapshot;
     426        struct sockaddr_in addr;
    425427        struct stat st;
    426428        int sd;
     
    431433        rtems_resource_snapshot_take(&snapshot);
    432434
     435        init_addr(&addr);
     436
    433437        sd = socket(PF_INET, SOCK_DGRAM, 0);
    434438        assert(sd >= 0);
     
    440444        assert(st.st_mode == (S_IFSOCK | canrecv | cansend));
    441445
     446        rv = connect(sd, (struct sockaddr *) &addr, sizeof(addr));
     447        assert(rv == 0);
     448
    442449        rv = shutdown(sd, SHUT_RD);
    443450        assert(rv == 0);
     
    464471        sd = socket(PF_INET, SOCK_DGRAM, 0);
    465472        assert(sd >= 0);
     473
     474        rv = connect(sd, (struct sockaddr *) &addr, sizeof(addr));
     475        assert(rv == 0);
    466476
    467477        do_no_mem_test(no_mem_socket_shutdown, sd);
     
    15931603test_main(void)
    15941604{
     1605
    15951606        /* Must be first test to ensure resource checks work */
    15961607        test_sockets();
    15971608
    15981609        test_socket_unsupported_ops();
    1599         test_socket_fstat_and_shutdown();
    16001610        test_socket_ioctl();
    16011611        test_socket_bind();
     
    16201630        test_setgethostname();
    16211631
     1632        rtems_bsd_ifconfig_lo0();
     1633        test_socket_fstat_and_shutdown();
     1634
    16221635        exit(0);
    16231636}
Note: See TracChangeset for help on using the changeset viewer.